From e7fc7c2c5722a37d24a6acbdc46578777d0d056a Mon Sep 17 00:00:00 2001 From: Fabio Rauber Date: Wed, 16 Feb 2022 11:58:30 -0300 Subject: [PATCH] Included mailauth in mailproxy chart --- charts/mailproxy/v0.1.0/templates/hpa.yaml | 28 ------ ...ployment.yaml => mailauth-deployment.yaml} | 12 ++- .../v0.1.0/templates/mailauth-service.yaml | 17 ++++ .../v0.1.0/templates/nginx-deployment.yaml | 60 +++++++++++++ .../{service.yaml => nginx-service.yaml} | 6 +- charts/mailproxy/v0.1.0/values.yaml | 85 ++++++++++--------- 6 files changed, 130 insertions(+), 78 deletions(-) delete mode 100644 charts/mailproxy/v0.1.0/templates/hpa.yaml rename charts/mailproxy/v0.1.0/templates/{deployment.yaml => mailauth-deployment.yaml} (80%) create mode 100644 charts/mailproxy/v0.1.0/templates/mailauth-service.yaml create mode 100644 charts/mailproxy/v0.1.0/templates/nginx-deployment.yaml rename charts/mailproxy/v0.1.0/templates/{service.yaml => nginx-service.yaml} (69%) diff --git a/charts/mailproxy/v0.1.0/templates/hpa.yaml b/charts/mailproxy/v0.1.0/templates/hpa.yaml deleted file mode 100644 index 8016a3c..0000000 --- a/charts/mailproxy/v0.1.0/templates/hpa.yaml +++ /dev/null @@ -1,28 +0,0 @@ -{{- if .Values.autoscaling.enabled }} -apiVersion: autoscaling/v2beta1 -kind: HorizontalPodAutoscaler -metadata: - name: {{ include "mailproxy.fullname" . }} - labels: - {{- include "mailproxy.labels" . | nindent 4 }} -spec: - scaleTargetRef: - apiVersion: apps/v1 - kind: Deployment - name: {{ include "mailproxy.fullname" . }} - minReplicas: {{ .Values.autoscaling.minReplicas }} - maxReplicas: {{ .Values.autoscaling.maxReplicas }} - metrics: - {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} - - type: Resource - resource: - name: cpu - targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} - {{- end }} - {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} - - type: Resource - resource: - name: memory - targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} - {{- end }} -{{- end }} diff --git a/charts/mailproxy/v0.1.0/templates/deployment.yaml b/charts/mailproxy/v0.1.0/templates/mailauth-deployment.yaml similarity index 80% rename from charts/mailproxy/v0.1.0/templates/deployment.yaml rename to charts/mailproxy/v0.1.0/templates/mailauth-deployment.yaml index 06071a5..e8730b0 100644 --- a/charts/mailproxy/v0.1.0/templates/deployment.yaml +++ b/charts/mailproxy/v0.1.0/templates/mailauth-deployment.yaml @@ -5,9 +5,7 @@ metadata: labels: {{- include "mailproxy.labels" . | nindent 4 }} spec: - {{- if not .Values.autoscaling.enabled }} - replicas: {{ .Values.replicaCount }} - {{- end }} + replicas: {{ .Values.mailauth.replicaCount }} selector: matchLabels: {{- include "mailproxy.selectorLabels" . | nindent 6 }} @@ -30,10 +28,10 @@ spec: - name: {{ .Chart.Name }} securityContext: {{- toYaml .Values.securityContext | nindent 12 }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" - imagePullPolicy: {{ .Values.image.pullPolicy }} + image: "{{ .Values.mailauth.image.repository }}:{{ .Values.mailauth.image.tag }}" + imagePullPolicy: {{ .Values.mailauth.image.pullPolicy }} ports: - {{- range $i, $port := .Values.service.ports }} + {{- range $i, $port := .Values.mailauth.service.ports }} - name: {{ $port.name }} containerPort: {{ $port.number }} protocol: {{ $port.protocol }} @@ -47,7 +45,7 @@ spec: path: / port: http resources: - {{- toYaml .Values.resources | nindent 12 }} + {{- toYaml .Values.mailauth.resources | nindent 12 }} {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} diff --git a/charts/mailproxy/v0.1.0/templates/mailauth-service.yaml b/charts/mailproxy/v0.1.0/templates/mailauth-service.yaml new file mode 100644 index 0000000..defcb0e --- /dev/null +++ b/charts/mailproxy/v0.1.0/templates/mailauth-service.yaml @@ -0,0 +1,17 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "mailproxy.fullname" . }}-mailauth + labels: + {{- include "mailproxy.labels" . | nindent 4 }} +spec: + type: {{ .Values.mailauth.service.type }} + ports: + {{- range $i, $port := .Values.mailauth.service.ports }} + - port: {{ $port.number }} + targetPort: {{ $port.number }} + protocol: {{ $port.protocol }} + name: {{ $port.name }} + {{- end }} + selector: + {{- include "mailproxy.selectorLabels" . | nindent 4 }} diff --git a/charts/mailproxy/v0.1.0/templates/nginx-deployment.yaml b/charts/mailproxy/v0.1.0/templates/nginx-deployment.yaml new file mode 100644 index 0000000..20aa27f --- /dev/null +++ b/charts/mailproxy/v0.1.0/templates/nginx-deployment.yaml @@ -0,0 +1,60 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "mailproxy.fullname" . }} + labels: + {{- include "mailproxy.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.nginx.replicaCount }} + selector: + matchLabels: + {{- include "mailproxy.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "mailproxy.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.nginx.image.repository }}:{{ .Values.nginx.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.nginx.image.pullPolicy }} + ports: + {{- range $i, $port := .Values.nginx.service.ports }} + - name: {{ $port.name }} + containerPort: {{ $port.number }} + protocol: {{ $port.protocol }} + {{- end }} + livenessProbe: + httpGet: + path: / + port: http + readinessProbe: + httpGet: + path: / + port: http + resources: + {{- toYaml .Values.nginx.resources | nindent 12 }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/charts/mailproxy/v0.1.0/templates/service.yaml b/charts/mailproxy/v0.1.0/templates/nginx-service.yaml similarity index 69% rename from charts/mailproxy/v0.1.0/templates/service.yaml rename to charts/mailproxy/v0.1.0/templates/nginx-service.yaml index 9460523..52da966 100644 --- a/charts/mailproxy/v0.1.0/templates/service.yaml +++ b/charts/mailproxy/v0.1.0/templates/nginx-service.yaml @@ -1,13 +1,13 @@ apiVersion: v1 kind: Service metadata: - name: {{ include "mailproxy.fullname" . }} + name: {{ include "mailproxy.fullname" . }}-nginx labels: {{- include "mailproxy.labels" . | nindent 4 }} spec: - type: {{ .Values.service.type }} + type: {{ .Values.nginx.service.type }} ports: - {{- range $i, $port := .Values.service.ports }} + {{- range $i, $port := .Values.nginx.service.ports }} - port: {{ $port.number }} targetPort: {{ $port.number }} protocol: {{ $port.protocol }} diff --git a/charts/mailproxy/v0.1.0/values.yaml b/charts/mailproxy/v0.1.0/values.yaml index 4529451..0361724 100644 --- a/charts/mailproxy/v0.1.0/values.yaml +++ b/charts/mailproxy/v0.1.0/values.yaml @@ -1,16 +1,53 @@ # Default values for mailproxy. -replicaCount: 2 +nginx: + image: + repository: nginx + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "" + replicaCount: 2 + service: + type: ClusterIP + ports: + - name: imaps + number: 993 + protocol: TCP + - name: pops + number: 995 + protocol: TCP + - name: smtp + number: 587 + protocol: TCP + resources: {} + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi -image: - repository: nginx - pullPolicy: IfNotPresent - # Overrides the image tag whose default is the chart appVersion. - tag: "" +mailauth: + image: + repository: porto.interlegis.leg.br/seit/rancher-nginx-mailproxy + pullPolicy: IfNotPresent + tag: "0.0.8" + replicaCount: 2 + service: + type: ClusterIP + ports: + - name: php-fpm + number: 9000 + protocol: TCP + resources: {} + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi imagePullSecrets: [] -nameOverride: "" -fullnameOverride: "" podAnnotations: {} @@ -25,38 +62,6 @@ securityContext: {} # runAsNonRoot: true # runAsUser: 1000 -service: - type: ClusterIP - ports: - - name: imaps - number: 993 - protocol: TCP - - name: pops - number: 995 - protocol: TCP - - name: smtp - number: 587 - protocol: TCP - -resources: {} - # We usually recommend not to specify default resources and to leave this as a conscious - # choice for the user. This also increases chances charts run on environments with little - # resources, such as Minikube. If you do want to specify resources, uncomment the following - # lines, adjust them as necessary, and remove the curly braces after 'resources:'. - # limits: - # cpu: 100m - # memory: 128Mi - # requests: - # cpu: 100m - # memory: 128Mi - -autoscaling: - enabled: false - minReplicas: 1 - maxReplicas: 100 - targetCPUUtilizationPercentage: 80 - # targetMemoryUtilizationPercentage: 80 - nodeSelector: {} tolerations: []