-
Notifications
You must be signed in to change notification settings - Fork 185
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
Allow clusters to be deleted without deleting custom subnets
.
#1231
Labels
kind/feature
Categorizes issue or PR as related to a new feature.
Comments
k8s-ci-robot
added
the
kind/feature
Categorizes issue or PR as related to a new feature.
label
May 13, 2024
I'm finding out more specifics about the issue. I'll create a PR that adds this similar logic to subnets. |
3 tasks
jwmay2012
changed the title
Allow clusters to be deleted without deleting Networks/Subnetworks.
Allow clusters to be deleted without deleting custom May 15, 2024
subnets
.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
/kind feature
Describe the solution you'd like
Allow custom
subnets
(those created outside of CAPG) to be retained upon cluster deletion.Anything else you would like to add:
We create our Networks/SubNetworks outside CAPI and keep non-cluster machines in them. When we want to delete a cluster, the
cluster.cluster.x-k8s.io
finalizer never gets removed because CAPG forever tries and fails to delete the Network and SubNetwork because they contain other machines.I would like to submit a PR to skip Network/SubNetwork deletion step in the
func (r *GCPClusterReconciler) reconcileDelete(...)
function.Proposed Configuration Solutions
Add a new option to the
GCPCluster.Spec.Network
spec.reclaimPolicy: Retain
which would default toDelete
. Based off PersistentVolumes retention policy convention. But any other name that works for this project would be fine.Use the Network
Description
to identify non-CAPG created networks, and refrain from deleting them. Networks and Subnetworks don't have GCP labels and seem to only have a Description for metadata. The Network description is set viainfrav1.ClusterTagKey(s.Name())
which resolves to"cpag-cluster-" + Cluster.Metadata.Name
. We could make this more obviously "machine created" by changing it toCreated By CAPG: capg-cluster-mycluster:240f34f19636c80eeeb41ccf4dbd390b
where the hash ismd5|sha1|sha256|w/e
ofcapg-cluster-mycluster
. Then during clusterreconcileDelete
, we check if the Network description matches our "machine created" string. If yes, then continue with default behavior auto-delete. If not, then we assume its not created by CAPG and skip deleting Network/SubNetwork.Any other suggested/preferred configuration options would appreciated.
The text was updated successfully, but these errors were encountered: