From 97e515c4823a76ebd2a32fb492fd1bdab1b990e3 Mon Sep 17 00:00:00 2001 From: Mike Terhar Date: Tue, 24 Aug 2021 16:12:56 +0000 Subject: [PATCH 1/3] add example for custom ingress --- examples/ingress/ingress.values.yaml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 examples/ingress/ingress.values.yaml diff --git a/examples/ingress/ingress.values.yaml b/examples/ingress/ingress.values.yaml new file mode 100644 index 00000000..326597f3 --- /dev/null +++ b/examples/ingress/ingress.values.yaml @@ -0,0 +1,17 @@ +# Using coder with ingress in versions from 1.21 and newer +# Coder's built-in ingress controller is no longer packaged +# the coderd pod does not require a fanout so it is exposed +# by creating a LoadBalancer service +coderd: + serviceNext: true + serviceSpec: + type: ClusterIP + # The values.yaml file in the chart includes LoadBalancer + # specs which need to have the keys removed using null + # this does not work as a sub-chart + loadBalancerIP: null + externalTrafficPolicy: null + loadBalancerSourceRanges: null +# Add your own ingress spec based on the type of ingress you +# have deployed in your cluster. Send all traffic to the +# coderd service on ports 80, and 443. \ No newline at end of file From 4276cf256480d8c8f39381ec551df478c89afb55 Mon Sep 17 00:00:00 2001 From: Mike Terhar Date: Tue, 24 Aug 2021 18:14:05 +0000 Subject: [PATCH 2/3] add serviceNext with ingress to template --- examples/ingress/ingress.values.yaml | 13 ++++++++++--- templates/ingress.yaml | 29 ++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/examples/ingress/ingress.values.yaml b/examples/ingress/ingress.values.yaml index 326597f3..672b718f 100644 --- a/examples/ingress/ingress.values.yaml +++ b/examples/ingress/ingress.values.yaml @@ -4,6 +4,7 @@ # by creating a LoadBalancer service coderd: serviceNext: true + devurlsHost: '*.devurls.coderhost.com' serviceSpec: type: ClusterIP # The values.yaml file in the chart includes LoadBalancer @@ -12,6 +13,12 @@ coderd: loadBalancerIP: null externalTrafficPolicy: null loadBalancerSourceRanges: null -# Add your own ingress spec based on the type of ingress you -# have deployed in your cluster. Send all traffic to the -# coderd service on ports 80, and 443. \ No newline at end of file +# Add the ingress values section to enable the ingress resource +# without the controller +ingress: + # Enable set to true creates the ingress resource + enable: true + # Ingress needs a host name so it can share a controller + host: 'coder.coderhost.com' + # useDefault set to false disables creation of the ingress controller + useDefault: false \ No newline at end of file diff --git a/templates/ingress.yaml b/templates/ingress.yaml index 1633bf65..ec3a6993 100644 --- a/templates/ingress.yaml +++ b/templates/ingress.yaml @@ -409,3 +409,32 @@ spec: {{- end }} {{- end }} --- +{{- if and (merge .Values dict | dig "coderd" "serviceNext" true) (merge .Values dict | dig "ingress" "enable" true) }} +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: coderd-ingress +spec: +{{- include "coder.ingress.tls" . }} + rules: + - host: {{ merge .Values dict | dig "ingress" "host" "" | quote }} + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: {{ include "coder.serviceName" . }} + port: + number: 80 + - host: {{ merge .Values dict | dig "coderd" "devurlsHost" "" | quote }} + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: {{ include "coder.serviceName" . }} + port: + number: 80 +{{- end }} \ No newline at end of file From 448a385017d7fd53be638de6e4e2eef8cecd9cc1 Mon Sep 17 00:00:00 2001 From: Mike Terhar Date: Tue, 24 Aug 2021 18:18:23 +0000 Subject: [PATCH 3/3] add annotation support --- examples/ingress/ingress.values.yaml | 4 +++- templates/ingress.yaml | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/examples/ingress/ingress.values.yaml b/examples/ingress/ingress.values.yaml index 672b718f..e3303e41 100644 --- a/examples/ingress/ingress.values.yaml +++ b/examples/ingress/ingress.values.yaml @@ -21,4 +21,6 @@ ingress: # Ingress needs a host name so it can share a controller host: 'coder.coderhost.com' # useDefault set to false disables creation of the ingress controller - useDefault: false \ No newline at end of file + useDefault: false + # add annotations for TLS issuers and such + annotations: {} \ No newline at end of file diff --git a/templates/ingress.yaml b/templates/ingress.yaml index ec3a6993..5cae1bf0 100644 --- a/templates/ingress.yaml +++ b/templates/ingress.yaml @@ -414,6 +414,12 @@ apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: coderd-ingress + namespace: {{ .Release.Namespace | quote }} + annotations: + nginx.ingress.kubernetes.io/proxy-body-size: "0" + {{- range $key, $value := merge .Values dict | dig "ingress" "annotations" dict }} + {{ $key }}: {{ $value | quote }} + {{- end }} spec: {{- include "coder.ingress.tls" . }} rules: