Эх сурвалжийг харах

Have nginx as a sidecar instead of a separate deployment

sonicaj 3 жил өмнө
parent
commit
fbb2fe07a4

+ 28 - 2
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 }}

+ 1 - 4
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:

+ 0 - 37
test/collabora/1.0.0/templates/nginx-deployment.yaml

@@ -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" . }}

+ 2 - 3
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 }}

+ 0 - 6
test/collabora/1.0.0/templates/service.yaml

@@ -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 }}