Deploy CRD as a pre-install hook
**What** Using `lachlanevenson/k8s-kubectl`, which appears to be the most popular, off the shelf container with `kubectl` applied, run a job to apply the `workflow` crd. **Why** CRD is not, and cannot, be parameterized with release and so attempting to deploy as a regular template causes failures when installing subsequent releases.
This commit is contained in:
parent
84a8800881
commit
46840b6c59
3 changed files with 37 additions and 13 deletions
19
charts/argo/templates/_workflow-crd.json
Normal file
19
charts/argo/templates/_workflow-crd.json
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
{{- define "workflow-crd-json" }}
|
||||||
|
{
|
||||||
|
"apiVersion": "apiextensions.k8s.io/v1beta1",
|
||||||
|
"kind": "CustomResourceDefinition",
|
||||||
|
"metadata": {
|
||||||
|
"name": "workflows.argoproj.io"
|
||||||
|
},
|
||||||
|
"spec": {
|
||||||
|
"group": "argoproj.io",
|
||||||
|
"names": {
|
||||||
|
"kind": "Workflow",
|
||||||
|
"plural": "workflows",
|
||||||
|
"shortNames": ["wf"]
|
||||||
|
},
|
||||||
|
"scope": "Namespaced",
|
||||||
|
"version": "v1alpha1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{{- end}}
|
18
charts/argo/templates/apply-workflow-crd-job.yaml
Normal file
18
charts/argo/templates/apply-workflow-crd-job.yaml
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
apiVersion: batch/v1
|
||||||
|
kind: Job
|
||||||
|
metadata:
|
||||||
|
name: {{ .Release.Name }}-apply-workflow-crd
|
||||||
|
annotations:
|
||||||
|
helm.sh/hook: pre-install
|
||||||
|
helm.sh/hook-delete-policy: hook-succeeded
|
||||||
|
spec:
|
||||||
|
backoffLimit: 5
|
||||||
|
activeDeadlineSeconds: 100
|
||||||
|
template:
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: kubectl-apply
|
||||||
|
image: lachlanevenson/k8s-kubectl
|
||||||
|
command: ["/bin/sh"]
|
||||||
|
args: ["-c", 'echo ''{{- include "workflow-crd-json" .}}'' | kubectl apply -f -']
|
||||||
|
restartPolicy: Never
|
|
@ -1,13 +0,0 @@
|
||||||
apiVersion: apiextensions.k8s.io/v1beta1
|
|
||||||
kind: CustomResourceDefinition
|
|
||||||
metadata:
|
|
||||||
name: workflows.argoproj.io
|
|
||||||
spec:
|
|
||||||
group: argoproj.io
|
|
||||||
names:
|
|
||||||
kind: Workflow
|
|
||||||
plural: workflows
|
|
||||||
shortNames:
|
|
||||||
- wf
|
|
||||||
scope: Namespaced
|
|
||||||
version: v1alpha1
|
|
Loading…
Reference in a new issue