Browse Source

HUE-8744 [k8s] Splitting nginx deployment in several yaml files

Romain 6 years ago
parent
commit
5193ff4762

+ 41 - 0
tools/kubernetes/helm/hue/templates/configmap-nginx.yaml

@@ -0,0 +1,41 @@
+{{- if .Values.balancer.enabled -}}
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: nginx-config
+data:
+  hue: |
+    server {
+        server_name hue;
+        charset utf-8;
+
+        listen 80;
+
+        # Or if running hue on https://
+        ## listen 8001 ssl;
+        ## ssl_certificate /path/to/ssl/cert;
+        ## ssl_certificate_key /path/to/ssl/key;
+
+        location / {
+            proxy_pass http://hue;
+
+            # Or if the upstream Hue instances are running behind https://
+            ## proxy_pass https://hue;
+        }
+
+        location /static/ {
+            alias /usr/share/nginx/html/hue/static/;
+
+            expires 30d;
+            add_header Cache-Control public;
+        }
+    }
+
+    upstream hue {
+        ip_hash;
+
+        # List all the Hue instances here for high availability.
+        server hue:8888 max_fails=3;
+        #server HUE_HOST2:8888 max_fails=3;
+    }
+{{- end -}}

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

@@ -1,44 +1,4 @@
 {{- if .Values.balancer.enabled -}}
-apiVersion: v1
-kind: ConfigMap
-metadata:
-  name: nginx-config
-data:
-  hue: |
-    server {
-        server_name hue;
-        charset utf-8;
-
-        listen 80;
-
-        # Or if running hue on https://
-        ## listen 8001 ssl;
-        ## ssl_certificate /path/to/ssl/cert;
-        ## ssl_certificate_key /path/to/ssl/key;
-
-        location / {
-            proxy_pass http://hue;
-
-            # Or if the upstream Hue instances are running behind https://
-            ## proxy_pass https://hue;
-        }
-
-        location /static/ {
-            alias /usr/share/nginx/html/hue/static/;
-
-            expires 30d;
-            add_header Cache-Control public;
-        }
-    }
-
-    upstream hue {
-        ip_hash;
-
-        # List all the Hue instances here for high availability.
-        server hue:8888 max_fails=3;
-        #server HUE_HOST2:8888 max_fails=3;
-    }
----
 apiVersion: apps/v1
 kind: Deployment
 metadata:
@@ -67,18 +27,4 @@ spec:
         - name: nginx-config
           configMap:
             name: nginx-config
----
-apiVersion: v1
-kind: Service
-metadata:
-  name: hue-balancer
-spec:
-  type: NodePort
-  # type: LoadBalancer
-  selector:
-    app: nginx
-  ports:
-    - protocol: TCP
-      port: 80
-      targetPort: 80
 {{- end -}}

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

@@ -0,0 +1,15 @@
+{{- if .Values.balancer.enabled -}}
+apiVersion: v1
+kind: Service
+metadata:
+  name: hue-balancer
+spec:
+  type: NodePort
+  # type: LoadBalancer
+  selector:
+    app: nginx
+  ports:
+    - protocol: TCP
+      port: 80
+      targetPort: 80
+{{- end -}}