mirror of
https://github.com/coder/coder.git
synced 2025-07-03 16:13:58 +00:00
Added namespace to all resources in the helm chart and added tests to ensure that coder can be deployed in non-default namespaces, as specified via the namespace flag in the helm command. Ways to verify this: - current state: ```bash $ helm template my-coder coder -n coder --version 2.19.0 --repo https://helm.coder.com/v2 | yq '.metadata.namespace' null --- null --- null --- null --- null ``` - fixed state when checking out this PR: ```bash $ helm template my-coder ./helm/coder -n coder --set coder.image.tag=latest | yq '.metadata.namespace' coder --- coder --- coder --- coder --- coder ``` Change-Id: Ib66d4be9bcc4984dfe15709362e1fe0dcd3e847f Signed-off-by: Thomas Kosiewski <tk@coder.com>
92 lines
2.9 KiB
YAML
92 lines
2.9 KiB
YAML
{{- define "libcoder.deployment.tpl" -}}
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: {{ include "coder.name" .}}
|
|
namespace: {{ .Release.Namespace }}
|
|
labels:
|
|
{{- include "coder.labels" . | nindent 4 }}
|
|
{{- with .Values.coder.labels }}
|
|
{{- toYaml . | nindent 4 }}
|
|
{{- end }}
|
|
annotations: {{ toYaml .Values.coder.annotations | nindent 4}}
|
|
spec:
|
|
replicas: {{ .Values.coder.replicaCount }}
|
|
selector:
|
|
matchLabels:
|
|
{{- include "coder.selectorLabels" . | nindent 6 }}
|
|
template:
|
|
metadata:
|
|
labels:
|
|
{{- include "coder.labels" . | nindent 8 }}
|
|
{{- with .Values.coder.podLabels }}
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
annotations:
|
|
{{- toYaml .Values.coder.podAnnotations | nindent 8 }}
|
|
spec:
|
|
serviceAccountName: {{ .Values.coder.serviceAccount.name | quote }}
|
|
restartPolicy: Always
|
|
{{- with .Values.coder.image.pullSecrets }}
|
|
imagePullSecrets:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
terminationGracePeriodSeconds: 60
|
|
{{- with .Values.coder.affinity }}
|
|
affinity:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
{{- with .Values.coder.tolerations }}
|
|
tolerations:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
{{- with .Values.coder.nodeSelector }}
|
|
nodeSelector:
|
|
{{ toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
{{- with .Values.coder.topologySpreadConstraints }}
|
|
topologySpreadConstraints:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
{{- with .Values.coder.initContainers }}
|
|
initContainers:
|
|
{{ toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
containers: []
|
|
{{- include "coder.volumes" . | nindent 6 }}
|
|
{{- end -}}
|
|
{{- define "libcoder.deployment" -}}
|
|
{{- include "libcoder.util.merge" (append . "libcoder.deployment.tpl") -}}
|
|
{{- end -}}
|
|
|
|
{{- define "libcoder.containerspec.tpl" -}}
|
|
name: coder
|
|
image: {{ include "coder.image" . | quote }}
|
|
imagePullPolicy: {{ .Values.coder.image.pullPolicy }}
|
|
command:
|
|
{{- toYaml .Values.coder.command | nindent 2 }}
|
|
resources:
|
|
{{- toYaml .Values.coder.resources | nindent 2 }}
|
|
lifecycle:
|
|
{{- toYaml .Values.coder.lifecycle | nindent 2 }}
|
|
securityContext: {{ toYaml .Values.coder.securityContext | nindent 2 }}
|
|
{{ include "coder.volumeMounts" . }}
|
|
{{- end -}}
|
|
{{- define "libcoder.containerspec" -}}
|
|
{{- include "libcoder.util.merge" (append . "libcoder.containerspec.tpl") -}}
|
|
{{- end -}}
|
|
|
|
{{- define "libcoder.serviceaccount.tpl" -}}
|
|
apiVersion: v1
|
|
kind: ServiceAccount
|
|
metadata:
|
|
name: {{ .Values.coder.serviceAccount.name | quote }}
|
|
namespace: {{ .Release.Namespace }}
|
|
annotations: {{ toYaml .Values.coder.serviceAccount.annotations | nindent 4 }}
|
|
labels:
|
|
{{- include "coder.labels" . | nindent 4 }}
|
|
{{- end -}}
|
|
{{- define "libcoder.serviceaccount" -}}
|
|
{{- include "libcoder.util.merge" (append . "libcoder.serviceaccount.tpl") -}}
|
|
{{- end -}}
|