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

fix: make sure machine pools are deleted before gke cluster #1458

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

salasberryfin
Copy link
Contributor

What type of PR is this?

/kind bug

What this PR does / why we need it:

During cluster deletion, a GCPManagedCluster may be deleted before its associated GCPManagedMachinePool/s which actually needs the cluster resource to exist to delete successfully:

E0321 10:41:55.730846       1 controller.go:324] "Reconciler error" err="GCPManagedCluster.infrastructure.cluster.x-k8s.io \"cluster-gke\" not found" controller="gcpmanagedmachinepool" controllerGroup="infrastructure.cluster.x-k8s.io" controllerKind="GCPManagedMachinePool" GCPManagedMachinePool="default/cluster-gke-mp-0" namespace="default" name="cluster-gke-mp-0" reconcileID="5e38a1b8-a006-4c22-973b-a7ebe1ca8c06"
E0321 10:42:05.971755       1 gcpmanagedmachinepool_controller.go:270] "Failed to retrieve GCPManagedCluster from the API Server" err="GCPManagedCluster.infrastructure.cluster.x-k8s.io \"cluster-gke\" not found" controller="gcpmanagedmachinepool" controllerGroup="infrastructure.cluster.x-k8s.io" controllerKind="GCPManagedMachinePool" GCPManagedMachinePool="default/cluster-gke-mp-0" namespace="default" name="cluster-gke-mp-0" reconcileID="becd4efd-9abf-4dda-a3fb-ec1e1cfd6d95"

This happens intermittently and it's hard to reproduce, but there needs to be logic that waits for the machine pools to be removed before continuing with deleting the cluster.

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

This is similar to this CAPA issue.

TODOs:

  • squashed commits
  • includes documentation
  • adds unit tests

Release note:

Wait for machine pools to be deleted before deleting gke cluster

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/bug Categorizes issue or PR as related to a bug. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Mar 25, 2025
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Mar 25, 2025
Copy link

netlify bot commented Mar 25, 2025

Deploy Preview for kubernetes-sigs-cluster-api-gcp ready!

Name Link
🔨 Latest commit 7abfdae
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-cluster-api-gcp/deploys/67e262e038127600084c2a70
😎 Deploy Preview https://deploy-preview-1458--kubernetes-sigs-cluster-api-gcp.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@salasberryfin salasberryfin force-pushed the gke-remove-machinepools-before-cluster branch from 2aefcfa to 7abfdae Compare March 25, 2025 08:01
Copy link
Contributor

@alexander-demicev alexander-demicev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 25, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: alexander-demicev, salasberryfin
Once this PR has been reviewed and has the lgtm label, please assign fabriziopandini for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link
Member

@furkatgofurov7 furkatgofurov7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants