Skip to content

Commit

Permalink
Add argocd hooks implementation and annotation in celery chart
Browse files Browse the repository at this point in the history
  • Loading branch information
susilnem committed Nov 19, 2024
1 parent 721f555 commit ea8b83f
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 0 deletions.
48 changes: 48 additions & 0 deletions deploy/helm/ifrcgo-helm/templates/argo-hooks/hook-job.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{{- range $hookName, $hook := .Values.argoHooks }}

{{- if $hook.enabled }}

---
apiVersion: batch/v1
kind: Job
metadata:
{{- if $hook.preservehistory }}
generateName: {{ template "ifrcgo-helm.fullname" $ }}-{{ $hookName }}-
{{- else }}
name: {{ template "ifrcgo-helm.fullname" $ }}-{{ $hookName }}
{{- end }}
annotations:
argocd.argoproj.io/hook: {{ $hook.hook }}

spec:
template:
metadata:
annotations:
checksum/secret: {{ include (print $.Template.BasePath "/config/secret.yaml") $ | sha256sum }}
checksum/configmap: {{ include (print $.Template.BasePath "/config/configmap.yaml") $ | sha256sum }}
spec:
restartPolicy: "Never"
containers:
- name: {{ $.Chart.Name }}-{{ $hookName }}
image: "{{ $.Values.api.image.name }}:{{ $.Values.api.image.tag }}"
imagePullPolicy: {{ $.Values.api.image.pullPolicy }}
command:
{{- range $hook.command }}
- "{{ . }}"
{{- end }}
resources:
requests:
cpu: {{ default $.Values.api.resources.requests.cpu $hook.requestsCpu }}
memory: {{ default $.Values.api.resources.requests.memory $hook.requestsMemory }}
limits:
cpu: {{ default $.Values.api.resources.limits.cpu $hook.limitsCpu }}
memory: {{ default $.Values.api.resources.limits.memory $hook.limitsMemory }}
envFrom:
- secretRef:
name: {{ template "ifrcgo-helm.fullname" $ }}-api-secret
- configMapRef:
name: {{ template "ifrcgo-helm.fullname" $ }}-api-configmap

{{- end }}

{{- end }}
3 changes: 3 additions & 0 deletions deploy/helm/ifrcgo-helm/templates/celery/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ spec:
run: {{ .Release.Name }}-celery
template:
metadata:
annotations:
checksum/secret: {{ include (print .Template.BasePath "/config/secret.yaml") . | sha256sum }}
checksum/configmap: {{ include (print .Template.BasePath "/config/configmap.yaml") . | sha256sum }}
labels:
app: {{ template "ifrcgo-helm.name" . }}
release: {{ .Release.Name }}
Expand Down
13 changes: 13 additions & 0 deletions deploy/helm/ifrcgo-helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ api:
image:
name: 'SET-BY-CHARTPRESS'
tag: 'set-by-chartpress'
pullPolicy: 'ifNotPresent'
resources:
requests:
cpu: "2"
Expand Down Expand Up @@ -191,3 +192,15 @@ sshBastion:
thenav56.pub: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIN/f/A3qkaTHSdbKn8Hv75YiJvRMEXvWTDdIiR7tyAjJ navin@nav-machine
david.pub: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC3FzrQdVh5Qwp5Y6KQGcpqHxKErxCW103iEECuutR/jBZe6X0xjD+cW7e+H8SrUsPQwj87fzOsMAc6v6n+3hdYFa6ekgRG/USEIUR5C/GD1Xjva3Xpp45PasBhJEtYt2ON+dlzwvRyOuv2hvqv2WHBO020ewIlVuQ4pU4Qj5ysvwWGj8GAv/jITiVERmjLTStbFwxeIDT3jQEbwnfV1zZZKiGxIecB/y51nk6oIQ00ZGrYEo5ieWsUSVfLHOX0/lZ0mtrdqxDEgMaCbNaUbICAimsJPamNpoirKc7FoKIKKrLQsK8qE1lClWQEecbW+dgSiwxracooKeWhHq+BkKUCNgEL/C0ff2l9e8sJcLmYZUdPtDCdtUDC8BAlELA5HR6tdCTfFcc0nXltclSSODMnZkQohh5/2fixJTwN5p5csEfBLzbdrturKtT/TbYSoaodg4muPqY4YE5jiJfrHVAGS1DVWz/cRcm1vOxT2V4iW2SNvo8fS2PZOpU5furrvbM= ifrcds\david.muchatiza@5CG41911S1
paola.pub: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDGql4RrbxSQTW5QrTh+P+94jGCXOCeZgc23hxL9zFCYQrzL0SMw1F53Z5SFZimIhJswYPqV2pT8L4oTRqIrTCM+looWi7b9/9u+m/KmA+FWbo3u6uRrckkA3nVIKsKHvlOucX2GxE6i+tXdeXEisW49ZpMtuvxMLJ3Eg4MK10d/2d3FKuzTsrxCTlJn8FAE3yOsVow0jdu+381IrkAqRE2GINeQ87hVlQpbo+bL2N/2QZmNjDhBBQkRJLDisW0+UNgo+S9wN7HbpV5LheSJS9wGN7LlmcqlpZFrDO/lVyoMxEQ0588wUI8BVfqAZDEBJPdGtzq513r+5iXEX/9A1Mendlvxfl6ANNRcH9PVZHkRN1dxY3rckQ+Lk3qqIjjfYFYvl5Gybidb1BM2VNWHAuzaDDQzJpeTHIbQnDt7Ke4oX2xWYgyu+kVhqz0HnAV28qMXbMEsrMIrtwl7IjcrorgdduHghZvWFbaJZNtXOfgnf1IYNXkZ9eWPS+Bz9nWMhE= ifrcds\paola.yela@5CG41911RT

argoHooks:
# NOTE: Make sure keys are lowercase
database-migration:
enabled: true
hook: PostSync
preservehistory: true
command: ["./manage.py", "migrate"]
collect-static:
enabled: true
hook: PostSync
command: ["./manage.py", "collectstatic", "--noinput"]

0 comments on commit ea8b83f

Please sign in to comment.