From 7210da74ae8cb6f29d86086f8528c3778002f929 Mon Sep 17 00:00:00 2001 From: Fabio Rauber Date: Fri, 14 May 2021 10:04:24 -0300 Subject: [PATCH] Default portalmodelo do ReadWriteOnce volumes --- charts/portalmodelo/v0.5.0/questions.yaml | 19 +++++++++++++++++++ .../v0.5.0/templates/plone-deployment.yaml | 12 +++++++----- .../v0.5.0/templates/zeopack-cronjob.yaml | 8 ++++---- .../templates/zeoserver-deployment.yaml | 2 ++ charts/portalmodelo/v0.5.0/values.yaml | 2 +- 5 files changed, 33 insertions(+), 10 deletions(-) diff --git a/charts/portalmodelo/v0.5.0/questions.yaml b/charts/portalmodelo/v0.5.0/questions.yaml index d51bad6..c68686e 100644 --- a/charts/portalmodelo/v0.5.0/questions.yaml +++ b/charts/portalmodelo/v0.5.0/questions.yaml @@ -91,6 +91,25 @@ questions: - nginx - alb +# Configurações de Armazenamento +- variable: persistence.accessMode + default: ReadWriteOnce + type: enum + label: "Modo de acesso do volume" + description: "ReadWriteOnce para volumes de bloco, ReadWriteMany para volumes de arquivo (NFS)." + options: + - "ReadWriteOnce" + - "ReadWriteMany" + required: true + group: Armazenamento +- variable: persistence.size + default: 2Gi + type: string + required: false + label: "Tamanho do volume" + description: "Espaço em disco disponível para o portal." + group: Armazenamento + # Configurações Avançadas - variable: portal.timeZone default: "America/Sao_Paulo" diff --git a/charts/portalmodelo/v0.5.0/templates/plone-deployment.yaml b/charts/portalmodelo/v0.5.0/templates/plone-deployment.yaml index c30270e..9836501 100644 --- a/charts/portalmodelo/v0.5.0/templates/plone-deployment.yaml +++ b/charts/portalmodelo/v0.5.0/templates/plone-deployment.yaml @@ -43,7 +43,6 @@ spec: volumeMounts: - mountPath: /data name: data - {{- end }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" name: {{ .Release.Name }}-initplone command: @@ -56,6 +55,7 @@ spec: volumeMounts: - mountPath: /data name: data + {{- end }} {{- if .Values.portal.createAndUpgrade }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" name: {{ .Release.Name }}-plonecfg @@ -91,8 +91,10 @@ spec: {{- if .Values.instance.zeoclient }} - name: ZEO_ADDRESS value: {{ template "portalmodelo.fullname" . }}-zeoserver:8100 + {{- if eq .Values.persistence.accessMode "ReadWriteMany"}} - name: ZEO_SHARED_BLOB_DIR value: "on" + {{- end }} {{- end }} - name: TZ value: {{ .Values.portal.timeZone }} @@ -124,20 +126,20 @@ spec: periodSeconds: 10 successThreshold: 1 timeoutSeconds: 2 + {{- if eq .Values.persistence.accessMode "ReadWriteMany" }} volumeMounts: - mountPath: /data name: data + {{- end }} resources: {{- toYaml .Values.resources.plone | nindent 12 }} restartPolicy: Always + {{- if .Values.persistence.enabled }} volumes: - name: data - {{- if .Values.persistence.enabled }} persistentVolumeClaim: claimName: data - {{- else }} - emptyDir: {} - {{- end }} + {{- end }} {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} diff --git a/charts/portalmodelo/v0.5.0/templates/zeopack-cronjob.yaml b/charts/portalmodelo/v0.5.0/templates/zeopack-cronjob.yaml index b730b34..36dfa5a 100644 --- a/charts/portalmodelo/v0.5.0/templates/zeopack-cronjob.yaml +++ b/charts/portalmodelo/v0.5.0/templates/zeopack-cronjob.yaml @@ -35,20 +35,20 @@ spec: value: {{ template "portalmodelo.fullname" . }}-zeoserver:8100 - name: TZ value: {{ .Values.portal.timeZone }} + {{- if eq .Values.persistence.accessMode "ReadWriteMany" }} volumeMounts: - mountPath: /data name: data + {{- end }} resources: {{- toYaml .Values.resources.zeo | nindent 16 }} restartPolicy: OnFailure + {{- if and .Values.persistence.enabled (eq .Values.persistence.accessMode "ReadWriteMany") }} volumes: - name: data - {{- if .Values.persistence.enabled }} persistentVolumeClaim: claimName: data - {{- else }} - emptyDir: {} - {{- end }} + {{- end }} {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 12 }} diff --git a/charts/portalmodelo/v0.5.0/templates/zeoserver-deployment.yaml b/charts/portalmodelo/v0.5.0/templates/zeoserver-deployment.yaml index aa5a784..a208eeb 100644 --- a/charts/portalmodelo/v0.5.0/templates/zeoserver-deployment.yaml +++ b/charts/portalmodelo/v0.5.0/templates/zeoserver-deployment.yaml @@ -66,8 +66,10 @@ spec: args: - zeoserver env: + {{- if eq .Values.persistence.accessMode "ReadWriteMany"}} - name: ZEO_SHARED_BLOB_DIR value: "on" + {{- end }} - name: TZ value: {{ .Values.portal.timeZone }} imagePullPolicy: {{ .Values.image.pullPolicy }} diff --git a/charts/portalmodelo/v0.5.0/values.yaml b/charts/portalmodelo/v0.5.0/values.yaml index cdcd048..339bca6 100644 --- a/charts/portalmodelo/v0.5.0/values.yaml +++ b/charts/portalmodelo/v0.5.0/values.yaml @@ -17,7 +17,7 @@ fullnameOverride: "" persistence: enabled: true #storageClass: "" - accessMode: ReadWriteMany + accessMode: ReadWriteOnce size: 2Gi portal: