-
Notifications
You must be signed in to change notification settings - Fork 25
use release artifacts for e2e tests #152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -53,6 +53,8 @@ var _ = Describe("Manager", Ordered, func() { | |
| // enforce the restricted security policy to the namespace, installing CRDs, | ||
| // and deploying the controller. | ||
| BeforeAll(func() { | ||
| useReleaseArtifacts := os.Getenv("USE_RELEASE_ARTIFACTS") == "true" | ||
|
|
||
| By("creating manager namespace") | ||
| cmd := exec.Command("kubectl", "create", "ns", namespace) | ||
| _, err := utils.Run(cmd) | ||
|
|
@@ -64,33 +66,57 @@ var _ = Describe("Manager", Ordered, func() { | |
| _, err = utils.Run(cmd) | ||
| Expect(err).NotTo(HaveOccurred(), "Failed to label namespace with restricted policy") | ||
|
|
||
| By("installing CRDs") | ||
| cmd = exec.Command("make", "install") | ||
| _, err = utils.Run(cmd) | ||
| Expect(err).NotTo(HaveOccurred(), "Failed to install CRDs") | ||
| if useReleaseArtifacts { | ||
| By("installing CRDs from dist/crds.yaml") | ||
| cmd = exec.Command("kubectl", "apply", "-f", "dist/crds.yaml") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This would mean that |
||
| _, err = utils.Run(cmd) | ||
| Expect(err).NotTo(HaveOccurred(), "Failed to install CRDs from dist/") | ||
|
|
||
| By("deploying the controller-manager") | ||
| cmd = exec.Command("make", "deploy", fmt.Sprintf("IMG_PREFIX=%s", imagePrefix), fmt.Sprintf("IMG_TAG=%s", imageTag)) | ||
| _, err = utils.Run(cmd) | ||
| Expect(err).NotTo(HaveOccurred(), "Failed to deploy the controller-manager") | ||
| By("deploying the controller-manager from dist/install.yaml") | ||
| cmd = exec.Command("kubectl", "apply", "-f", "dist/install.yaml") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same, this needs install.yaml |
||
| _, err = utils.Run(cmd) | ||
| Expect(err).NotTo(HaveOccurred(), "Failed to deploy from dist/") | ||
| } else { | ||
| By("installing CRDs") | ||
| cmd = exec.Command("make", "install") | ||
| _, err = utils.Run(cmd) | ||
| Expect(err).NotTo(HaveOccurred(), "Failed to install CRDs") | ||
|
|
||
| By("deploying the controller-manager") | ||
| cmd = exec.Command("make", "deploy", fmt.Sprintf("IMG_PREFIX=%s", imagePrefix), fmt.Sprintf("IMG_TAG=%s", imageTag)) | ||
| _, err = utils.Run(cmd) | ||
| Expect(err).NotTo(HaveOccurred(), "Failed to deploy the controller-manager") | ||
| } | ||
|
|
||
| Expect(err).NotTo(HaveOccurred(), "Failed to patch deployment") | ||
| }) | ||
|
|
||
| // After all tests have been executed, clean up by undeploying the controller, uninstalling CRDs, | ||
| // and deleting the namespace. | ||
| AfterAll(func() { | ||
| useReleaseArtifacts := os.Getenv("USE_RELEASE_ARTIFACTS") == "true" | ||
|
|
||
| By("cleaning up the curl pod for metrics") | ||
| cmd := exec.Command("kubectl", "delete", "pod", "curl-metrics", "-n", namespace) | ||
| _, _ = utils.Run(cmd) | ||
|
|
||
| By("undeploying the controller-manager") | ||
| cmd = exec.Command("make", "undeploy") | ||
| _, _ = utils.Run(cmd) | ||
|
|
||
| By("uninstalling CRDs") | ||
| cmd = exec.Command("make", "uninstall") | ||
| _, _ = utils.Run(cmd) | ||
| if useReleaseArtifacts { | ||
| By("undeploying the controller-manager from dist/install.yaml") | ||
| cmd = exec.Command("kubectl", "delete", "-f", "dist/install.yaml", "--ignore-not-found") | ||
| _, _ = utils.Run(cmd) | ||
|
|
||
| By("uninstalling CRDs from dist/crds.yaml") | ||
| cmd = exec.Command("kubectl", "delete", "-f", "dist/crds.yaml", "--ignore-not-found") | ||
| _, _ = utils.Run(cmd) | ||
| } else { | ||
| By("undeploying the controller-manager") | ||
| cmd = exec.Command("make", "undeploy") | ||
| _, _ = utils.Run(cmd) | ||
|
|
||
| By("uninstalling CRDs") | ||
| cmd = exec.Command("make", "uninstall") | ||
| _, _ = utils.Run(cmd) | ||
| } | ||
|
|
||
| By("removing manager namespace") | ||
| cmd = exec.Command("kubectl", "delete", "ns", namespace) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any particular reason why we want to skip the build? am assuming this is for the case where image is already built and loaded in cluster, mainly when running e2e in local env