Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ArgoCD hooks annotation location #3989

Merged
merged 2 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/3989.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
helm: Fix ArgoCD hooks related annotations on server-acl-init Job, they must be added at Job definition and not template level.
```
10 changes: 5 additions & 5 deletions charts/consul/templates/server-acl-init-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ metadata:
{{- if .Values.global.extraLabels }}
{{- toYaml .Values.global.extraLabels | nindent 4 }}
{{- end }}
{{- if .Values.global.argocd.enabled }}
annotations:
"argocd.argoproj.io/hook": "Sync"
"argocd.argoproj.io/hook-delete-policy": "HookSucceeded"
{{- end }}
spec:
template:
metadata:
Expand All @@ -50,12 +55,7 @@ spec:
{{- if .Values.global.acls.annotations }}
{{- tpl .Values.global.acls.annotations . | nindent 8 }}
{{- end }}
{{- if .Values.global.argocd.enabled }}
"argocd.argoproj.io/hook": "Sync"
"argocd.argoproj.io/hook-delete-policy": "HookSucceeded"
{{- end }}
{{- if .Values.global.secretsBackend.vault.enabled }}

{{- /* Run the Vault agent as both an init container and sidecar.
The Vault agent sidecar is needed when server-acl-init bootstraps ACLs
and writes the bootstrap token back to Vault.
Expand Down
8 changes: 4 additions & 4 deletions charts/consul/test/unit/server-acl-init-job.bats
Original file line number Diff line number Diff line change
Expand Up @@ -2383,14 +2383,14 @@ load _helpers
--set 'global.acls.manageSystemACLs=true' \
--set 'global.argocd.enabled=true' \
. | tee /dev/stderr |
yq -r '.spec.template.metadata.annotations["argocd.argoproj.io/hook"]' | tee /dev/stderr)
yq -r '.metadata.annotations["argocd.argoproj.io/hook"]' | tee /dev/stderr)
[ "${actual}" = "Sync" ]
local actual=$(helm template \
-s templates/server-acl-init-job.yaml \
--set 'global.acls.manageSystemACLs=true' \
--set 'global.argocd.enabled=true' \
. | tee /dev/stderr |
yq -r '.spec.template.metadata.annotations["argocd.argoproj.io/hook-delete-policy"]' | tee /dev/stderr)
yq -r '.metadata.annotations["argocd.argoproj.io/hook-delete-policy"]' | tee /dev/stderr)
[ "${actual}" = "HookSucceeded" ]
}

Expand All @@ -2401,14 +2401,14 @@ load _helpers
--set 'global.acls.manageSystemACLs=true' \
--set 'global.argocd.enabled=false' \
. | tee /dev/stderr |
yq -r '.spec.template.metadata.annotations["argocd.argoproj.io/hook"]' | tee /dev/stderr)
yq -r '.metadata.annotations["argocd.argoproj.io/hook"]' | tee /dev/stderr)
[ "${actual}" = null ]
local actual=$(helm template \
-s templates/server-acl-init-job.yaml \
--set 'global.acls.manageSystemACLs=true' \
--set 'global.argocd.enabled=false' \
. | tee /dev/stderr |
yq -r '.spec.template.metadata.annotations["argocd.argoproj.io/hook-delete-policy"]' | tee /dev/stderr)
yq -r '.metadata.annotations["argocd.argoproj.io/hook-delete-policy"]' | tee /dev/stderr)
[ "${actual}" = null ]
}

Expand Down
Loading