Skip to content

fix: use HookSucceeded with orphan propagation for oneShot ExternalSecret#15

Open
minmzzhang wants to merge 1 commit into
validatedpatterns:mainfrom
minmzzhang:one-shot-keycloak-users-v2
Open

fix: use HookSucceeded with orphan propagation for oneShot ExternalSecret#15
minmzzhang wants to merge 1 commit into
validatedpatterns:mainfrom
minmzzhang:one-shot-keycloak-users-v2

Conversation

@minmzzhang
Copy link
Copy Markdown
Contributor

Switch the oneShot hook-delete-policy from BeforeHookCreation to HookSucceeded so the keycloak-users ExternalSecret is removed as early as possible after syncing. Add PrunePropagationPolicy=orphan to prevent ArgoCD from cascade-deleting the K8s Secret when the ExternalSecret is pruned. Remove the one-shot label on the ExternalSecret itself since HookSucceeded handles its deletion. Rename the cleanup label from ztvp.io/cleanup to validatedpatterns.io/cleanup.

…cret

Switch the oneShot hook-delete-policy from BeforeHookCreation to
HookSucceeded so the keycloak-users ExternalSecret is removed as
early as possible after syncing.  Add PrunePropagationPolicy=orphan
to prevent ArgoCD from cascade-deleting the K8s Secret when the
ExternalSecret is pruned.  Remove the one-shot label on the
ExternalSecret itself since HookSucceeded handles its deletion.
Rename the cleanup label from ztvp.io/cleanup to
validatedpatterns.io/cleanup.

Signed-off-by: Min Zhang <minzhang@redhat.com>
Copy link
Copy Markdown
Contributor

@mlorenzofr mlorenzofr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was testing it but I found some problems with the cleanup job

namespace: {{ .Release.Namespace }}
{{- if .Values.externalSecrets.oneShot }}
labels:
{{ .Values.externalSecrets.secretCleanupLabel }}: one-shot
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The one-shot label has been removed here, but the job /cleanup-ephemeral-secrets still uses that label to delete the resource. We could also use {{ .Values.externalSecrets.secretCleanupLabel }}: delete, but there is no label on the resource.

https://github.com/minmzzhang/layered-zero-trust/blob/48e6d90905bbf53446690c38c60848be2b1ae6ae/charts/rh-keycloak/templates/cleanup-externalsecrets.yaml#L70

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants