diff --git a/charts/code-server/Chart.yaml b/charts/code-server/Chart.yaml index d05d5870..9add19d7 100644 --- a/charts/code-server/Chart.yaml +++ b/charts/code-server/Chart.yaml @@ -15,9 +15,9 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 3.4.1 +version: 3.30.2 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to # follow Semantic Versioning. They should reflect the version the application is using. -appVersion: 4.9.1 +appVersion: 4.103.2 diff --git a/charts/code-server/templates/deployment.yaml b/charts/code-server/templates/deployment.yaml index 57dbd3ac..8f6fd89a 100644 --- a/charts/code-server/templates/deployment.yaml +++ b/charts/code-server/templates/deployment.yaml @@ -7,8 +7,11 @@ metadata: helm.sh/chart: {{ include "code-server.chart" . }} app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/managed-by: {{ .Release.Service }} + {{- if .Values.annotations }} + annotations: {{- toYaml .Values.annotations | nindent 4 }} + {{- end }} spec: - replicas: 1 + replicas: {{ .Values.replicaCount | default 1 }} strategy: type: Recreate selector: @@ -20,6 +23,9 @@ spec: labels: app.kubernetes.io/name: {{ include "code-server.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} + {{- if .Values.podAnnotations }} + annotations: {{- toYaml .Values.podAnnotations | nindent 8 }} + {{- end }} spec: imagePullSecrets: {{- toYaml .Values.imagePullSecrets | nindent 8 }} {{- if .Values.hostnameOverride }} @@ -32,8 +38,9 @@ spec: securityContext: fsGroup: {{ .Values.securityContext.fsGroup }} {{- end }} - {{- if and .Values.volumePermissions.enabled .Values.persistence.enabled }} + {{- if or (and .Values.volumePermissions.enabled .Values.persistence.enabled) .Values.extraInitContainers }} initContainers: + {{- if and .Values.volumePermissions.enabled .Values.persistence.enabled }} - name: init-chmod-data image: busybox:latest imagePullPolicy: IfNotPresent @@ -47,6 +54,7 @@ spec: volumeMounts: - name: data mountPath: /home/coder + {{- end }} {{- if .Values.extraInitContainers }} {{ tpl .Values.extraInitContainers . | indent 6}} {{- end }} @@ -102,6 +110,7 @@ spec: {{- range .Values.extraSecretMounts }} - name: {{ .name }} mountPath: {{ .mountPath }} + subPath: {{ .subPath | default "" }} readOnly: {{ .readOnly }} {{- end }} {{- range .Values.extraVolumeMounts }} @@ -114,6 +123,11 @@ spec: - name: http containerPort: 8080 protocol: TCP + {{- range .Values.extraPorts }} + - name: {{ .name }} + containerPort: {{ .port }} + protocol: {{ .protocol }} + {{- end }} livenessProbe: httpGet: path: / @@ -168,9 +182,12 @@ spec: {{- if .existingClaim }} persistentVolumeClaim: claimName: {{ .existingClaim }} - {{- else }} + {{- else if .hostPath }} hostPath: path: {{ .hostPath }} type: Directory + {{- else }} + emptyDir: + {{- toYaml .emptyDir | nindent 10 }} {{- end }} {{- end }} diff --git a/charts/code-server/templates/secrets.yaml b/charts/code-server/templates/secrets.yaml index 6c600417..ae59be45 100644 --- a/charts/code-server/templates/secrets.yaml +++ b/charts/code-server/templates/secrets.yaml @@ -1,3 +1,4 @@ +{{- if not .Values.existingSecret }} apiVersion: v1 kind: Secret metadata: @@ -11,8 +12,9 @@ metadata: app.kubernetes.io/managed-by: {{ .Release.Service }} type: Opaque data: - {{ if .Values.password }} + {{- if .Values.password }} password: "{{ .Values.password | b64enc }}" - {{ else }} + {{- else }} password: "{{ randAlphaNum 24 | b64enc }}" - {{ end }} + {{- end }} +{{- end }} diff --git a/charts/code-server/templates/service.yaml b/charts/code-server/templates/service.yaml index 038b6cd0..d5a3c5e8 100644 --- a/charts/code-server/templates/service.yaml +++ b/charts/code-server/templates/service.yaml @@ -14,6 +14,12 @@ spec: targetPort: http protocol: TCP name: http + {{- range .Values.extraPorts }} + - port: {{ .port }} + targetPort: {{ .port }} + protocol: {{ .protocol }} + name: {{ .name }} + {{- end }} selector: app.kubernetes.io/name: {{ include "code-server.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} diff --git a/charts/code-server/values.yaml b/charts/code-server/values.yaml index 9c3d4446..b6cbdaa1 100644 --- a/charts/code-server/values.yaml +++ b/charts/code-server/values.yaml @@ -6,7 +6,7 @@ replicaCount: 1 image: repository: codercom/code-server - tag: '4.9.1' + tag: '4.103.2' pullPolicy: Always # Specifies one or more secrets to be used when pulling images from a @@ -19,6 +19,9 @@ nameOverride: "" fullnameOverride: "" hostnameOverride: "" +# The existing secret to use for code-server authentication in the frontend. the password is stored in the secret under the key `password` +# existingSecret: "" + serviceAccount: # Specifies whether a service account should be created create: true @@ -28,6 +31,9 @@ serviceAccount: # If not set and create is true, a name is generated using the fullname template name: "" +# Specifies annotations for deployment +annotations: {} + podAnnotations: {} podSecurityContext: {} @@ -71,9 +77,10 @@ extraArgs: [] # Optional additional environment variables extraVars: [] # - name: DISABLE_TELEMETRY -# value: true +# value: "true" +# if dind is desired: # - name: DOCKER_HOST -# value: "tcp://localhost:2375" +# value: "tcp://localhost:2376" ## ## Init containers parameters: @@ -136,25 +143,39 @@ lifecycle: # - -c # - curl -s -L SOME_SCRIPT | bash + # for dind, the following may be helpful + # postStart: + # exec: + # command: + # - /bin/sh + # - -c + # - | + # sudo apt-get update \ + # && sudo apt-get install -y docker.io + ## Enable an Specify container in extraContainers. ## This is meant to allow adding code-server dependencies, like docker-dind. extraContainers: | # If docker-dind is used, DOCKER_HOST env is mandatory to set in "extraVars" -#- name: docker-dind -# image: docker:19.03-dind -# imagePullPolicy: IfNotPresent -# resources: -# requests: -# cpu: 250m -# memory: 256M -# securityContext: -# privileged: true -# procMount: Default -# env: -# - name: DOCKER_TLS_CERTDIR -# value: "" -# - name: DOCKER_DRIVER -# value: "overlay2" +# - name: docker-dind +# image: docker:28.3.2-dind +# imagePullPolicy: IfNotPresent +# resources: +# requests: +# cpu: 1 +# ephemeral-storage: "50Gi" +# memory: 10Gi +# securityContext: +# privileged: true +# procMount: Default +# env: +# - name: DOCKER_TLS_CERTDIR +# value: "" # disable TLS setup +# command: +# - dockerd +# - --host=unix:///var/run/docker.sock +# - --host=tcp://0.0.0.0:2376 + extraInitContainers: | # - name: customization @@ -179,6 +200,7 @@ extraInitContainers: | extraSecretMounts: [] # - name: secret-files # mountPath: /etc/secrets + # subPath: private.key # (optional) # secretName: code-server-secret-files # readOnly: true @@ -189,6 +211,7 @@ extraVolumeMounts: [] # readOnly: true # existingClaim: volume-claim # hostPath: "" + # emptyDir: {} extraConfigmapMounts: [] # - name: certs-configmap @@ -196,3 +219,8 @@ extraConfigmapMounts: [] # subPath: certificates.crt # (optional) # configMap: certs-configmap # readOnly: true + +extraPorts: [] + # - name: minecraft + # port: 25565 + # protocol: tcp