Skip to content

Commit 6e47498

Browse files
authored
skip adding finalizer to CR when helm install (#374)
* added label to CR in helm chart to differentiate olm and non-OLM Signed-off-by: Henry Li <[email protected]> * updated reconcile to skip adding finalizer when CR is helm based Signed-off-by: Henry Li <[email protected]> --------- Signed-off-by: Henry Li <[email protected]>
1 parent c6418f5 commit 6e47498

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

controllers/namespacescope_controller.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,9 @@ func (r *NamespaceScopeReconciler) Reconcile(ctx context.Context, req ctrl.Reque
179179
}
180180

181181
func (r *NamespaceScopeReconciler) addFinalizer(ctx context.Context, nss *operatorv1.NamespaceScope) error {
182+
if nss.Labels["cpfs.helm/install"] == "true" {
183+
return nil
184+
}
182185
controllerutil.AddFinalizer(nss, constant.NamespaceScopeFinalizer)
183186
if err := r.Update(ctx, nss); err != nil {
184187
klog.Errorf("Failed to update NamespaceScope with finalizer: %v", err)

helm/templates/02-nss-cr.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ apiVersion: operator.ibm.com/v1
22
kind: NamespaceScope
33
metadata:
44
labels:
5+
cpfs.helm/install: 'true'
56
foundationservices.cloudpak.ibm.com: nss
67
component-id: {{ .Chart.Name }}
78
{{- with .Values.cpfs.labels }}

0 commit comments

Comments
 (0)