-
Notifications
You must be signed in to change notification settings - Fork 23
feat: Remove API Dependency on Tekton and cert-manager #274
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
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 |
|---|---|---|
|
|
@@ -126,6 +126,20 @@ func setupTektonCRDs(ctx context.Context) { | |
| tektonOpCRD.Status.StoredVersions = []string{"v1alpha1"} | ||
| err = k8sClient.Create(ctx, tektonOpCRD, &client.CreateOptions{}) | ||
| Expect(err).NotTo(HaveOccurred()) | ||
|
|
||
| // Wait for the CRD to be established before proceeding | ||
| Eventually(func() bool { | ||
| crd := &crdv1.CustomResourceDefinition{} | ||
| if err := k8sClient.Get(ctx, types.NamespacedName{Name: "tektonconfigs.operator.tekton.dev"}, crd); err != nil { | ||
| return false | ||
| } | ||
| for _, condition := range crd.Status.Conditions { | ||
| if condition.Type == crdv1.Established && condition.Status == crdv1.ConditionTrue { | ||
| return true | ||
| } | ||
| } | ||
| return false | ||
| }).Should(BeTrue(), "TektonConfig CRD should be established") | ||
|
Comment on lines
+129
to
+142
Member
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. Should we also do this for the cert-manager
Contributor
Author
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. Good looking out. I’ll look into this in a future pr |
||
| } | ||
| Expect(err).NotTo(HaveOccurred()) | ||
| } | ||
|
|
@@ -191,31 +205,39 @@ func createTektonConfig(ctx context.Context) *tektonoperatorv1alpha1.TektonConfi | |
| }, | ||
| }, | ||
| } | ||
| _, err := tektonOpClient.TektonConfigs().Create(ctx, tektonConfig, metav1.CreateOptions{}) | ||
| // Use controller-runtime client instead of REST client for better compatibility with envtest | ||
| err := k8sClient.Create(ctx, tektonConfig, &client.CreateOptions{}) | ||
|
Comment on lines
+208
to
+209
Member
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. 👍 - thank you for this! Much needed payoff for old tech debt. |
||
| if errors.IsAlreadyExists(err) { | ||
| // If it already exists, that's fine | ||
| err = nil | ||
| // If it already exists, fetch it | ||
| err = k8sClient.Get(ctx, types.NamespacedName{Name: "config"}, tektonConfig) | ||
| Expect(err).NotTo(HaveOccurred()) | ||
| } else { | ||
| Expect(err).NotTo(HaveOccurred()) | ||
| } | ||
| Expect(err).To(BeNil()) | ||
|
|
||
| return tektonConfig | ||
| } | ||
|
|
||
| // deleteTektonConfig tears down the given TektonConfig instance. | ||
| func deleteTektonConfig(ctx context.Context) { | ||
| By("deleting the TektonConfig instance") | ||
| err := tektonOpClient.TektonConfigs().Delete(ctx, "config", metav1.DeleteOptions{}) | ||
| tektonConfig := &tektonoperatorv1alpha1.TektonConfig{ | ||
| ObjectMeta: metav1.ObjectMeta{ | ||
| Name: "config", | ||
| }, | ||
| } | ||
| err := k8sClient.Delete(ctx, tektonConfig, &client.DeleteOptions{}) | ||
| // the delete e2e's can delete this object before this AfterEach runs | ||
| if errors.IsNotFound(err) { | ||
| return | ||
| } | ||
| Expect(err).NotTo(HaveOccurred()) | ||
|
|
||
| By("waiting for TektonConfig instance to be completely removed") | ||
| Eventually(func() error { | ||
| _, err := tektonOpClient.TektonConfigs().Get(ctx, "config", metav1.GetOptions{}) | ||
| return err | ||
| }, "30s", "5s").Should(WithTransform(errors.IsNotFound, BeTrue())) | ||
| Eventually(func() bool { | ||
| err := k8sClient.Get(ctx, types.NamespacedName{Name: "config"}, tektonConfig) | ||
| return errors.IsNotFound(err) | ||
| }, "30s", "5s").Should(BeTrue(), "TektonConfig should be deleted") | ||
| } | ||
|
|
||
| var _ = BeforeSuite(func() { | ||
|
|
||
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.
👍 - we can't rely on Operator Lifecycle Manager to install these with this change.
We will also need to update the "Getting Started" instructions once we get the release working on OperatorHub.