2020-09-03 03:41:58 +08:00
|
|
|
apiVersion: apps/v1
|
|
|
|
kind: Deployment
|
|
|
|
metadata:
|
|
|
|
name: {{ include "code-server.fullname" . }}
|
|
|
|
labels:
|
|
|
|
app.kubernetes.io/name: {{ include "code-server.name" . }}
|
|
|
|
helm.sh/chart: {{ include "code-server.chart" . }}
|
|
|
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
|
|
|
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
|
|
|
spec:
|
|
|
|
replicas: 1
|
|
|
|
strategy:
|
|
|
|
type: Recreate
|
|
|
|
selector:
|
|
|
|
matchLabels:
|
|
|
|
app.kubernetes.io/name: {{ include "code-server.name" . }}
|
|
|
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
|
|
|
template:
|
|
|
|
metadata:
|
|
|
|
labels:
|
|
|
|
app.kubernetes.io/name: {{ include "code-server.name" . }}
|
|
|
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
|
|
|
spec:
|
2022-02-15 06:34:07 +08:00
|
|
|
imagePullSecrets: {{- toYaml .Values.imagePullSecrets | nindent 8 }}
|
2020-09-03 03:41:58 +08:00
|
|
|
{{- if .Values.hostnameOverride }}
|
|
|
|
hostname: {{ .Values.hostnameOverride }}
|
|
|
|
{{- end }}
|
2022-07-19 03:27:54 +08:00
|
|
|
{{- if .Values.priorityClassName }}
|
|
|
|
priorityClassName: {{ .Values.priorityClassName }}
|
|
|
|
{{- end }}
|
2020-09-03 03:41:58 +08:00
|
|
|
{{- if .Values.securityContext.enabled }}
|
|
|
|
securityContext:
|
|
|
|
fsGroup: {{ .Values.securityContext.fsGroup }}
|
|
|
|
{{- end }}
|
|
|
|
{{- if and .Values.volumePermissions.enabled .Values.persistence.enabled }}
|
|
|
|
initContainers:
|
|
|
|
- name: init-chmod-data
|
|
|
|
image: busybox:latest
|
|
|
|
imagePullPolicy: IfNotPresent
|
|
|
|
command:
|
|
|
|
- sh
|
|
|
|
- -c
|
|
|
|
- |
|
|
|
|
chown -R {{ .Values.securityContext.runAsUser }}:{{ .Values.securityContext.fsGroup }} /home/coder
|
|
|
|
securityContext:
|
|
|
|
runAsUser: {{ .Values.volumePermissions.securityContext.runAsUser }}
|
|
|
|
volumeMounts:
|
|
|
|
- name: data
|
|
|
|
mountPath: /home/coder
|
2021-05-15 04:59:01 +08:00
|
|
|
{{- if .Values.extraInitContainers }}
|
|
|
|
{{ tpl .Values.extraInitContainers . | indent 6}}
|
|
|
|
{{- end }}
|
2020-09-03 03:41:58 +08:00
|
|
|
{{- end }}
|
|
|
|
containers:
|
|
|
|
{{- if .Values.extraContainers }}
|
2021-05-15 04:59:01 +08:00
|
|
|
{{ tpl .Values.extraContainers . | indent 8}}
|
2020-09-03 03:41:58 +08:00
|
|
|
{{- end }}
|
|
|
|
- name: {{ .Chart.Name }}
|
|
|
|
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
|
|
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
|
|
|
{{- if .Values.securityContext.enabled }}
|
|
|
|
securityContext:
|
|
|
|
runAsUser: {{ .Values.securityContext.runAsUser }}
|
|
|
|
{{- end }}
|
|
|
|
env:
|
|
|
|
{{- if .Values.extraVars }}
|
|
|
|
{{ toYaml .Values.extraVars | indent 10 }}
|
|
|
|
{{- end }}
|
|
|
|
- name: PASSWORD
|
|
|
|
valueFrom:
|
|
|
|
secretKeyRef:
|
|
|
|
{{- if .Values.existingSecret }}
|
|
|
|
name: {{ .Values.existingSecret }}
|
|
|
|
{{- else }}
|
|
|
|
name: {{ template "code-server.fullname" . }}
|
|
|
|
{{- end }}
|
|
|
|
key: password
|
|
|
|
{{- if .Values.extraArgs }}
|
|
|
|
args:
|
|
|
|
{{ toYaml .Values.extraArgs | indent 10 }}
|
|
|
|
{{- end }}
|
|
|
|
volumeMounts:
|
|
|
|
- name: data
|
2020-10-12 20:50:43 +08:00
|
|
|
mountPath: /home/coder
|
2020-09-03 03:41:58 +08:00
|
|
|
{{- range .Values.extraConfigmapMounts }}
|
2020-10-12 18:49:21 +08:00
|
|
|
- name: {{ .name }}
|
|
|
|
mountPath: {{ .mountPath }}
|
|
|
|
subPath: {{ .subPath | default "" }}
|
|
|
|
readOnly: {{ .readOnly }}
|
2020-09-03 03:41:58 +08:00
|
|
|
{{- end }}
|
|
|
|
{{- range .Values.extraSecretMounts }}
|
2020-10-12 18:49:21 +08:00
|
|
|
- name: {{ .name }}
|
|
|
|
mountPath: {{ .mountPath }}
|
|
|
|
readOnly: {{ .readOnly }}
|
2020-09-03 03:41:58 +08:00
|
|
|
{{- end }}
|
|
|
|
{{- range .Values.extraVolumeMounts }}
|
2020-10-12 18:49:21 +08:00
|
|
|
- name: {{ .name }}
|
|
|
|
mountPath: {{ .mountPath }}
|
|
|
|
subPath: {{ .subPath | default "" }}
|
|
|
|
readOnly: {{ .readOnly }}
|
2020-09-03 03:41:58 +08:00
|
|
|
{{- end }}
|
|
|
|
ports:
|
|
|
|
- name: http
|
2020-09-03 04:53:52 +08:00
|
|
|
containerPort: 8080
|
2020-09-03 03:41:58 +08:00
|
|
|
protocol: TCP
|
|
|
|
livenessProbe:
|
|
|
|
httpGet:
|
|
|
|
path: /
|
|
|
|
port: http
|
|
|
|
readinessProbe:
|
|
|
|
httpGet:
|
|
|
|
path: /
|
|
|
|
port: http
|
|
|
|
resources:
|
|
|
|
{{- toYaml .Values.resources | nindent 12 }}
|
|
|
|
{{- with .Values.nodeSelector }}
|
|
|
|
nodeSelector:
|
|
|
|
{{- toYaml . | nindent 8 }}
|
|
|
|
{{- end }}
|
|
|
|
{{- with .Values.affinity }}
|
|
|
|
affinity:
|
|
|
|
{{- toYaml . | nindent 8 }}
|
|
|
|
{{- end }}
|
|
|
|
{{- with .Values.tolerations }}
|
|
|
|
tolerations:
|
|
|
|
{{- toYaml . | nindent 8 }}
|
|
|
|
{{- end }}
|
|
|
|
serviceAccountName: {{ template "code-server.serviceAccountName" . }}
|
|
|
|
volumes:
|
|
|
|
- name: data
|
|
|
|
{{- if .Values.persistence.enabled }}
|
2020-10-12 19:59:53 +08:00
|
|
|
{{- if not .Values.persistence.hostPath }}
|
2020-09-03 03:41:58 +08:00
|
|
|
persistentVolumeClaim:
|
|
|
|
claimName: {{ .Values.persistence.existingClaim | default (include "code-server.fullname" .) }}
|
2020-10-12 19:59:53 +08:00
|
|
|
{{- else }}
|
|
|
|
hostPath:
|
|
|
|
path: {{ .Values.persistence.hostPath }}
|
|
|
|
type: Directory
|
|
|
|
{{- end -}}
|
2020-09-03 03:41:58 +08:00
|
|
|
{{- else }}
|
|
|
|
emptyDir: {}
|
|
|
|
{{- end -}}
|
|
|
|
{{- range .Values.extraSecretMounts }}
|
2020-10-12 19:59:53 +08:00
|
|
|
- name: {{ .name }}
|
|
|
|
secret:
|
|
|
|
secretName: {{ .secretName }}
|
|
|
|
defaultMode: {{ .defaultMode }}
|
2020-09-03 03:41:58 +08:00
|
|
|
{{- end }}
|
2021-11-13 01:10:47 +08:00
|
|
|
{{- range .Values.extraConfigmapMounts }}
|
|
|
|
- name: {{ .name }}
|
|
|
|
configMap:
|
|
|
|
name: {{ .configMap }}
|
|
|
|
defaultMode: {{ .defaultMode }}
|
|
|
|
{{- end }}
|
2020-09-03 03:41:58 +08:00
|
|
|
{{- range .Values.extraVolumeMounts }}
|
2020-10-12 19:59:53 +08:00
|
|
|
- name: {{ .name }}
|
|
|
|
{{- if .existingClaim }}
|
|
|
|
persistentVolumeClaim:
|
|
|
|
claimName: {{ .existingClaim }}
|
|
|
|
{{- else }}
|
|
|
|
hostPath:
|
|
|
|
path: {{ .hostPath }}
|
|
|
|
type: Directory
|
|
|
|
{{- end }}
|
2020-09-03 03:41:58 +08:00
|
|
|
{{- end }}
|