From 034f64c12a27cb0070fc3dbe72969752babad40f Mon Sep 17 00:00:00 2001 From: Fabio Rauber Date: Wed, 7 Oct 2020 15:05:02 -0300 Subject: [PATCH] Added CronJob for ZEO Pack --- charts/portalmodelo/v0.5.0/questions.yaml | 19 +++++- .../v0.5.0/templates/zeopack-cronjob.yaml | 62 +++++++++++++++++++ charts/portalmodelo/v0.5.0/values.yaml | 3 + 3 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 charts/portalmodelo/v0.5.0/templates/zeopack-cronjob.yaml diff --git a/charts/portalmodelo/v0.5.0/questions.yaml b/charts/portalmodelo/v0.5.0/questions.yaml index c645b22..2e4740d 100644 --- a/charts/portalmodelo/v0.5.0/questions.yaml +++ b/charts/portalmodelo/v0.5.0/questions.yaml @@ -97,5 +97,22 @@ questions: description: "Tamanho do Cache do ZODB (em número de objetos)" type: int label: "ZODB Cache" - required: true + required: false + group: Avançado + +- variable: instance.zeopack.enabled + default: true + type: boolean + description: "Habilitar o Pack periódico do ZODB?" + label: "ZEO Pack?" + required: false + group: Avançado + +- variable: instance.zeopack.schedule + default: "0 1 * * SUN" + type: string + description: "Agendamento do ZEO Pack (String do Cron)" + label: "ZEO Pack Cron" + required: false group: Avançado + diff --git a/charts/portalmodelo/v0.5.0/templates/zeopack-cronjob.yaml b/charts/portalmodelo/v0.5.0/templates/zeopack-cronjob.yaml new file mode 100644 index 0000000..771298d --- /dev/null +++ b/charts/portalmodelo/v0.5.0/templates/zeopack-cronjob.yaml @@ -0,0 +1,62 @@ +{{- if .Values.instance.zeoclient }} +{{- if .Values.instance.zeopack.enabled }} +apiVersion: batch/v1beta1 +kind: CronJob +metadata: + name: {{ include "portalmodelo.fullname" . }}-zeopack + labels: + {{- include "portalmodelo.labels" . | nindent 4 }} +spec: + schedule: {{ .Values.instance.zeopack.schedule | quote }} + jobTemplate: + spec: + template: + metadata: + labels: + {{- include "portalmodelo.labels" . | nindent 12 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 12 }} + {{- end }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 12 }} + containers: + - name: {{ .Release.Name }}-zeopack + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + args: + - zeopack + env: + - name: ZEO_ADDRESS + value: {{ template "portalmodelo.fullname" . }}-zeoserver:8100 + - name: TZ + value: {{ .Values.portal.timeZone }} + volumeMounts: + - mountPath: /data + name: data + resources: + {{- toYaml .Values.resources.zeo | nindent 12 }} + restartPolicy: OnFailure + volumes: + - name: data + {{- if .Values.persistence.enabled }} + persistentVolumeClaim: + claimName: data + {{- else }} + emptyDir: {} + {{- end }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} +{{- end}} +{{- end}} diff --git a/charts/portalmodelo/v0.5.0/values.yaml b/charts/portalmodelo/v0.5.0/values.yaml index de62c23..bd86c5a 100644 --- a/charts/portalmodelo/v0.5.0/values.yaml +++ b/charts/portalmodelo/v0.5.0/values.yaml @@ -33,6 +33,9 @@ portal: instance: zodbCacheSize: 1000 zeoclient: false + zeopack: + enabled: true + schedule: "0 1 * * SUN" # Every Sunday at 1AM podAnnotations: {}