fix(helm): ensure coder can be deployed in a non-default namespace (#16579)

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>
This commit is contained in:
Thomas Kosiewski
2025-02-18 12:50:35 +01:00
committed by GitHub
parent a777c2694e
commit 420855dc55
73 changed files with 6036 additions and 110 deletions
+2
View File
@@ -3,6 +3,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "coder.name" .}}
namespace: {{ .Release.Namespace }}
labels:
{{- include "coder.labels" . | nindent 4 }}
{{- with .Values.coder.labels }}
@@ -80,6 +81,7 @@ 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 }}