diff --git a/examples/ingress/ingress.values.yaml b/examples/ingress/ingress.values.yaml new file mode 100644 index 00000000..e3303e41 --- /dev/null +++ b/examples/ingress/ingress.values.yaml @@ -0,0 +1,26 @@ +# 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 + devurlsHost: '*.devurls.coderhost.com' + 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 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 + # 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 1633bf65..5cae1bf0 100644 --- a/templates/ingress.yaml +++ b/templates/ingress.yaml @@ -409,3 +409,38 @@ 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 + 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: + - 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