-
Notifications
You must be signed in to change notification settings - Fork 21
Fix integration tests suite #541
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
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -731,7 +731,7 @@ func (s *RedpandaControllerSuite) TestStableUIDAndGeneration() { | |||||
| flipped := s.snapshotCluster(filter) | ||||||
| s.compareSnapshot(fresh, flipped, isStable) | ||||||
|
|
||||||
| s.T().Logf("toggling useFlux: %t -> %t", useFlux, !useFlux) | ||||||
| s.T().Logf("toggling useFlux: %t -> %t", !useFlux, useFlux) | ||||||
| rp.Spec.ChartRef.UseFlux = ptr.To(useFlux) | ||||||
| s.applyAndWait(rp) | ||||||
|
|
||||||
|
|
@@ -743,12 +743,18 @@ func (s *RedpandaControllerSuite) TestStableUIDAndGeneration() { | |||||
| // HelmRelease and HelmChart are checked explicitly here, but any test that would left behind mentioned resource | ||||||
| // will prevent from namespace deletion. In other words if test suite can not delete namespace, then with high | ||||||
| // probability resource with finalizer prevents from namespace deletion. | ||||||
| var hr v2beta2.HelmRelease | ||||||
| err := s.client.Get(s.ctx, types.NamespacedName{Name: rp.GetHelmReleaseName(), Namespace: rp.Namespace}, &hr) | ||||||
| s.True(apierrors.IsNotFound(err)) | ||||||
|
|
||||||
| // In the flux base deployment the HelmRelease will be deleted after Redpanda is fully removed from | ||||||
| // Kubernetes API server. The ownerReference tight together Redpanda with HelmRelease, but there is | ||||||
| // delay between HelmRelease and Redpadna custom resource deletion. | ||||||
|
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.
Suggested change
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. You could also change the deletion policy to foreground, which should stall the delete until all "children" as GC'd. |
||||||
| s.EventuallyWithT(func(t *assert.CollectT) { | ||||||
| var hr v2beta2.HelmRelease | ||||||
| err := s.client.Get(s.ctx, types.NamespacedName{Name: rp.GetHelmReleaseName(), Namespace: rp.Namespace}, &hr) | ||||||
| assert.True(t, apierrors.IsNotFound(err)) | ||||||
| }, time.Minute, time.Second, "HelmRelease not GC'd") | ||||||
|
|
||||||
| var hc sourcecontrollerv1beta2.HelmChart | ||||||
| err = s.client.Get(s.ctx, types.NamespacedName{Name: rp.Namespace + "-" + rp.Name, Namespace: rp.Namespace}, &hc) | ||||||
| err := s.client.Get(s.ctx, types.NamespacedName{Name: rp.Namespace + "-" + rp.Name, Namespace: rp.Namespace}, &hc) | ||||||
| s.True(apierrors.IsNotFound(err)) | ||||||
| } | ||||||
| } | ||||||
|
|
@@ -958,7 +964,7 @@ func (s *RedpandaControllerSuite) minimalRP(useFlux bool) *redpandav1alpha2.Redp | |||||
| }, | ||||||
| }, | ||||||
| RBAC: &redpandav1alpha2.RBAC{ | ||||||
| Enabled: ptr.To(false), | ||||||
| Enabled: ptr.To(true), | ||||||
| }, | ||||||
| }, | ||||||
| }, | ||||||
|
|
||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Hmmm, I would have expected some test in the helm chart to start failing with this change. I bet the chart is still pointed at a static version.
So this change will make the
rbac.createRPKBundleCRsflag, eventually, always be true.I thought we had a corresponding flag in the redpanda helm chart but I guess we don't 🤔
I don't love the idea of the operator having the permissions required for rpk debug bundle all the time. I guess we can expand the scope until someone complains as there's not a great alternative :/
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.
You are right it will fail when we bump operator version
redpanda-operator/charts/operator/testdata/kustomization.yaml
Line 4 in a6c0672
The rbac definition in operator helm chart is created manually. Then we assert compatibility between kustomize and helm
redpanda-operator/charts/operator/chart_test.go
Lines 65 to 101 in a6c0672
That kustomize definition is static.
Agree and I don't like it too.
It's uber flag rbac.enabled. Redpanda until sidecar didn't need any Kubernetes RBAC rules. As we use controller-runtime in sidecar we always create necessary Roles and ClusterRoles for sidecar. It could be improved to differentiate sidecar (and it's modes: decommission, pvc un-binder, "simple" health check) with rpk-bundle.
Never the less operator deployment needs to have same or more permissions than rpk-bundle needs. Users that want to use rpk-bundle would need to perform an operator helm chart upgrade (rpk-bundle Roles and ClusterRoles), then Redpanda resource upgrade (rbac.enabled=true) only then rpk bundle on Redpanda container/pod would work. I start to think that rpk bundle should be aware of
KUBECONFIG, so that it could be run outside of the Kubernetes cluster likekubectl.Another option would be standalone yaml that holds RBAC and Pod definition for rpk bundle to create an artefact from within cluster, so that operator and redpanda helm charts are much simpler.
As I agree with you I'm proposing a small cheat. I could add rpk-bundle RBAC to the test suite manually as we are doing with port-forward capability.
redpanda-operator/operator/internal/controller/redpanda/redpanda_controller_test.go
Lines 631 to 635 in a6c0672