From f7b77f687cb7f703345241f4a12279b842a5a712 Mon Sep 17 00:00:00 2001 From: Stefan Majer Date: Wed, 15 Sep 2021 11:42:14 +0200 Subject: [PATCH] add gardener shoot.gardener.cloud/no-cleanup=true labels to prevent dangling volumesnapshots, closes #15 (#17) --- controllers/storageclass.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/controllers/storageclass.go b/controllers/storageclass.go index eeddaa7..a51a877 100644 --- a/controllers/storageclass.go +++ b/controllers/storageclass.go @@ -682,7 +682,11 @@ var ( // Node DaemonSet nodeRoleLabels = map[string]string{"app": lbCSINodeName, "role": "node"} csiNodeDaemonSet = apps.DaemonSet{ - ObjectMeta: metav1.ObjectMeta{Name: lbCSINodeName, Namespace: namespace}, + ObjectMeta: metav1.ObjectMeta{ + Name: lbCSINodeName, + Namespace: namespace, + Labels: map[string]string{"shoot.gardener.cloud/no-cleanup": "true"}, + }, Spec: apps.DaemonSetSpec{ Selector: &metav1.LabelSelector{MatchLabels: nodeRoleLabels}, UpdateStrategy: apps.DaemonSetUpdateStrategy{ @@ -849,7 +853,13 @@ func (r *DurosReconciler) deployStorageClass(ctx context.Context, projectID stri log.Info("clusterrolebindinding", "name", crb.Name, "operation", op) } - sts := &apps.StatefulSet{ObjectMeta: metav1.ObjectMeta{Name: lbCSIControllerName, Namespace: namespace}} + sts := &apps.StatefulSet{ + ObjectMeta: metav1.ObjectMeta{ + Name: lbCSIControllerName, + Namespace: namespace, + Labels: map[string]string{"shoot.gardener.cloud/no-cleanup": "true"}, + }, + } op, err := controllerutil.CreateOrUpdate(ctx, r.Shoot, sts, func() error { controllerRoleLabels := map[string]string{"app": "lb-csi-plugin", "role": "controller"}