-
Notifications
You must be signed in to change notification settings - Fork 2
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
Ownership deletion secret #21
Merged
Merged
Conversation
This file contains 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
bigkevmcd
force-pushed
the
ownership-deletion-secret
branch
2 times, most recently
from
November 9, 2023 12:07
99ec98e
to
55c5023
Compare
foot
approved these changes
Nov 10, 2023
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.
🔥
Works great, w/ new cluster-controller.
- Annotation added
- Deleting cluster deletes secret immediately
Follow up / questions:
- Should this trigger a new ACD reconcile immediately? Status still stays ready etc even though cluster / secret is gone.
- ~30% of the time I get a transient error[0] about a missing secret, but the sometimes retries, / manually syncing again seems to fix it
[0]
[manager] 2023-11-10T09:34:51Z INFO reconciling cluster reflector {"controller": "automatedclusterdiscovery", "controllerGroup": "clusters.weave.works", "controllerKind": "AutomatedClusterDiscovery", "AutomatedClusterDiscovery": {"name":"aks-cluster-discovery","namespace":"default"}, "namespace": "default", "name": "aks-cluster-discovery", "reconcileID": "4e36d643-5b9e-4d54-a7d9-5d5a52908e23", "type": "aks", "name": ""}
[manager] 2023-11-10T09:34:51Z INFO reconciling AKS cluster reflector {"controller": "automatedclusterdiscovery", "controllerGroup": "clusters.weave.works", "controllerKind": "AutomatedClusterDiscovery", "AutomatedClusterDiscovery": {"name":"aks-cluster-discovery","namespace":"default"}, "namespace": "default", "name": "aks-cluster-discovery", "reconcileID": "4e36d643-5b9e-4d54-a7d9-5d5a52908e23", "name": ""}
[manager] 2023-11-10T09:34:56Z INFO reconciling clusters {"controller": "automatedclusterdiscovery", "controllerGroup": "clusters.weave.works", "controllerKind": "AutomatedClusterDiscovery", "AutomatedClusterDiscovery": {"name":"aks-cluster-discovery","namespace":"default"}, "namespace": "default", "name": "aks-cluster-discovery", "reconcileID": "4e36d643-5b9e-4d54-a7d9-5d5a52908e23", "count": 1}
[manager] 2023-11-10T09:34:56Z INFO creating gitops cluster {"controller": "automatedclusterdiscovery", "controllerGroup": "clusters.weave.works", "controllerKind": "AutomatedClusterDiscovery", "AutomatedClusterDiscovery": {"name":"aks-cluster-discovery","namespace":"default"}, "namespace": "default", "name": "aks-cluster-discovery", "reconcileID": "4e36d643-5b9e-4d54-a7d9-5d5a52908e23", "name": "pestomarketplacetest"}
[manager] 2023-11-10T09:34:56Z INFO creating secret {"controller": "automatedclusterdiscovery", "controllerGroup": "clusters.weave.works", "controllerKind": "AutomatedClusterDiscovery", "AutomatedClusterDiscovery": {"name":"aks-cluster-discovery","namespace":"default"}, "namespace": "default", "name": "aks-cluster-discovery", "reconcileID": "4e36d643-5b9e-4d54-a7d9-5d5a52908e23", "name": "pestomarketplacetest-kubeconfig"}
[manager] 2023-11-10T09:34:56Z ERROR failed to reconcile clusters {"controller": "automatedclusterdiscovery", "controllerGroup": "clusters.weave.works", "controllerKind": "AutomatedClusterDiscovery", "AutomatedClusterDiscovery": {"name":"aks-cluster-discovery","namespace":"default"}, "namespace": "default", "name": "aks-cluster-discovery", "reconcileID": "4e36d643-5b9e-4d54-a7d9-5d5a52908e23", "error": "failed to get the secret to update: Secret \"pestomarketplacetest-kubeconfig\" not found"}
[manager] github.com/weaveworks/cluster-reflector-controller/internal/controller.(*AutomatedClusterDiscoveryReconciler).reconcileResources
[manager] /workspace/internal/controller/automatedclusterdiscovery_controller.go:171
[manager] github.com/weaveworks/cluster-reflector-controller/internal/controller.(*AutomatedClusterDiscoveryReconciler).Reconcile
[manager] /workspace/internal/controller/automatedclusterdiscovery_controller.go:91
[manager] sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Reconcile
[manager] /workspace/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:118
[manager] sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler
[manager] /workspace/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:314
[manager] sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem
[manager] /workspace/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:265
[manager] sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2
[manager] /workspace/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:226
[manager] 2023-11-10T09:34:56Z ERROR Reconciler error {"controller": "automatedclusterdiscovery", "controllerGroup": "clusters.weave.works", "controllerKind": "AutomatedClusterDiscovery", "AutomatedClusterDiscovery": {"name":"aks-cluster-discovery","namespace":"default"}, "namespace": "default", "name": "aks-cluster-discovery", "reconcileID": "4e36d643-5b9e-4d54-a7d9-5d5a52908e23", "error": "failed to get the secret to update: Secret \"pestomarketplacetest-kubeconfig\" not found"}
[manager] sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler
[manager] /workspace/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:324
[manager] sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem
[manager] /workspace/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:265
[manager] sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2
[manager] /workspace/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:226
This changes the ownership of Secrets to be owned by the referencing GitopsCluster.
This does two things, the Secret is owned by the Cluster which causes cascading removal. It also annotates the Cluster to indicate that the cluster-controller should not wait for the Secret to be removed.
bigkevmcd
force-pushed
the
ownership-deletion-secret
branch
from
November 13, 2023 09:28
96fddd2
to
b5f0f6a
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This places the
Secret
under the ownership of the generatedGitopsCluster
.It also adds the annotation to the created
GitopsCluster
to indicate that it can be removed without the secret being removed, as it will cascade because of the ownership in this case.