Skip to content

Commit 91b43e7

Browse files
author
Mike Terhar
authored
add example for custom ingress (#146)
1 parent e158a75 commit 91b43e7

File tree

2 files changed

+61
-0
lines changed

2 files changed

+61
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Using coder with ingress in versions from 1.21 and newer
2+
# Coder's built-in ingress controller is no longer packaged
3+
# the coderd pod does not require a fanout so it is exposed
4+
# by creating a LoadBalancer service
5+
coderd:
6+
serviceNext: true
7+
devurlsHost: '*.devurls.coderhost.com'
8+
serviceSpec:
9+
type: ClusterIP
10+
# The values.yaml file in the chart includes LoadBalancer
11+
# specs which need to have the keys removed using null
12+
# this does not work as a sub-chart
13+
loadBalancerIP: null
14+
externalTrafficPolicy: null
15+
loadBalancerSourceRanges: null
16+
# Add the ingress values section to enable the ingress resource
17+
# without the controller
18+
ingress:
19+
# Enable set to true creates the ingress resource
20+
enable: true
21+
# Ingress needs a host name so it can share a controller
22+
host: 'coder.coderhost.com'
23+
# useDefault set to false disables creation of the ingress controller
24+
useDefault: false
25+
# add annotations for TLS issuers and such
26+
annotations: {}

templates/ingress.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,3 +409,38 @@ spec:
409409
{{- end }}
410410
{{- end }}
411411
---
412+
{{- if and (merge .Values dict | dig "coderd" "serviceNext" true) (merge .Values dict | dig "ingress" "enable" true) }}
413+
apiVersion: networking.k8s.io/v1
414+
kind: Ingress
415+
metadata:
416+
name: coderd-ingress
417+
namespace: {{ .Release.Namespace | quote }}
418+
annotations:
419+
nginx.ingress.kubernetes.io/proxy-body-size: "0"
420+
{{- range $key, $value := merge .Values dict | dig "ingress" "annotations" dict }}
421+
{{ $key }}: {{ $value | quote }}
422+
{{- end }}
423+
spec:
424+
{{- include "coder.ingress.tls" . }}
425+
rules:
426+
- host: {{ merge .Values dict | dig "ingress" "host" "" | quote }}
427+
http:
428+
paths:
429+
- path: /
430+
pathType: Prefix
431+
backend:
432+
service:
433+
name: {{ include "coder.serviceName" . }}
434+
port:
435+
number: 80
436+
- host: {{ merge .Values dict | dig "coderd" "devurlsHost" "" | quote }}
437+
http:
438+
paths:
439+
- path: /
440+
pathType: Prefix
441+
backend:
442+
service:
443+
name: {{ include "coder.serviceName" . }}
444+
port:
445+
number: 80
446+
{{- end }}

0 commit comments

Comments
 (0)