perf(secret-generator): only run job when config changed

This commit is contained in:
Khue Doan 2023-11-27 00:29:33 +07:00
parent 5e76122a04
commit 002e725e6b
2 changed files with 29 additions and 35 deletions

View File

@ -1,35 +0,0 @@
apiVersion: batch/v1
kind: CronJob
metadata:
name: secret-generator
namespace: {{ .Release.Namespace }}
annotations:
argocd.argoproj.io/sync-wave: '1'
spec:
schedule: '*/5 * * * *'
concurrencyPolicy: Forbid
jobTemplate:
spec:
backoffLimit: 3
template:
spec:
restartPolicy: Never
containers:
- name: apply
image: golang:1.19-alpine
workingDir: /go/src/secret-generator
command:
- sh
- -c
args:
- |
go get .
go run .
volumeMounts:
- name: source
mountPath: /go/src/secret-generator
serviceAccount: secret-generator
volumes:
- name: source
configMap:
name: secret-generator

View File

@ -0,0 +1,29 @@
apiVersion: batch/v1
kind: Job
metadata:
name: secret-generator-{{ include (print $.Template.BasePath "/secret-generator/configmap.yaml") . | sha256sum | trunc 7 }}
namespace: {{ .Release.Namespace }}
spec:
backoffLimit: 3
template:
spec:
restartPolicy: Never
containers:
- name: secret-generator
image: golang:1.19-alpine
workingDir: /go/src/secret-generator
command:
- sh
- -c
args:
- |
go get .
go run .
volumeMounts:
- name: source
mountPath: /go/src/secret-generator
serviceAccount: secret-generator
volumes:
- name: source
configMap:
name: secret-generator