123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- ---
- apiVersion: v1
- kind: ConfigMap
- metadata:
- namespace: {{ .Release.Namespace }}
- name: "{{ .Release.Name }}-sgconfig-crd"
- annotations:
- "helm.sh/hook": pre-install,pre-upgrade,post-upgrade # Remove post-upgrade after version 1.13 get out of support
- "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
- "helm.sh/hook-weight": "9"
- data:
- SGConfig.yaml: |
- {{ .Files.Get "crds/SGConfig.yaml" | nindent 4 }}
- ---
- apiVersion: v1
- kind: ConfigMap
- metadata:
- namespace: {{ .Release.Namespace }}
- name: "{{ .Release.Name }}-sgconfig"
- annotations:
- "helm.sh/hook": pre-install,pre-upgrade,post-upgrade # Remove post-upgrade after version 1.13 get out of support
- "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
- "helm.sh/hook-weight": "9"
- data:
- sgconfig.yaml: |
- apiVersion: stackgres.io/v1
- kind: SGConfig
- metadata:
- annotations:
- meta.helm.sh/release-name: {{ .Release.Name }}
- meta.helm.sh/release-namespace: {{ .Release.Namespace }}
- labels:
- app.kubernetes.io/managed-by: Helm
- name: {{ .Release.Name }}
- namespace: {{ .Values.sgConfigNamespace | default .Release.Namespace }}
- spec:
- {{ regexReplaceAll "[^ ]+: null" (unset .Values "global" | toYaml | nindent 6) "" }}
- ---
- apiVersion: batch/v1
- kind: Job
- metadata:
- namespace: {{ .Release.Namespace }}
- name: "{{ .Release.Name }}-install-sgconfig"
- labels:
- app: stackgres-operator-init
- job: install-sgconfig
- annotations:
- "helm.sh/hook": pre-install,pre-upgrade,post-upgrade # Remove post-upgrade after version 1.13 get out of support
- "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
- "helm.sh/hook-weight": "10"
- {{- with .Values.jobs.annotations }}
- {{- toYaml . | nindent 4 }}
- {{- end }}
- spec:
- ttlSecondsAfterFinished: 3600
- template:
- metadata:
- labels:
- app: stackgres-operator-init
- job: install-sgconfig
- spec:
- serviceAccountName: {{ .Release.Name }}-init
- restartPolicy: OnFailure
- terminationGracePeriodSeconds: 0
- {{- with .Values.jobs.affinity}}
- affinity:
- {{- toYaml . | nindent 8 }}
- {{- end}}
- {{- with .Values.jobs.nodeSelector}}
- nodeSelector:
- {{- toYaml . | nindent 8 }}
- {{- end }}
- {{- with .Values.jobs.tolerations }}
- tolerations:
- {{- toYaml . | nindent 8 }}
- {{- end }}
- containers:
- - name: "install-sgconfig"
- image: {{ template "kubectl-image" . }}
- imagePullPolicy: "IfNotPresent"
- {{- with .Values.jobs.resources }}
- resources:
- {{- toYaml . | nindent 10 }}
- {{- end }}
- command:
- - "/bin/bash"
- - "-ecx"
- - |
- kubectl replace -f /SGConfig.yaml
- kubectl apply -f /sgconfig.yaml
- volumeMounts:
- - name: sgconfig-crd
- mountPath: /SGConfig.yaml
- subPath: SGConfig.yaml
- - name: sgconfig
- mountPath: /sgconfig.yaml
- subPath: sgconfig.yaml
- volumes:
- - name: sgconfig-crd
- configMap:
- name: "{{ .Release.Name }}-sgconfig-crd"
- optional: false
- - name: sgconfig
- configMap:
- name: "{{ .Release.Name }}-sgconfig"
- optional: false
- ---
- apiVersion: batch/v1
- kind: Job
- metadata:
- namespace: {{ .Release.Namespace }}
- name: "{{ .Release.Name }}-remove-sgconfig"
- labels:
- app: stackgres-operator-init
- job: remove-sgconfig
- annotations:
- "helm.sh/hook": post-delete
- "helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
- "helm.sh/hook-weight": "10"
- {{- with .Values.jobs.annotations }}
- {{- toYaml . | nindent 4 }}
- {{- end }}
- spec:
- ttlSecondsAfterFinished: 3600
- template:
- metadata:
- labels:
- app: stackgres-operator-init
- job: remove-sgconfig
- spec:
- serviceAccountName: {{ .Release.Name }}-init
- restartPolicy: OnFailure
- terminationGracePeriodSeconds: 0
- {{- with .Values.jobs.affinity}}
- affinity:
- {{- toYaml . | nindent 8 }}
- {{- end}}
- {{- with .Values.jobs.nodeSelector}}
- nodeSelector:
- {{- toYaml . | nindent 8 }}
- {{- end }}
- {{- with .Values.jobs.tolerations }}
- tolerations:
- {{- toYaml . | nindent 8 }}
- {{- end }}
- containers:
- - name: "remove-sgconfig"
- image: {{ template "kubectl-image" . }}
- imagePullPolicy: "IfNotPresent"
- {{- with .Values.jobs.resources }}
- resources:
- {{- toYaml . | nindent 10 }}
- {{- end }}
- command:
- - "/bin/bash"
- - "-ecx"
- - |
- kubectl delete sgconfig -n "{{ .Values.sgConfigNamespace | default .Release.Namespace }}" "{{ .Release.Name }}"
|