Skip to content

Commit

Permalink
[SAPBTPCFS-15469] Update Service Instance on change of 'parametersFro…
Browse files Browse the repository at this point in the history
…m' secret
  • Loading branch information
I065450 committed Nov 28, 2024
1 parent 88d1854 commit 27b271b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion controllers/serviceinstance_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -638,17 +638,22 @@ func (r *ServiceInstanceReconciler) buildSMRequestParameters(ctx context.Context
} else {
if serviceInstance.Labels != nil {
// remove all secret labels
keysToDelete := []string{}
for key := range serviceInstance.Labels {
if strings.HasPrefix(key, common.InstanceSecretLabel) {
shouldUpdate = true
keysToDelete = append(keysToDelete, key)
err = utils.RemoveSecretWatch(ctx, r.Client, serviceInstance.Namespace, serviceInstance.Labels[key], serviceInstance.Name)
if err != nil {
log.Error(err, fmt.Sprintf("failed to decrease secret watch label with key %s", key))
return nil, err
}
delete(serviceInstance.Labels, key)
}
}
// Perform deletions after the iteration
for _, key := range keysToDelete {
delete(serviceInstance.Labels, key)
}
}
}
if shouldUpdate {
Expand Down

0 comments on commit 27b271b

Please sign in to comment.