From 3c961dadc6b7ee5432af4cd1131e11d2aea0c30a Mon Sep 17 00:00:00 2001 From: egvimo Date: Tue, 16 Dec 2025 21:26:00 +0100 Subject: [PATCH] Improve helm chart --- ci/helm-chart/templates/deployment.yaml | 15 +++++---------- ci/helm-chart/templates/pvc.yaml | 5 +---- ci/helm-chart/templates/secrets.yaml | 5 +---- ci/helm-chart/templates/service.yaml | 5 +---- ci/helm-chart/templates/serviceaccount.yaml | 5 +---- .../templates/tests/test-connection.yaml | 9 +++------ 6 files changed, 12 insertions(+), 32 deletions(-) diff --git a/ci/helm-chart/templates/deployment.yaml b/ci/helm-chart/templates/deployment.yaml index 8f6fd89a5800..e0e8989e5514 100644 --- a/ci/helm-chart/templates/deployment.yaml +++ b/ci/helm-chart/templates/deployment.yaml @@ -3,10 +3,7 @@ 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 }} + {{- include "code-server.labels" . | nindent 4 }} {{- if .Values.annotations }} annotations: {{- toYaml .Values.annotations | nindent 4 }} {{- end }} @@ -16,13 +13,11 @@ spec: type: Recreate selector: matchLabels: - app.kubernetes.io/name: {{ include "code-server.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} + {{- include "code-server.selectorLabels" . | nindent 6 }} template: metadata: labels: - app.kubernetes.io/name: {{ include "code-server.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} + {{- include "code-server.selectorLabels" . | nindent 8 }} {{- if .Values.podAnnotations }} annotations: {{- toYaml .Values.podAnnotations | nindent 8 }} {{- end }} @@ -130,11 +125,11 @@ spec: {{- end }} livenessProbe: httpGet: - path: / + path: /healthz port: http readinessProbe: httpGet: - path: / + path: /healthz port: http resources: {{- toYaml .Values.resources | nindent 12 }} diff --git a/ci/helm-chart/templates/pvc.yaml b/ci/helm-chart/templates/pvc.yaml index 2f1c87405886..206b834e930d 100644 --- a/ci/helm-chart/templates/pvc.yaml +++ b/ci/helm-chart/templates/pvc.yaml @@ -9,10 +9,7 @@ metadata: {{ toYaml . | indent 4 }} {{- end }} 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 }} + {{- include "code-server.labels" . | nindent 4 }} spec: accessModes: - {{ .Values.persistence.accessMode | quote }} diff --git a/ci/helm-chart/templates/secrets.yaml b/ci/helm-chart/templates/secrets.yaml index ae59be450743..93e75800dffd 100644 --- a/ci/helm-chart/templates/secrets.yaml +++ b/ci/helm-chart/templates/secrets.yaml @@ -6,10 +6,7 @@ metadata: annotations: "helm.sh/hook": "pre-install" 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 }} + {{- include "code-server.labels" . | nindent 4 }} type: Opaque data: {{- if .Values.password }} diff --git a/ci/helm-chart/templates/service.yaml b/ci/helm-chart/templates/service.yaml index d5a3c5e8ab38..1b58af0b1acd 100644 --- a/ci/helm-chart/templates/service.yaml +++ b/ci/helm-chart/templates/service.yaml @@ -3,10 +3,7 @@ kind: Service 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 }} + {{- include "code-server.labels" . | nindent 4 }} spec: type: {{ .Values.service.type }} ports: diff --git a/ci/helm-chart/templates/serviceaccount.yaml b/ci/helm-chart/templates/serviceaccount.yaml index df9e1e37562b..2fa308fec172 100644 --- a/ci/helm-chart/templates/serviceaccount.yaml +++ b/ci/helm-chart/templates/serviceaccount.yaml @@ -3,9 +3,6 @@ apiVersion: v1 kind: ServiceAccount metadata: 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 }} + {{- include "code-server.labels" . | nindent 4 }} name: {{ template "code-server.serviceAccountName" . }} {{- end -}} diff --git a/ci/helm-chart/templates/tests/test-connection.yaml b/ci/helm-chart/templates/tests/test-connection.yaml index 2e67f56ec64c..dd81f8904e06 100644 --- a/ci/helm-chart/templates/tests/test-connection.yaml +++ b/ci/helm-chart/templates/tests/test-connection.yaml @@ -3,16 +3,13 @@ kind: Pod metadata: name: "{{ include "code-server.fullname" . }}-test-connection" 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 }} + {{- include "code-server.labels" . | nindent 4 }} annotations: - "helm.sh/hook": test-success + "helm.sh/hook": test spec: containers: - name: wget image: busybox command: ['wget'] - args: ['{{ include "code-server.fullname" . }}:{{ .Values.service.port }}'] + args: ['{{ include "code-server.fullname" . }}:{{ .Values.service.port }}/healthz'] restartPolicy: Never