Skip to content

Commit fbb99a2

Browse files
author
Jonathan Yu
authored
chore: remove compatibility for legacy networking (#169)
* Remove migration logic and NOTES.txt * Promote ingress defaults to default values.yaml * Use "latest" docs for CVM docs link * Remove obsolete dashboard.yaml template * Remove legacy nginx ingress controller * Simplify logic for custom annotations and labels
1 parent 95eb876 commit fbb99a2

File tree

13 files changed

+124
-809
lines changed

13 files changed

+124
-809
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ View [our docs](https://coder.com/docs/setup/installation) for detailed installa
6161
| coderd.tls.devurlsHostSecretName | string | The secret to use for DevURL TLS. | `""` |
6262
| coderd.tls.hostSecretName | string | The secret to use for TLS. | `""` |
6363
| coderd.trustProxyIP | bool | Whether Coder should trust X-Real-IP and/or X-Forwarded-For headers from your reverse proxy. This should only be turned on if you're using a reverse proxy that sets both of these headers. This is always enabled if the Nginx ingress is deployed. | `false` |
64-
| envbox | object | Required for running Docker inside containers. See requirements: https://coder.com/docs/coder/v1.19/admin/workspace-management/cvms | `{"image":""}` |
64+
| envbox | object | Required for running Docker inside containers. See requirements: https://coder.com/docs/coder/latest/admin/workspace-management/cvms | `{"image":""}` |
6565
| envbox.image | string | Injected by Coder during release. | `""` |
66-
| ingress | object | Configure an Ingress to route traffic to Coder services. | `{"annotations":{},"enable":false,"host":"","tls":{"enable":false}}` |
67-
| ingress.annotations | object | Additional annotations to add to the Ingress object. The behavior is typically dependent on the Ingress Controller implementation, and useful for managing features like TLS termination. | `{}` |
66+
| ingress | object | Configure an Ingress to route traffic to Coder services. | `{"annotations":{"nginx.ingress.kubernetes.io/proxy-body-size":"0"},"enable":false,"host":"","tls":{"enable":false}}` |
67+
| ingress.annotations | object | Additional annotations to add to the Ingress object. The behavior is typically dependent on the Ingress Controller implementation, and useful for managing features like TLS termination. | `{"nginx.ingress.kubernetes.io/proxy-body-size":"0"}` |
6868
| ingress.enable | bool | A boolean controlling whether to create an Ingress. | `false` |
6969
| ingress.host | string | The hostname to proxy to the Coder installation. The cluster Ingress Controller typically uses server name indication or the HTTP Host header to route traffic. | `""` |
7070
| ingress.tls | object | Configures TLS settings for the Ingress. | `{"enable":false}` |

templates/NOTES.txt

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +0,0 @@
1-
{{- /* Deprecation notices for moved properties. See _migrate.tpl */}}
2-
{{- $movedMap := fromJson (include "moved" .) }}
3-
{{- $movedList := list }}
4-
{{- range $_, $key := values $movedMap }}
5-
{{- $values := $.Values }}
6-
{{- $found := true }}
7-
{{- range $_, $keypart := splitList "." $key }}
8-
{{- if $found }}
9-
{{- $values = index $values $keypart }}
10-
{{- if kindIs "invalid" $values }}
11-
{{- $found = false }}
12-
{{- end }}
13-
{{- end }}
14-
{{- end }}
15-
{{- if $found }}
16-
{{- range $newKey, $_ := $movedMap }}
17-
{{- if eq (index $movedMap $newKey) $key }}
18-
{{- $item := printf "Move \"%s\" to \"%s\"" $key $newKey }}
19-
{{- $movedList = append $movedList $item }}
20-
{{- end }}
21-
{{- end }}
22-
{{- end }}
23-
{{- end }}
24-
{{- if gt (len $movedList) 0 }}
25-
Deprecated: The Helm values below should be updated to avoid breaking in a future release!
26-
{{- if hasKey .Values "cemanager" }}
27-
⚠ The "cemanager" Kubernetes Service will be renamed to "coderd".
28-
{{- end }}
29-
{{- $movedList = sortAlpha $movedList }}
30-
{{- range $_, $key := $movedList }}
31-
↪ {{ $key }}
32-
{{- end }}
33-
{{ end }}
34-
35-
{{- if eq (include "coder.useServiceNext" .) "true" }}
36-
{{- if gt (len (keys (.Values.dashboard | dict))) 1 }}
37-
Deprecated: The "dashboard" Kubernetes Service has been merged with "coderd".
38-
✗ All "dashboard.*" values can be safely removed.
39-
{{- if eq (merge .Values dict | dig "ingress" "useDefault" true) false }}
40-
✗ Custom ingress detected; ensure all traffic directs to "coderd".
41-
{{- end }}
42-
{{ end }}
43-
44-
{{- if gt (len (keys (.Values.envproxy | dict))) 1 }}
45-
Deprecated: The "envproxy" Kubernetes Service has been merged with "coderd".
46-
✗ All "envproxy.*" values can be safely removed.
47-
✗ Ensure that workspaces are rebuilt after this change.
48-
{{ end }}
49-
{{- else }}
50-
{{- if eq (include "coder.hasNginxIngress" .) "true" }}
51-
Deprecated: The "nginx" ingress controller will be removed in a future release.
52-
🌍 The "coderd" Kubernetes Service now serves TLS certificates.
53-
⤴ Upgrade now by setting the Helm value "coderd.serviceNext=true".
54-
{{ else }}
55-
Deprecated: The "envproxy" and "dashboard" Kubernetes Services are merging into "coderd" in a future release. To update your custom ingress:
56-
↪ Rename "cemanager" to "coderd"
57-
↪ Route traffic from "dashboard" to "coderd"
58-
↪ Route traffic from "envproxy" to "coderd"
59-
↪ Move TCP port from 8080 to 80
60-
↪ Move TCP port from 8443 to 443
61-
⚠ The "coderd" Kubernetes Service will be type "LoadBalancer" by default. Adjust options using "coderd.serviceSpec".
62-
⤴ Upgrade now by setting the Helm value "coderd.serviceNext=true".
63-
{{- end }}
64-
{{- end }}

templates/_common.tpl

Lines changed: 37 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,17 @@
1-
{{/*
2-
coder.storageClassName adds a storageClassName field to a volume claim
3-
if the 'storageClassName' value is non-empty.
4-
*/}}
1+
# coder.storageClassName adds a storageClassName field to a volume claim
2+
# if the 'storageClassName' value is non-empty.
53
{{- define "coder.storageClassName" }}
6-
{{ $storageClass := include "movedValue" (dict "Values" .Values "Key" "postgres.default.storageClassName") }}
7-
{{- if ne $storageClass "" }}
8-
storageClassName: {{ $storageClass | default "" | quote }}
4+
{{- if .Values.postgres.default.storageClassName }}
5+
storageClassName: {{ .Values.postgres.default.storageClassName | quote }}
96
{{- end }}
107
{{- end }}
11-
{{/*
12-
coder.postgres.env adds environment variables that
13-
specify how to connect to a Postgres instance.
14-
*/}}
8+
9+
# coder.postgres.env adds environment variables that
10+
# specify how to connect to a Postgres instance.
1511
{{- define "coder.postgres.env" }}
16-
{{- if eq (include "movedValue" (dict "Values" .Values "Key" "postgres.default.enable" "Default" true)) "true" }}
12+
{{- if .Values.postgres.default.enable }}
1713
- name: DB_HOST
18-
value: timescale.{{ .Release.Namespace }}{{ include "movedValue" (dict "Values" .Values "Key" "services.clusterDomainSuffix") }}
14+
value: timescale.{{ .Release.Namespace }}{{ .Values.services.clusterDomainSuffix }}
1915
- name: DB_PORT
2016
value: "5432"
2117
- name: DB_USER
@@ -54,27 +50,26 @@ storageClassName: {{ $storageClass | default "" | quote }}
5450
{{- end }}
5551
{{- end }}
5652
{{- end }}
57-
{{/*
58-
coder.volumes adds a volumes stanza if a cert.secret is provided.
59-
*/}}
53+
54+
# coder.volumes adds a volumes stanza if a cert.secret is provided.
6055
{{- define "coder.volumes" }}
6156
volumes:
6257
- name: tmp-pgcerts
6358
emptyDir: {}
64-
{{- if (merge .Values dict | dig "certs" "secret" "name" false) }}
59+
{{- if .Values.certs.secret.name }}
6560
- name: {{ .Values.certs.secret.name | quote }}
6661
secret:
6762
secretName: {{ .Values.certs.secret.name | quote }}
6863
{{- end }}
69-
{{- if ne (include "movedValue" (dict "Values" .Values "Key" "coderd.tls.hostSecretName")) "" }}
64+
{{- if .Values.coderd.tls.hostSecretName }}
7065
- name: tls
7166
secret:
72-
secretName: {{ include "movedValue" (dict "Values" .Values "Key" "coderd.tls.hostSecretName") }}
67+
secretName: {{ .Values.coderd.tls.hostSecretName | quote }}
7368
{{- end }}
74-
{{- if ne (include "movedValue" (dict "Values" .Values "Key" "coderd.tls.devurlsHostSecretName")) "" }}
69+
{{- if .Values.coderd.tls.devurlsHostSecretName }}
7570
- name: devurltls
7671
secret:
77-
secretName: {{ include "movedValue" (dict "Values" .Values "Key" "coderd.tls.devurlsHostSecretName") }}
72+
secretName: {{ .Values.coderd.tls.devurlsHostSecretName | quote }}
7873
{{- end }}
7974
{{- if ne .Values.postgres.ssl.certSecret.name "" }}
8075
- name: pgcert
@@ -93,24 +88,23 @@ volumes:
9388
{{- end }}
9489
{{- end }}
9590

96-
{{/*
97-
coder.volumeMounts adds a volume mounts stanza if a cert.secret is provided.
98-
*/}}
91+
# coder.volumeMounts adds a volume mounts stanza if a cert.secret is
92+
# provided.
9993
{{- define "coder.volumeMounts" }}
10094
volumeMounts:
10195
- name: tmp-pgcerts
10296
mountPath: /tmp/pgcerts
103-
{{- if (merge .Values dict | dig "certs" "secret" "name" false) }}
97+
{{- if .Values.certs.secret.name }}
10498
- name: {{ .Values.certs.secret.name | quote }}
10599
mountPath: /etc/ssl/certs/{{ .Values.certs.secret.key }}
106100
subPath: {{ .Values.certs.secret.key | quote }}
107101
{{- end }}
108-
{{- if ne (include "movedValue" (dict "Values" .Values "Key" "coderd.tls.hostSecretName")) "" }}
102+
{{- if .Values.coderd.tls.hostSecretName }}
109103
- name: tls
110104
mountPath: /etc/ssl/certs/host
111105
readOnly: true
112106
{{- end }}
113-
{{- if ne (include "movedValue" (dict "Values" .Values "Key" "coderd.tls.devurlsHostSecretName")) "" }}
107+
{{- if .Values.coderd.tls.devurlsHostSecretName }}
114108
- name: devurltls
115109
mountPath: /etc/ssl/certs/devurls
116110
readOnly: true
@@ -131,56 +125,37 @@ volumeMounts:
131125
readOnly: true
132126
{{- end }}
133127
{{- end }}
134-
{{/*
135-
coder.serviceTolerations adds tolerations if any are specified to
136-
coder-managed services.
137-
*/}}
128+
129+
# coder.serviceTolerations adds tolerations if any are specified to
130+
# coder-managed services.
138131
{{- define "coder.serviceTolerations" }}
139-
{{- if ne (include "movedValue" (dict "Values" .Values "Key" "services.tolerations")) "" }}
140-
tolerations:
141-
{{ include "movedValue" (dict "Values" .Values "Key" "services.tolerations") }}
132+
{{- if .Values.services.tolerations }}
133+
tolerations: {{ toYaml .Values.services.tolerations | nindent 2 }}
142134
{{- end }}
143135
{{- end }}
144-
{{/*
145-
coder.accessURL is a URL for accessing the coderd.
146-
*/}}
136+
137+
# coder.accessURL is a URL for accessing the coderd.
147138
{{- define "coder.accessURL" }}
148-
{{- if .Values.cemanager }}
149-
{{- if ne (merge .Values dict | dig "cemanager" "accessURL" "") "" }}
150-
{{- .Values.cemanager.accessURL -}}
151-
{{- else -}}
152-
http://cemanager.{{ .Release.Namespace }}{{ include "movedValue" (dict "Values" .Values "Key" "services.clusterDomainSuffix") }}:8080
153-
{{- end }}
154-
{{- else -}}
155-
{{- if ne (merge .Values dict | dig "coderd" "accessURL" "") "" }}
139+
{{- if .Values.coderd.accessURL }}
156140
{{- .Values.coderd.accessURL -}}
157141
{{- else -}}
158-
http://coderd.{{ .Release.Namespace }}{{ include "movedValue" (dict "Values" .Values "Key" "services.clusterDomainSuffix") }}:8080
159-
{{- end }}
142+
http://coderd.{{ .Release.Namespace }}{{ .Values.services.clusterDomainSuffix }}:8080
160143
{{- end }}
161144
{{- end }}
162-
{{/*
163-
coder.cluster.accessURL is a URL for accessing the Kubernetes cluster.
164-
*/}}
145+
146+
# coder.cluster.accessURL is a URL for accessing the Kubernetes cluster.
165147
{{- define "coder.cluster.accessURL" -}}
166-
https://kubernetes.default{{ include "movedValue" (dict "Values" .Values "Key" "services.clusterDomainSuffix") }}:443
148+
https://kubernetes.default{{ .Values.services.clusterDomainSuffix }}:443
167149
{{- end }}
168150

169-
{{/*
170-
coder.services.nodeSelector adds nodeSelectors if any are specified to
171-
coder-managed services.
172-
*/}}
151+
# coder.services.nodeSelector adds nodeSelectors if any are specified to
152+
# coder-managed services.
173153
{{- define "coder.services.nodeSelector" }}
174154
{{- if .Values.services.nodeSelector }}
175-
nodeSelector:
176-
{{ toYaml .Values.services.nodeSelector | indent 1 }}
155+
nodeSelector: {{ toYaml .Values.services.nodeSelector | nindent 2 }}
177156
{{- end }}
178157
{{- end }}
179158

180-
{{- define "coder.serviceName" }}
181-
{{- if hasKey .Values "cemanager" -}}
182-
cemanager
183-
{{- else -}}
159+
{{- define "coder.serviceName" -}}
184160
coderd
185161
{{- end }}
186-
{{- end }}

templates/_environments.tpl

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,28 @@
1-
{{/*
2-
coder.environments.configMap defines configuration that is applied
3-
to user environments.
4-
*/}}
5-
{{- define "coder.environments.configMap" }}
6-
{{- if (merge .Values dict | dig "environments" "tolerations" false) }}
1+
# coder.workspaces.configMap defines configuration that is applied
2+
# to user workspaces.
3+
#
4+
# TODO: rename Values.environments to Values.coderd.workspaces,
5+
# once we verify that it won't hurt backward compatibility
6+
{{- define "coder.workspaces.configMap" }}
7+
{{- if .Values.environments.tolerations }}
78
---
89
apiVersion: v1
910
kind: ConfigMap
1011
metadata:
1112
namespace: {{ .Release.Namespace | quote }}
13+
# TODO: change this to coderd, and store other settings in
14+
# the ConfigMap
1215
name: ce-environment-config
1316
data:
1417
tolerations: {{ toJson .Values.environments.tolerations | b64enc | quote }}
15-
{{- end}}
16-
{{- end}}
17-
{{/*
18-
coder.environments.configMapEnv contains a POD_TOLERATIONS environment variable.
19-
ce-manager uses this environment variable to unmarshal pod toleration objects.
20-
*/}}
21-
{{- define "coder.environments.configMapEnv" }}
18+
{{- end }}
19+
{{- end }}
20+
21+
# coder.workspaces.configMapEnv contains a POD_TOLERATIONS environment
22+
# variable.
23+
#
24+
# coderd uses this environment variable to unmarshal pod toleration objects.
25+
{{- define "coder.workspaces.configMapEnv" }}
2226
{{- if (merge .Values dict | dig "environments" "tolerations" false) }}
2327
- name: POD_TOLERATIONS
2428
value: {{ toJson .Values.environments.tolerations | b64enc | quote }}
@@ -27,4 +31,4 @@ data:
2731
- name: POD_NODESELECTOR
2832
value: {{ toJson .Values.environments.nodeSelector | b64enc | quote }}
2933
{{- end }}
30-
{{- end }}
34+
{{- end }}

templates/_functions.tpl

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
{{/*
2-
coder.resources accepts a resource stanza as its scope and returns
3-
resource configuration if any of the values are set.
4-
*/}}
1+
# coder.resources accepts a resource stanza as its scope and returns
2+
# resource configuration if any of the values are set.
53
{{- define "coder.resources" }}
64
{{- if . }}
75
resources:
@@ -26,11 +24,7 @@ resources:
2624
{{- end }}
2725
{{- end }}
2826

29-
{{/*
30-
coder.template.render -- renders a value that contains template.
31-
Usage:
32-
{{ include "coder.template.render" ( dict "value" .Values.path.to.the.Value "context" $) }}
33-
*/}}
27+
# coder.template.render -- renders a value that contains template.
3428
{{- define "coder.template.render" -}}
3529
{{- if typeIs "string" .value }}
3630
{{- tpl .value .context }}

templates/_ingress.tpl

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
values.yaml settings.
55
*/}}
66
{{- define "coder.ingress.tls" }}
7-
{{- if (merge .Values dict | dig "ingress" "tls" "enable" false) }}
7+
{{- if .Values.ingress.tls.enable }}
88
tls:
99
{{- if and .Values.ingress.host .Values.ingress.tls.hostSecretName }}
1010
- hosts:
@@ -14,30 +14,9 @@
1414
{{- if .Values.devurls }}
1515
{{- if and .Values.devurls.host .Values.ingress.tls.devurlsHostSecretName }}
1616
- hosts:
17-
- {{ include "movedValue" (dict "Values" .Values "Key" "coderd.devurlsHost") }}
17+
- {{ .Values.coderd.devurlsHost }}
1818
secretName: {{ .Values.ingress.tls.devurlsHostSecretName }}
1919
{{- end }}
2020
{{- end }}
2121
{{- end }}
2222
{{- end }}
23-
24-
{{/* */}}
25-
{{- define "coder.hasNginxIngress" }}
26-
{{- if (lookup "v1" "Service" .Release.Namespace "ingress-nginx") -}}
27-
true
28-
{{- else -}}
29-
false
30-
{{- end }}
31-
{{- end }}
32-
33-
{{- define "coder.useServiceNext" }}
34-
{{- if eq (merge .Values dict | dig "coderd" "serviceNext" false) true -}}
35-
true
36-
{{- else if eq (merge .Values dict | dig "ingress" "useDefault" true) false -}}
37-
false
38-
{{- else if eq (include "coder.hasNginxIngress" .) "false" -}}
39-
true
40-
{{- else -}}
41-
false
42-
{{- end }}
43-
{{- end }}

0 commit comments

Comments
 (0)