From fbb2fe07a42ff9c64722b8eef9b1cc971848ee52 Mon Sep 17 00:00:00 2001 From: sonicaj Date: Tue, 19 Oct 2021 21:42:02 +0500 Subject: [PATCH] Have nginx as a sidecar instead of a separate deployment --- .../collabora/1.0.0/templates/deployment.yaml | 30 ++++++++++++++- .../collabora/1.0.0/templates/nginx-conf.yaml | 5 +-- .../1.0.0/templates/nginx-deployment.yaml | 37 ------------------- .../1.0.0/templates/nginx-service.yaml | 5 +-- test/collabora/1.0.0/templates/service.yaml | 6 --- 5 files changed, 31 insertions(+), 52 deletions(-) delete mode 100644 test/collabora/1.0.0/templates/nginx-deployment.yaml delete mode 100644 test/collabora/1.0.0/templates/service.yaml diff --git a/test/collabora/1.0.0/templates/deployment.yaml b/test/collabora/1.0.0/templates/deployment.yaml index 197ec76fbe..9bddbb8311 100644 --- a/test/collabora/1.0.0/templates/deployment.yaml +++ b/test/collabora/1.0.0/templates/deployment.yaml @@ -14,6 +14,27 @@ spec: labels: {{ include "common.labels.selectorLabels" . | nindent 8 }} spec: containers: + - name: {{ .Chart.Name }}-nginx + image: {{ printf "%s:%s" .Values.nginx.image.repository .Values.nginx.image.tag }} + imagePullPolicy: {{ .Values.nginx.image.pullPolicy }} + volumeMounts: + - name: configuration + mountPath: /etc/nginx/nginx.conf + readOnly: true + subPath: config + - name: certs + mountPath: /etc/nginx/server.crt + subPath: certPublicKey + - name: certs + mountPath: /etc/nginx/server.key + subPath: certPrivateKey + ports: + - name: http + containerPort: 80 + protocol: TCP + - name: https + containerPort: 443 + protocol: TCP - name: {{ .Chart.Name }} {{ include "common.containers.imageConfig" .Values.image | nindent 10 }} {{ if .Values.extraAppVolumeMounts }} @@ -40,11 +61,16 @@ spec: {{ $envList = mustAppend $envList (dict "name" "username" "valueFromSecret" true "secretName" $secretName "secretKey" "username") }} {{ $envList = mustAppend $envList (dict "name" "password" "valueFromSecret" true "secretName" $secretName "secretKey" "password") }} {{ include "common.containers.allEnvironmentVariables" (dict "environmentVariables" $envList) | nindent 10 }} - {{ if .Values.extraAppVolumeMounts }} volumes: + - name: configuration + configMap: + defaultMode: 0700 + name: "nginx-config" + - name: certs + secret: + secretName: {{ include "secretName" . }} {{ range $index, $hostPathConfiguration := .Values.extraAppVolumeMounts }} - name: extrappvolume-{{ $index }} hostPath: path: {{ $hostPathConfiguration.hostPath }} {{ end }} - {{ end }} diff --git a/test/collabora/1.0.0/templates/nginx-conf.yaml b/test/collabora/1.0.0/templates/nginx-conf.yaml index c5e3fe889c..ec616892eb 100644 --- a/test/collabora/1.0.0/templates/nginx-conf.yaml +++ b/test/collabora/1.0.0/templates/nginx-conf.yaml @@ -1,7 +1,4 @@ -{{- $serviceName := include "common.names.fullname" . -}} - {{- if hasKey .Values "nameSuffix" -}} - {{- $serviceName = (printf "%v-%v" $serviceName .Values.nameSuffix) -}} -{{- end -}} +{{- $serviceName := "localhost" -}} apiVersion: v1 kind: ConfigMap metadata: diff --git a/test/collabora/1.0.0/templates/nginx-deployment.yaml b/test/collabora/1.0.0/templates/nginx-deployment.yaml deleted file mode 100644 index e50d23c086..0000000000 --- a/test/collabora/1.0.0/templates/nginx-deployment.yaml +++ /dev/null @@ -1,37 +0,0 @@ -{{ $values := (. | mustDeepCopy) }} -{{ $_ := set $values "common" (dict "nameSuffix" "nginx") }} -{{ include "common.deployment.common_config" $values | nindent 0 }} -spec: {{ include "common.deployment.common_spec" $values | nindent 2 }} - template: {{ include "common.deployment.pod.metadata" $values | nindent 4 }} - spec: - containers: - - name: {{ .Chart.Name }}-nginx - image: {{ printf "%s:%s" .Values.nginx.image.repository .Values.nginx.image.tag }} - imagePullPolicy: {{ .Values.nginx.image.pullPolicy }} - volumeMounts: - - name: configuration - mountPath: /etc/nginx/nginx.conf - readOnly: true - subPath: config - - name: certs - mountPath: /etc/nginx/server.crt - subPath: certPublicKey - - name: certs - mountPath: /etc/nginx/server.key - subPath: certPrivateKey - - ports: - - name: http - containerPort: 80 - protocol: TCP - - name: https - containerPort: 443 - protocol: TCP - volumes: - - name: configuration - configMap: - defaultMode: 0700 - name: "nginx-config" - - name: certs - secret: - secretName: {{ include "secretName" . }} diff --git a/test/collabora/1.0.0/templates/nginx-service.yaml b/test/collabora/1.0.0/templates/nginx-service.yaml index f3b7cd7449..644ed5b3ad 100644 --- a/test/collabora/1.0.0/templates/nginx-service.yaml +++ b/test/collabora/1.0.0/templates/nginx-service.yaml @@ -1,7 +1,6 @@ {{ $port := .Values.nodePort }} {{ $ports := list }} -{{ $ports = mustAppend $ports (dict "name" "https" "port" $port "nodePort" $port "targetPort" "https") }} +{{ $ports = mustAppend $ports (dict "name" "https" "nodePort" $port "targetPort" 443 "port" 443) }} {{ $params := (. | mustDeepCopy) }} -{{ $_ := set $params "common" (dict "nameSuffix" "nginx") }} -{{ $_2 := set $params "commonService" (dict "ports" $ports "type" "NodePort" ) }} +{{ $_ := set $params "commonService" (dict "ports" $ports "type" "NodePort" ) }} {{ include "common.classes.service" $params }} diff --git a/test/collabora/1.0.0/templates/service.yaml b/test/collabora/1.0.0/templates/service.yaml deleted file mode 100644 index d14319a377..0000000000 --- a/test/collabora/1.0.0/templates/service.yaml +++ /dev/null @@ -1,6 +0,0 @@ -{{ $port := .Values.nodePort }} -{{ $ports := list }} -{{ $ports = mustAppend $ports (dict "name" "collabora" "port" 9980 "targetPort" "collabora") }} -{{ $params := . }} -{{ $_ := set $params "commonService" (dict "ports" $ports "type" "ClusterIP" ) }} -{{ include "common.classes.service" $params }}