Skip to content
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

BUG: Leftover ClusterConfigurations and ClusterSummaries after CAPI cluster deletion #325

Closed
fchiacchiaretta opened this issue Sep 15, 2023 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@fchiacchiaretta
Copy link

Problem Description

When deleting a CAPI cluster object from our management cluster, I can see that ClusterConfigurations and ClusterSummaries objects are not deleted.

System Information

CLUSTERAPI VERSION: v1.5.1
SVELTOS VERSION: v0.15.3
KUBERNETES VERSION: v1.27.5

Logs

I can see errors for failed reconciling of ClusterSummaries in addon-controller pod, while I couldn't find logs related to ClusterConfigurations objects.

I0915 10:07:50.539414       1 clustersummary_controller.go:140] "Reconciling" controller="clustersummary" controllerGroup="config.projectsveltos.io" controllerKind="ClusterSummary" ClusterSummary="my-namespace/deploy-cilium-v1-26-capi-my-cluster" namespace="my-namespace" name="deploy-cilium-v1-26-capi-my-cluster" reconcileID="54854682-127f-4bb4-8806-23fcab276c57"
I0915 10:07:50.539878       1 clustersummary_controller.go:211] "Reconciling ClusterSummary delete" controller="clustersummary" controllerGroup="config.projectsveltos.io" controllerKind="ClusterSummary" ClusterSummary="my-namespace/deploy-cilium-v1-26-capi-my-cluster" namespace="my-namespace" name="deploy-cilium-v1-26-capi-my-cluster" reconcileID="54854682-127f-4bb4-8806-23fcab276c57"
I0915 10:07:50.539940       1 clusterproxy.go:100] "Cluster does not exist" controller="clustersummary" controllerGroup="config.projectsveltos.io" controllerKind="ClusterSummary" ClusterSummary="my-namespace/deploy-cilium-v1-26-capi-my-cluster" namespace="my-namespace" name="deploy-cilium-v1-26-capi-my-cluster" reconcileID="54854682-127f-4bb4-8806-23fcab276c57"
E0915 10:07:50.539998       1 clustersummary_controller.go:224] "failed to remove ResourceSummary." err="Cluster my-namespace/my-cluster does not exist: Cluster.cluster.x-k8s.io \"my-cluster\" not found" controller="clustersummary" controllerGroup="config.projectsveltos.io" controllerKind="ClusterSummary" ClusterSummary="my-namespace/deploy-cilium-v1-26-capi-my-cluster" namespace="my-namespace" name="deploy-cilium-v1-26-capi-my-cluster" reconcileID="54854682-127f-4bb4-8806-23fcab276c57"

Here is the deploy-cilium-v1.26 ClusterProfile

apiVersion: config.projectsveltos.io/v1alpha1
kind: ClusterProfile
metadata:
  name: deploy-cilium-v1-26
spec:
  clusterSelector: sveltos=enabled,kubernetes=v1-26
  helmCharts:
  - chartName: cilium/cilium
    chartVersion: 1.12.12
    helmChartAction: Install
    releaseName: cilium
    releaseNamespace: kube-system
    repositoryName: cilium
    repositoryURL: https://helm.cilium.io/
    values: |
      k8sServiceHost: "{{ .Cluster.spec.controlPlaneEndpoint.host }}"
      k8sServicePort: "{{ .Cluster.spec.controlPlaneEndpoint.port }}"
      hubble:
        enabled: false
      nodePort:
        enabled: true
      kubeProxyReplacement: strict
      operator:
        replicas: 1
        updateStrategy:
          rollingUpdate:
            maxSurge: 0
            maxUnavailable: 1
  reloader: false
  stopMatchingBehavior: WithdrawPolicies
  syncMode: Continuous

I'm not managing cluster via sveltosctl, but just creating and deleting cluster object on the management cluster.

@fchiacchiaretta fchiacchiaretta added the bug Something isn't working label Sep 15, 2023
@gianlucam76 gianlucam76 self-assigned this Sep 20, 2023
@gianlucam76
Copy link
Member

Thank you @fchiacchiaretta. Looking into this now.

@gianlucam76
Copy link
Member

Thank you for reporting this bug. Issue was with ClusterSummaryReconciler which incorrectly assumed it had to cleanup resources in the cluster. Clearly when corresponding cluster is deleted and gone, there is nothing to cleanup there.

Fix was easy but it was a path somehow I did not consider. So thank you again for reporting this bug.

Fix has been merged.

Till new release with fix is out, workaround (if possible) is to remove the labels from cluster before deleting it so allowing ClusterSummary delete path to be triggered before cluster is gone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants