From 589a08cf7c0f2fe95b3e0e32ce3872e2f1e4083f Mon Sep 17 00:00:00 2001 From: Fabio Rauber Date: Thu, 2 Jun 2022 09:16:03 -0300 Subject: [PATCH] Added msa component for saberes --- charts/saberes/v0.1.0/templates/_helpers.tpl | 7 ++ .../v0.1.0/templates/msa-deployment.yaml | 80 +++++++++++++++++++ .../v0.1.0/templates/postfixspool-pvc.yaml | 21 +++++ .../saberes/v0.1.0/templates/service-msa.yaml | 17 ++++ charts/saberes/v0.1.0/values.yaml | 28 ++++++- 5 files changed, 152 insertions(+), 1 deletion(-) create mode 100644 charts/saberes/v0.1.0/templates/msa-deployment.yaml create mode 100644 charts/saberes/v0.1.0/templates/postfixspool-pvc.yaml create mode 100644 charts/saberes/v0.1.0/templates/service-msa.yaml diff --git a/charts/saberes/v0.1.0/templates/_helpers.tpl b/charts/saberes/v0.1.0/templates/_helpers.tpl index a64088a..9e4eb25 100644 --- a/charts/saberes/v0.1.0/templates/_helpers.tpl +++ b/charts/saberes/v0.1.0/templates/_helpers.tpl @@ -48,4 +48,11 @@ Selector labels {{- define "saberes.selectorLabels" -}} app.kubernetes.io/name: {{ include "saberes.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} +app.kubernetes.io/component: app +{{- end }} + +{{- define "saberes.msaSelectorLabels" -}} +app.kubernetes.io/name: {{ include "saberes.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +app.kubernetes.io/component: msa {{- end }} \ No newline at end of file diff --git a/charts/saberes/v0.1.0/templates/msa-deployment.yaml b/charts/saberes/v0.1.0/templates/msa-deployment.yaml new file mode 100644 index 0000000..7c0515f --- /dev/null +++ b/charts/saberes/v0.1.0/templates/msa-deployment.yaml @@ -0,0 +1,80 @@ +{{- if .Values.msa.enabled -}} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "saberes.fullname" . }}-msa + labels: + {{- include "saberes.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.msa.replicas }} + selector: + matchLabels: + {{- include "saberes.msaSelectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "saberes.msaSelectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }}-msa + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.msa.image.repository }}:{{ .Values.msa.image.tag }}" + imagePullPolicy: {{ .Values.msa.image.pullPolicy }} + env: + - name: DOMAIN + value: "{{ .Release.Namespace }}.{{ .Values.msa.config.domain }}" + - name: HOSTNAME + value: "{{ include "saberes.fullname" . }}-msa.{{ .Release.Namespace }}.{{ .Values.msa.config.domain }}" + - name: MESSAGE_SIZE_LIMIT + value: "{{ .Values.msa.config.msgSizeLimit }}" + - name: RELAYHOST + value: "{{ .Values.msa.config.relayHost }}" + - name: RELAYNETS + value: "{{ .Values.msa.config.relayNets }}" + volumeMounts: + - mountPath: /var/spool/postfix + name: postfixspool + ports: + - name: smtp + containerPort: 25 + protocol: TCP + readinessProbe: + tcpSocket: + port: 25 + initialDelaySeconds: 5 + periodSeconds: 10 + livenessProbe: + tcpSocket: + port: 25 + initialDelaySeconds: 10 + periodSeconds: 20 + resources: + {{- toYaml .Values.msa.resources | nindent 12 }} + volumes: + - name: postfixspool + {{- if .Values.persistence.enabled }} + persistentVolumeClaim: + claimName: {{ include "saberes.fullname" . }}-postfixspool + {{- else }} + emptyDir: {} + {{- end }} + {{- with .Values.msa.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} +{{- end -}} \ No newline at end of file diff --git a/charts/saberes/v0.1.0/templates/postfixspool-pvc.yaml b/charts/saberes/v0.1.0/templates/postfixspool-pvc.yaml new file mode 100644 index 0000000..9c995d4 --- /dev/null +++ b/charts/saberes/v0.1.0/templates/postfixspool-pvc.yaml @@ -0,0 +1,21 @@ +{{- if and .Values.persistence.enabled .Values.msa.enabled }} +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: {{ include "saberes.fullname" . }}-postfixspool + labels: + {{- include "saberes.labels" . | nindent 4 }} +spec: + accessModes: + - {{ .Values.msa.persistence.accessMode }} + resources: + requests: + storage: {{ .Values.msa.persistence.size }} +{{- if .Values.msa.persistence.storageClass }} +{{- if (eq "-" .Values.msa.persistence.storageClass) }} + storageClassName: "" +{{- else }} + storageClassName: "{{ .Values.msa.persistence.storageClass }}" +{{- end }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/charts/saberes/v0.1.0/templates/service-msa.yaml b/charts/saberes/v0.1.0/templates/service-msa.yaml new file mode 100644 index 0000000..b31602f --- /dev/null +++ b/charts/saberes/v0.1.0/templates/service-msa.yaml @@ -0,0 +1,17 @@ +{{- if .Values.msa.enabled -}} +apiVersion: v1 +kind: Service +metadata: + name: {{ include "saberes.fullname" . }}-msa + labels: + {{- include "saberes.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: 25 + targetPort: 25 + protocol: TCP + name: smtp + selector: + {{- include "saberes.msaSelectorLabels" . | nindent 4 }} +{{- end -}} \ No newline at end of file diff --git a/charts/saberes/v0.1.0/values.yaml b/charts/saberes/v0.1.0/values.yaml index ab9d5c2..694fe48 100644 --- a/charts/saberes/v0.1.0/values.yaml +++ b/charts/saberes/v0.1.0/values.yaml @@ -98,4 +98,30 @@ velero: nodeSelector: {} -tolerations: [] \ No newline at end of file +tolerations: [] + +msa: + image: + repository: porto.interlegis.leg.br/library/alpine-postfix + tag: latest + pullPolicy: IfNotPresent + enabled: true + replicas: 1 + config: + relayHost: yoursmart.host + domain: cluster.local + msgSizeLimit: "50000000" + relayNets: 10.42.0.0/16 + resources: + limits: + cpu: 600m + memory: 1Gi + requests: + cpu: 300m + memory: 250Mi + nodeSelector: {} + persistence: + enabled: true + #storageClass: "" + accessMode: ReadWriteMany + size: 5Gi \ No newline at end of file