From 2260ca6526c49420e87b38e46925c8f4b6e79ce6 Mon Sep 17 00:00:00 2001 From: Ben Date: Mon, 10 Oct 2022 17:15:43 +0000 Subject: [PATCH 1/3] feat: add ingress to helm chart --- helm/templates/ingress.yaml | 33 +++++++++++++++++++++++++++++++++ helm/values.yaml | 18 +++++++++++++++++- 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 helm/templates/ingress.yaml diff --git a/helm/templates/ingress.yaml b/helm/templates/ingress.yaml new file mode 100644 index 0000000000000..cdfe00ea1ec12 --- /dev/null +++ b/helm/templates/ingress.yaml @@ -0,0 +1,33 @@ + +{{- if .Values.coder.ingress.enable }} +--- +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: coder + labels: + {{- include "coder.labels" . | nindent 4 }} +spec: + {{- if .Values.coder.ingress.className }} + {{/* If this is set to an empty string it fails validation on K8s */}} + ingressClassName: {{ .Values.coder.ingress.className | quote }} + {{- end }} + rules: + - host: {{ .Values.coder.ingress.host | quote }} + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: coder + port: + name: {{ include "coder.portName" . | quote }} + + {{- if .Values.coder.ingress.tls.enable }} + tls: + - hosts: + - {{ .Values.coder.ingress.host | quote }} + secretName: {{ .Values.coder.ingress.tls.secretName | quote}} + {{- end }} +{{- end }} diff --git a/helm/values.yaml b/helm/values.yaml index 221bde01badf9..8a07dd4209b2e 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -59,7 +59,8 @@ coder: # coder.resources -- The resources to request for Coder. These are optional # and are not set by default. - resources: {} + resources: + {} # limits: # cpu: 100m # memory: 128Mi @@ -88,3 +89,18 @@ coder: # coder.service.annotations -- The service annotations. See: # https://kubernetes.io/docs/concepts/services-networking/service/#internal-load-balancer annotations: {} + + # coder.ingress -- The Ingress object to expose for Coder. + ingress: + # coder.ingress.enable -- Whether to create the Ingress object. + enable: false + # coder.ingress.className -- The name of the Ingress class to use. + className: "" + # coder.ingress.host -- The hostname to match on. + host: "" + # coder.ingress.tls -- The TLS configuration to use for the Ingress. + tls: + # coder.ingress.tls.enable -- Whether to enable TLS on the Ingress. + enable: false + # coder.ingress.tls.secretName -- The name of the TLS secret to use. + secretName: "" From cc8b74ff5e67d0dfd70c470ffa5a819f02a3ebc8 Mon Sep 17 00:00:00 2001 From: Dean Sheather Date: Mon, 10 Oct 2022 20:09:19 +0000 Subject: [PATCH 2/3] chore: multiple hostname support in ingress --- helm/templates/ingress.yaml | 42 +++++++++++++++++++++++++++---------- helm/values.yaml | 9 ++++++++ 2 files changed, 40 insertions(+), 11 deletions(-) diff --git a/helm/templates/ingress.yaml b/helm/templates/ingress.yaml index cdfe00ea1ec12..594bda6747873 100644 --- a/helm/templates/ingress.yaml +++ b/helm/templates/ingress.yaml @@ -7,27 +7,47 @@ metadata: name: coder labels: {{- include "coder.labels" . | nindent 4 }} + annotations: + {{- toYaml .Values.coder.ingress.annotations | nindent 4 }} spec: {{- if .Values.coder.ingress.className }} {{/* If this is set to an empty string it fails validation on K8s */}} ingressClassName: {{ .Values.coder.ingress.className | quote }} {{- end }} + rules: - - host: {{ .Values.coder.ingress.host | quote }} - http: - paths: - - path: / - pathType: Prefix - backend: - service: - name: coder - port: - name: {{ include "coder.portName" . | quote }} + - host: {{ .Values.coder.ingress.host | quote }} + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: coder + port: + name: {{ include "coder.portName" . | quote }} + {{- if .Values.coder.ingress.wildcardHost }} + - host: {{ .Values.coder.ingress.wildcardHost | quote }} + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: coder + port: + name: {{ include "coder.portName" . | quote }} + {{- end }} {{- if .Values.coder.ingress.tls.enable }} tls: - hosts: - - {{ .Values.coder.ingress.host | quote }} + - {{ .Values.coder.ingress.host | quote }} secretName: {{ .Values.coder.ingress.tls.secretName | quote}} + {{- if .Values.coder.ingress.tls.wildcardSecretName }} + - hosts: + - {{ .Values.coder.ingress.wildcardHost | quote }} + secretName: {{ .Values.coder.ingress.tls.wildcardSecretName | quote}} + {{- end }} {{- end }} {{- end }} diff --git a/helm/values.yaml b/helm/values.yaml index 8a07dd4209b2e..9841dad451ccf 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -98,9 +98,18 @@ coder: className: "" # coder.ingress.host -- The hostname to match on. host: "" + # coder.ingress.wildcardHost -- The wildcard hostname to match on. Should be + # in the form "*.example.com". Optional if not using applications over + # subdomains. + wildcardHost: "" + # coder.ingress.annotations -- The ingress annotations. + annotations: {} # coder.ingress.tls -- The TLS configuration to use for the Ingress. tls: # coder.ingress.tls.enable -- Whether to enable TLS on the Ingress. enable: false # coder.ingress.tls.secretName -- The name of the TLS secret to use. secretName: "" + # coder.ingress.tls.wildcardSecretName -- The name of the TLS secret to + # use for the wildcard host. + wildcardSecretName: "" From d03db510c669cdc212fb7ae61a264a05c703b1b2 Mon Sep 17 00:00:00 2001 From: Dean Sheather Date: Mon, 10 Oct 2022 21:51:06 +0000 Subject: [PATCH 3/3] fixup! chore: multiple hostname support in ingress --- helm/values.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/helm/values.yaml b/helm/values.yaml index 9841dad451ccf..cfba214ee6028 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -92,7 +92,9 @@ coder: # coder.ingress -- The Ingress object to expose for Coder. ingress: - # coder.ingress.enable -- Whether to create the Ingress object. + # coder.ingress.enable -- Whether to create the Ingress object. If using an + # Ingress, we recommend not specifying coder.tls.secretNames as the Ingress + # will handle TLS termination. enable: false # coder.ingress.className -- The name of the Ingress class to use. className: ""