Skip to content

Commit

Permalink
update annotations if mutatingwebhookconfiguration already exists
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanSpectro committed Jan 11, 2024
1 parent bedfd5c commit e701956
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions pkg/cloud/services/iam/podidentitywebhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,20 @@ func reconcileMutatingWebHook(ctx context.Context, ns string, secret *corev1.Sec
}

if check.UID != "" {
updateAnnotations := false
if len(check.Annotations) == 0 {
check.Annotations = map[string]string{
certManagerInjectCAAnnotation: fmt.Sprintf("%s/%s", ns, secret.Name),
}
updateAnnotations = true
} else if check.Annotations[certManagerInjectCAAnnotation] == "" {
check.Annotations[certManagerInjectCAAnnotation] = fmt.Sprintf("%s/%s", ns, secret.Name)
updateAnnotations = true
}

if updateAnnotations {
return remoteClient.Update(ctx, check)
}
return nil
}

Expand Down

0 comments on commit e701956

Please sign in to comment.