소스 검색

[helm] create networking.k8s.io/v1 for k8s 1.19+

the apiVersion networking.k8s.io/v1beta1 is deprecated in k8s 1.19+ and
would be removed in k8s 1.22

Backport custom annotations in ingress-http-v1

Backport daphne to ingress-https-v1
gmsantos 4 년 전
부모
커밋
43b86d9aa8

+ 39 - 0
tools/kubernetes/helm/hue/templates/ingress-http-v1.yaml

@@ -0,0 +1,39 @@
+{{- if and .Values.ingress.create (eq .Values.ingress.type "nginx") (semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion) -}}
+apiVersion: networking.k8s.io/v1
+kind: Ingress
+metadata:
+  name: hue
+  annotations:
+    kubernetes.io/ingress.class: nginx
+    nginx.ingress.kubernetes.io/affinity: "cookie"
+    nginx.ingress.kubernetes.io/session-cookie-name: "hue-balancer-ingress"
+    nginx.ingress.kubernetes.io/session-cookie-expires: "172800"
+    nginx.ingress.kubernetes.io/session-cookie-max-age: "172800"
+{{- with .Values.ingress.annotations }}
+{{ toYaml . | indent 4 }}
+{{- end }}
+spec:
+  rules:
+  - host: {{ .Values.ingress.domain }}
+    http:
+      paths:
+      - backend:
+          service:
+            name: hue-balancer
+            port:
+              number: 80
+        pathType: ImplementationSpecific
+        path: /
+  {{- range .Values.ingress.extraHosts }}
+  - host: {{ . | quote }}
+    http:
+      paths:
+      - backend:
+          service:
+            name: hue-balancer
+            port:
+              number: 80
+        pathType: ImplementationSpecific
+        path: /
+  {{- end }}
+{{- end -}}

+ 79 - 0
tools/kubernetes/helm/hue/templates/ingress-https-v1.yaml

@@ -0,0 +1,79 @@
+{{- if and .Values.ingress.create (eq .Values.ingress.type "nginx-ssl") (semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion) -}}
+apiVersion: networking.k8s.io/v1
+kind: Ingress
+metadata:
+  name: hue
+  annotations:
+    kubernetes.io/ingress.class: nginx
+    cert-manager.io/cluster-issuer: letsencrypt-hue-prod
+    cert-manager.io/acme-challenge-type: http01
+    nginx.ingress.kubernetes.io/rewrite-target: /$1
+    nginx.ingress.kubernetes.io/ssl-redirect: "true"
+    nginx.ingress.kubernetes.io/affinity: "cookie"
+    nginx.ingress.kubernetes.io/session-cookie-name: "hue-balancer"
+    nginx.ingress.kubernetes.io/session-cookie-expires: "172800"
+    nginx.ingress.kubernetes.io/session-cookie-max-age: "172800"
+    {{- if .Values.ingress.hasAuth -}}
+    nginx.ingress.kubernetes.io/auth-type: basic
+    nginx.ingress.kubernetes.io/auth-secret: basic-auth-hue
+    nginx.ingress.kubernetes.io/auth-realm: 'Authentication Required'
+    {{- end -}}
+{{- with .Values.ingress.annotations }}
+{{ toYaml . | indent 4 }}
+{{- end }}
+spec:
+  rules:
+  - host: {{ .Values.ingress.domain }}
+    http:
+      paths:
+      {{ if .Values.websocket.enabled }}
+      - backend:
+          service:
+            name: daphne-websocket
+            port:
+              number: 8001
+        pathType: ImplementationSpecific
+        path: /(ws/.*)
+      {{- end -}}
+      - backend:
+          service:
+            name: hue-balancer
+            port:
+              number: 80
+        pathType: ImplementationSpecific
+        path: /(.*)
+  {{- range .Values.ingress.extraHosts }}
+  - host: {{ . | quote }}
+    http:
+      paths:
+      - backend:
+          service:
+            name: hue-balancer
+            port:
+              number: 80
+        pathType: ImplementationSpecific
+        path: /
+  {{- end }}
+  {{- if .Values.api.enabled }}
+  - host: {{ .Values.api.domain }}
+    http:
+      paths:
+      - backend:
+          service:
+            name: hue-balancer
+            port:
+              number: 80
+        pathType: ImplementationSpecific
+        path: /
+  {{- end }}
+  tls:
+  - hosts:
+    - {{ .Values.ingress.domain }}
+    {{- range .Values.ingress.extraHosts -}}
+    - {{ . | quote }}
+    {{- end -}}
+    {{- if .Values.api.enabled -}}
+    - {{ .Values.api.domain }}
+    {{- end -}}
+    secretName: letsencrypt-hue-prod-tls
+{{- end -}}

+ 4 - 4
tools/kubernetes/helm/hue/templates/ingress-https.yaml

@@ -57,11 +57,11 @@ spec:
   tls:
   - hosts:
     - {{ .Values.ingress.domain }}
-    {{- range .Values.ingress.extraHosts }}
+    {{- range .Values.ingress.extraHosts -}}
     - {{ . | quote }}
-    {{- end }}
-    {{ if .Values.api.enabled }}
+    {{- end -}}
+    {{- if .Values.api.enabled -}}
     - {{ .Values.api.domain }}
-    {{ end }}
+    {{- end -}}
     secretName: letsencrypt-hue-prod-tls
 {{- end -}}