浏览代码

HUE-9003 [k8s] Move nginx to a side car in Hue container

This will keep static files in sync during upgrades and rollbacks
Romain 6 年之前
父节点
当前提交
27040f10a7

+ 16 - 0
tools/kubernetes/helm/hue/templates/deployment-hue.yaml

@@ -34,6 +34,17 @@ spec:
           initialDelaySeconds: 3
           initialDelaySeconds: 3
           periodSeconds: 3
           periodSeconds: 3
           failureThreshold: 30
           failureThreshold: 30
+{{ if .Values.balancer.enabled }}
+      - name: nginx
+        image: {{ .Values.image.registry }}/nginx:{{ .Values.image.tag }}
+        imagePullPolicy: {{ .Values.image.pullPolicy }}
+        ports:
+          - containerPort: 80
+        volumeMounts:
+        - name: nginx-config
+          mountPath: /etc/nginx/sites-available/hue
+          subPath: hue
+{{ end }}
       volumes:
       volumes:
         - name: config-volume
         - name: config-volume
           configMap:
           configMap:
@@ -41,3 +52,8 @@ spec:
         - name: config-volume-extra
         - name: config-volume-extra
           configMap:
           configMap:
             name: hue-config-extra
             name: hue-config-extra
+{{ if .Values.balancer.enabled }}
+        - name: nginx-config
+          configMap:
+            name: nginx-config
+{{ end }}

+ 0 - 30
tools/kubernetes/helm/hue/templates/deployment-nginx.yaml

@@ -1,30 +0,0 @@
-{{- if .Values.balancer.enabled -}}
-apiVersion: apps/v1
-kind: Deployment
-metadata:
-  name: nginx-hue
-spec:
-  selector:
-    matchLabels:
-      app: nginx
-  replicas: 1
-  template:
-    metadata:
-      labels:
-        app: nginx
-    spec:
-      containers:
-      - name: nginx
-        image: {{ .Values.image.registry }}/nginx:{{ .Values.image.tag }}
-        imagePullPolicy: {{ .Values.image.pullPolicy }}
-        ports:
-        - containerPort: 80
-        volumeMounts:
-          - name: nginx-config
-            mountPath: /etc/nginx/sites-available/hue
-            subPath: hue
-      volumes:
-        - name: nginx-config
-          configMap:
-            name: nginx-config
-{{- end -}}

+ 1 - 1
tools/kubernetes/helm/hue/templates/service-nginx.yaml

@@ -7,7 +7,7 @@ spec:
   type: NodePort
   type: NodePort
   # type: LoadBalancer
   # type: LoadBalancer
   selector:
   selector:
-    app: nginx
+    pod: hue
   ports:
   ports:
     - protocol: TCP
     - protocol: TCP
       port: 80
       port: 80