Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ View [our docs](https://coder.com/docs/setup/installation) for detailed installa
| coderd.tls.devurlsHostSecretName | string | The secret to use for DevURL TLS. | `""` |
| coderd.tls.hostSecretName | string | The secret to use for TLS. | `""` |
| 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` |
| envbox | object | Required for running Docker inside containers. See requirements: https://coder.com/docs/coder/v1.19/admin/workspace-management/cvms | `{"image":""}` |
| envbox | object | Required for running Docker inside containers. See requirements: https://coder.com/docs/coder/latest/admin/workspace-management/cvms | `{"image":""}` |
| envbox.image | string | Injected by Coder during release. | `""` |
| ingress | object | Configure an Ingress to route traffic to Coder services. | `{"annotations":{},"enable":false,"host":"","tls":{"enable":false}}` |
| 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. | `{}` |
| 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}}` |
| 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"}` |
| ingress.enable | bool | A boolean controlling whether to create an Ingress. | `false` |
| 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. | `""` |
| ingress.tls | object | Configures TLS settings for the Ingress. | `{"enable":false}` |
Expand Down
64 changes: 0 additions & 64 deletions templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -1,64 +0,0 @@
{{- /* Deprecation notices for moved properties. See _migrate.tpl */}}
{{- $movedMap := fromJson (include "moved" .) }}
{{- $movedList := list }}
{{- range $_, $key := values $movedMap }}
{{- $values := $.Values }}
{{- $found := true }}
{{- range $_, $keypart := splitList "." $key }}
{{- if $found }}
{{- $values = index $values $keypart }}
{{- if kindIs "invalid" $values }}
{{- $found = false }}
{{- end }}
{{- end }}
{{- end }}
{{- if $found }}
{{- range $newKey, $_ := $movedMap }}
{{- if eq (index $movedMap $newKey) $key }}
{{- $item := printf "Move \"%s\" to \"%s\"" $key $newKey }}
{{- $movedList = append $movedList $item }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- if gt (len $movedList) 0 }}
Deprecated: The Helm values below should be updated to avoid breaking in a future release!
{{- if hasKey .Values "cemanager" }}
⚠ The "cemanager" Kubernetes Service will be renamed to "coderd".
{{- end }}
{{- $movedList = sortAlpha $movedList }}
{{- range $_, $key := $movedList }}
↪ {{ $key }}
{{- end }}
{{ end }}

{{- if eq (include "coder.useServiceNext" .) "true" }}
{{- if gt (len (keys (.Values.dashboard | dict))) 1 }}
Deprecated: The "dashboard" Kubernetes Service has been merged with "coderd".
✗ All "dashboard.*" values can be safely removed.
{{- if eq (merge .Values dict | dig "ingress" "useDefault" true) false }}
✗ Custom ingress detected; ensure all traffic directs to "coderd".
{{- end }}
{{ end }}

{{- if gt (len (keys (.Values.envproxy | dict))) 1 }}
Deprecated: The "envproxy" Kubernetes Service has been merged with "coderd".
✗ All "envproxy.*" values can be safely removed.
✗ Ensure that workspaces are rebuilt after this change.
{{ end }}
{{- else }}
{{- if eq (include "coder.hasNginxIngress" .) "true" }}
Deprecated: The "nginx" ingress controller will be removed in a future release.
🌍 The "coderd" Kubernetes Service now serves TLS certificates.
⤴ Upgrade now by setting the Helm value "coderd.serviceNext=true".
{{ else }}
Deprecated: The "envproxy" and "dashboard" Kubernetes Services are merging into "coderd" in a future release. To update your custom ingress:
↪ Rename "cemanager" to "coderd"
↪ Route traffic from "dashboard" to "coderd"
↪ Route traffic from "envproxy" to "coderd"
↪ Move TCP port from 8080 to 80
↪ Move TCP port from 8443 to 443
⚠ The "coderd" Kubernetes Service will be type "LoadBalancer" by default. Adjust options using "coderd.serviceSpec".
⤴ Upgrade now by setting the Helm value "coderd.serviceNext=true".
{{- end }}
{{- end }}
99 changes: 37 additions & 62 deletions templates/_common.tpl
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
{{/*
coder.storageClassName adds a storageClassName field to a volume claim
if the 'storageClassName' value is non-empty.
*/}}
# coder.storageClassName adds a storageClassName field to a volume claim
# if the 'storageClassName' value is non-empty.
{{- define "coder.storageClassName" }}
{{ $storageClass := include "movedValue" (dict "Values" .Values "Key" "postgres.default.storageClassName") }}
{{- if ne $storageClass "" }}
storageClassName: {{ $storageClass | default "" | quote }}
{{- if .Values.postgres.default.storageClassName }}
storageClassName: {{ .Values.postgres.default.storageClassName | quote }}
{{- end }}
{{- end }}
{{/*
coder.postgres.env adds environment variables that
specify how to connect to a Postgres instance.
*/}}

# coder.postgres.env adds environment variables that
# specify how to connect to a Postgres instance.
{{- define "coder.postgres.env" }}
{{- if eq (include "movedValue" (dict "Values" .Values "Key" "postgres.default.enable" "Default" true)) "true" }}
{{- if .Values.postgres.default.enable }}
- name: DB_HOST
value: timescale.{{ .Release.Namespace }}{{ include "movedValue" (dict "Values" .Values "Key" "services.clusterDomainSuffix") }}
value: timescale.{{ .Release.Namespace }}{{ .Values.services.clusterDomainSuffix }}
- name: DB_PORT
value: "5432"
- name: DB_USER
Expand Down Expand Up @@ -54,27 +50,26 @@ storageClassName: {{ $storageClass | default "" | quote }}
{{- end }}
{{- end }}
{{- end }}
{{/*
coder.volumes adds a volumes stanza if a cert.secret is provided.
*/}}

# coder.volumes adds a volumes stanza if a cert.secret is provided.
{{- define "coder.volumes" }}
volumes:
- name: tmp-pgcerts
emptyDir: {}
{{- if (merge .Values dict | dig "certs" "secret" "name" false) }}
{{- if .Values.certs.secret.name }}
- name: {{ .Values.certs.secret.name | quote }}
secret:
secretName: {{ .Values.certs.secret.name | quote }}
{{- end }}
{{- if ne (include "movedValue" (dict "Values" .Values "Key" "coderd.tls.hostSecretName")) "" }}
{{- if .Values.coderd.tls.hostSecretName }}
- name: tls
secret:
secretName: {{ include "movedValue" (dict "Values" .Values "Key" "coderd.tls.hostSecretName") }}
secretName: {{ .Values.coderd.tls.hostSecretName | quote }}
{{- end }}
{{- if ne (include "movedValue" (dict "Values" .Values "Key" "coderd.tls.devurlsHostSecretName")) "" }}
{{- if .Values.coderd.tls.devurlsHostSecretName }}
- name: devurltls
secret:
secretName: {{ include "movedValue" (dict "Values" .Values "Key" "coderd.tls.devurlsHostSecretName") }}
secretName: {{ .Values.coderd.tls.devurlsHostSecretName | quote }}
{{- end }}
{{- if ne .Values.postgres.ssl.certSecret.name "" }}
- name: pgcert
Expand All @@ -93,24 +88,23 @@ volumes:
{{- end }}
{{- end }}

{{/*
coder.volumeMounts adds a volume mounts stanza if a cert.secret is provided.
*/}}
# coder.volumeMounts adds a volume mounts stanza if a cert.secret is
# provided.
{{- define "coder.volumeMounts" }}
volumeMounts:
- name: tmp-pgcerts
mountPath: /tmp/pgcerts
{{- if (merge .Values dict | dig "certs" "secret" "name" false) }}
{{- if .Values.certs.secret.name }}
- name: {{ .Values.certs.secret.name | quote }}
mountPath: /etc/ssl/certs/{{ .Values.certs.secret.key }}
subPath: {{ .Values.certs.secret.key | quote }}
{{- end }}
{{- if ne (include "movedValue" (dict "Values" .Values "Key" "coderd.tls.hostSecretName")) "" }}
{{- if .Values.coderd.tls.hostSecretName }}
- name: tls
mountPath: /etc/ssl/certs/host
readOnly: true
{{- end }}
{{- if ne (include "movedValue" (dict "Values" .Values "Key" "coderd.tls.devurlsHostSecretName")) "" }}
{{- if .Values.coderd.tls.devurlsHostSecretName }}
- name: devurltls
mountPath: /etc/ssl/certs/devurls
readOnly: true
Expand All @@ -131,56 +125,37 @@ volumeMounts:
readOnly: true
{{- end }}
{{- end }}
{{/*
coder.serviceTolerations adds tolerations if any are specified to
coder-managed services.
*/}}

# coder.serviceTolerations adds tolerations if any are specified to
# coder-managed services.
{{- define "coder.serviceTolerations" }}
{{- if ne (include "movedValue" (dict "Values" .Values "Key" "services.tolerations")) "" }}
tolerations:
{{ include "movedValue" (dict "Values" .Values "Key" "services.tolerations") }}
{{- if .Values.services.tolerations }}
tolerations: {{ toYaml .Values.services.tolerations | nindent 2 }}
{{- end }}
{{- end }}
{{/*
coder.accessURL is a URL for accessing the coderd.
*/}}

# coder.accessURL is a URL for accessing the coderd.
{{- define "coder.accessURL" }}
{{- if .Values.cemanager }}
{{- if ne (merge .Values dict | dig "cemanager" "accessURL" "") "" }}
{{- .Values.cemanager.accessURL -}}
{{- else -}}
http://cemanager.{{ .Release.Namespace }}{{ include "movedValue" (dict "Values" .Values "Key" "services.clusterDomainSuffix") }}:8080
{{- end }}
{{- else -}}
{{- if ne (merge .Values dict | dig "coderd" "accessURL" "") "" }}
{{- if .Values.coderd.accessURL }}
{{- .Values.coderd.accessURL -}}
{{- else -}}
http://coderd.{{ .Release.Namespace }}{{ include "movedValue" (dict "Values" .Values "Key" "services.clusterDomainSuffix") }}:8080
{{- end }}
http://coderd.{{ .Release.Namespace }}{{ .Values.services.clusterDomainSuffix }}:8080
{{- end }}
{{- end }}
{{/*
coder.cluster.accessURL is a URL for accessing the Kubernetes cluster.
*/}}

# coder.cluster.accessURL is a URL for accessing the Kubernetes cluster.
{{- define "coder.cluster.accessURL" -}}
https://kubernetes.default{{ include "movedValue" (dict "Values" .Values "Key" "services.clusterDomainSuffix") }}:443
https://kubernetes.default{{ .Values.services.clusterDomainSuffix }}:443
{{- end }}

{{/*
coder.services.nodeSelector adds nodeSelectors if any are specified to
coder-managed services.
*/}}
# coder.services.nodeSelector adds nodeSelectors if any are specified to
# coder-managed services.
{{- define "coder.services.nodeSelector" }}
{{- if .Values.services.nodeSelector }}
nodeSelector:
{{ toYaml .Values.services.nodeSelector | indent 1 }}
nodeSelector: {{ toYaml .Values.services.nodeSelector | nindent 2 }}
{{- end }}
{{- end }}

{{- define "coder.serviceName" }}
{{- if hasKey .Values "cemanager" -}}
cemanager
{{- else -}}
{{- define "coder.serviceName" -}}
coderd
{{- end }}
{{- end }}
32 changes: 18 additions & 14 deletions templates/_environments.tpl
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
{{/*
coder.environments.configMap defines configuration that is applied
to user environments.
*/}}
{{- define "coder.environments.configMap" }}
{{- if (merge .Values dict | dig "environments" "tolerations" false) }}
# coder.workspaces.configMap defines configuration that is applied
# to user workspaces.
#
# TODO: rename Values.environments to Values.coderd.workspaces,
# once we verify that it won't hurt backward compatibility
{{- define "coder.workspaces.configMap" }}
{{- if .Values.environments.tolerations }}
---
apiVersion: v1
kind: ConfigMap
metadata:
namespace: {{ .Release.Namespace | quote }}
# TODO: change this to coderd, and store other settings in
# the ConfigMap
name: ce-environment-config
data:
tolerations: {{ toJson .Values.environments.tolerations | b64enc | quote }}
{{- end}}
{{- end}}
{{/*
coder.environments.configMapEnv contains a POD_TOLERATIONS environment variable.
ce-manager uses this environment variable to unmarshal pod toleration objects.
*/}}
{{- define "coder.environments.configMapEnv" }}
{{- end }}
{{- end }}

# coder.workspaces.configMapEnv contains a POD_TOLERATIONS environment
# variable.
#
# coderd uses this environment variable to unmarshal pod toleration objects.
{{- define "coder.workspaces.configMapEnv" }}
{{- if (merge .Values dict | dig "environments" "tolerations" false) }}
- name: POD_TOLERATIONS
value: {{ toJson .Values.environments.tolerations | b64enc | quote }}
Expand All @@ -27,4 +31,4 @@ data:
- name: POD_NODESELECTOR
value: {{ toJson .Values.environments.nodeSelector | b64enc | quote }}
{{- end }}
{{- end }}
{{- end }}
12 changes: 3 additions & 9 deletions templates/_functions.tpl
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{{/*
coder.resources accepts a resource stanza as its scope and returns
resource configuration if any of the values are set.
*/}}
# coder.resources accepts a resource stanza as its scope and returns
# resource configuration if any of the values are set.
{{- define "coder.resources" }}
{{- if . }}
resources:
Expand All @@ -26,11 +24,7 @@ resources:
{{- end }}
{{- end }}

{{/*
coder.template.render -- renders a value that contains template.
Usage:
{{ include "coder.template.render" ( dict "value" .Values.path.to.the.Value "context" $) }}
*/}}
# coder.template.render -- renders a value that contains template.
{{- define "coder.template.render" -}}
{{- if typeIs "string" .value }}
{{- tpl .value .context }}
Expand Down
25 changes: 2 additions & 23 deletions templates/_ingress.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
values.yaml settings.
*/}}
{{- define "coder.ingress.tls" }}
{{- if (merge .Values dict | dig "ingress" "tls" "enable" false) }}
{{- if .Values.ingress.tls.enable }}
tls:
{{- if and .Values.ingress.host .Values.ingress.tls.hostSecretName }}
- hosts:
Expand All @@ -14,30 +14,9 @@
{{- if .Values.devurls }}
{{- if and .Values.devurls.host .Values.ingress.tls.devurlsHostSecretName }}
- hosts:
- {{ include "movedValue" (dict "Values" .Values "Key" "coderd.devurlsHost") }}
- {{ .Values.coderd.devurlsHost }}
secretName: {{ .Values.ingress.tls.devurlsHostSecretName }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}

{{/* */}}
{{- define "coder.hasNginxIngress" }}
{{- if (lookup "v1" "Service" .Release.Namespace "ingress-nginx") -}}
true
{{- else -}}
false
{{- end }}
{{- end }}

{{- define "coder.useServiceNext" }}
{{- if eq (merge .Values dict | dig "coderd" "serviceNext" false) true -}}
true
{{- else if eq (merge .Values dict | dig "ingress" "useDefault" true) false -}}
false
{{- else if eq (include "coder.hasNginxIngress" .) "false" -}}
true
{{- else -}}
false
{{- end }}
{{- end }}
Loading