Browse Source

Moved plonecfg to a Kubernetes job with pre-install Helm hook

master
Fábio Kaiser Rauber 4 years ago
parent
commit
9073e9f152
  1. 30
      charts/portalmodelo/v0.5.0/templates/plone-deployment.yaml
  2. 60
      charts/portalmodelo/v0.5.0/templates/plonecfg-job.yaml
  3. 3
      charts/portalmodelo/v0.5.0/templates/pvc.yaml

30
charts/portalmodelo/v0.5.0/templates/plone-deployment.yaml

@ -56,36 +56,6 @@ spec:
- mountPath: /data
name: data
{{- end }}
{{- if .Values.portal.createAndUpgrade }}
- image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
name: {{ .Release.Name }}-plonecfg
command: [ "/configure.sh" ]
env:
{{- if .Values.instance.zeoclient }}
- name: ZEO_ADDRESS
value: {{ template "portalmodelo.fullname" . }}-zeoserver:8100
{{- else }}
- name: ZEO_ADDRESS
value: ""
{{- end }}
- name: EMAIL
value: {{ .Values.portal.adminEmail }}
- name: PASSWORD
value: {{ .Values.portal.adminPassword }}
- name: TITLE
value: {{ .Values.portal.title }}
- name: DESCR
value: {{ .Values.portal.description }}
- name: HOSTNAME
value: {{ .Values.portal.hostname }}
- name: ROOTPWD
value: {{ .Values.portal.rootPassword }}
- name: TZ
value: {{ .Values.portal.timeZone }}
volumeMounts:
- mountPath: /data
name: data
{{- end }}
containers:
- env:
{{- if .Values.instance.zeoclient }}

60
charts/portalmodelo/v0.5.0/templates/plonecfg-job.yaml

@ -0,0 +1,60 @@
{{- if .Values.portal.createAndUpgrade }}
apiVersion: batch/v1
kind: Job
metadata:
name: {{ include "portalmodelo.fullname" . }}-plonecfg
labels:
{{- include "portalmodelo.labels" . | nindent 4 }}
spec:
backoffLimit: 0
template:
metadata:
annotations:
"helm.sh/hook": pre-install,pre-upgrade
"helm.sh/hook-weight": "-1"
labels:
{{- include "portalmodelo.ploneSelectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
restartPolicy: Never
containers:
- image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
name: {{ .Release.Name }}-plonecfg
command: [ "/configure.sh" ]
env:
{{- if .Values.instance.zeoclient }}
- name: ZEO_ADDRESS
value: {{ template "portalmodelo.fullname" . }}-zeoserver:8100
{{- else }}
- name: ZEO_ADDRESS
value: ""
{{- end }}
- name: EMAIL
value: {{ .Values.portal.adminEmail }}
- name: PASSWORD
value: {{ .Values.portal.adminPassword }}
- name: TITLE
value: {{ .Values.portal.title }}
- name: DESCR
value: {{ .Values.portal.description }}
- name: HOSTNAME
value: {{ .Values.portal.hostname }}
- name: ROOTPWD
value: {{ .Values.portal.rootPassword }}
- name: TZ
value: {{ .Values.portal.timeZone }}
volumeMounts:
- mountPath: /data
name: data
{{- if .Values.persistence.enabled }}
volumes:
- name: data
persistentVolumeClaim:
claimName: data
{{- end }}
{{- end }}

3
charts/portalmodelo/v0.5.0/templates/pvc.yaml

@ -3,6 +3,9 @@ apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: data
annotations:
"helm.sh/hook": pre-install,pre-upgrade
"helm.sh/hook-weight": "-10"
spec:
accessModes:
- {{ .Values.persistence.accessMode }}

Loading…
Cancel
Save