Skip to content

Commit 0f9621c

Browse files
committed
add namespace when templating helm chart
Signed-off-by: Rahul Sharma <[email protected]>
1 parent 6519029 commit 0f9621c

File tree

5 files changed

+9
-0
lines changed

5 files changed

+9
-0
lines changed

deployments/gpu-operator/templates/_helpers.tpl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ Expand the name of the chart.
66
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
77
{{- end -}}
88

9+
{{- define "gpu-operator.namespace" -}}
10+
{{- default .Release.Namespace .Values.namespaceOverride | trunc 63 | trimSuffix "-" -}}
11+
{{- end -}}
12+
913
{{/*
1014
Create a default fully qualified app name.
1115
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
@@ -37,6 +41,7 @@ Common labels
3741

3842
{{- define "gpu-operator.labels" -}}
3943
app.kubernetes.io/name: {{ include "gpu-operator.name" . }}
44+
app.kubernetes.io/namespace: {{ include "gpu-operator.namespace" . }}
4045
helm.sh/chart: {{ include "gpu-operator.chart" . }}
4146
app.kubernetes.io/instance: {{ .Release.Name }}
4247
{{- if .Chart.AppVersion }}

deployments/gpu-operator/templates/operator.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ apiVersion: apps/v1
22
kind: Deployment
33
metadata:
44
name: gpu-operator
5+
namespace: {{ include "gpu-operator.namespace" . }}
56
labels:
67
{{- include "gpu-operator.labels" . | nindent 4 }}
78
app.kubernetes.io/component: "gpu-operator"

deployments/gpu-operator/templates/role.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ apiVersion: rbac.authorization.k8s.io/v1
22
kind: Role
33
metadata:
44
name: gpu-operator
5+
namespace: {{ include "gpu-operator.namespace" . }}
56
labels:
67
{{- include "gpu-operator.labels" . | nindent 4 }}
78
app.kubernetes.io/component: "gpu-operator"

deployments/gpu-operator/templates/rolebinding.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ kind: RoleBinding
22
apiVersion: rbac.authorization.k8s.io/v1
33
metadata:
44
name: gpu-operator
5+
namespace: {{ include "gpu-operator.namespace" . }}
56
labels:
67
{{- include "gpu-operator.labels" . | nindent 4 }}
78
app.kubernetes.io/component: "gpu-operator"

deployments/gpu-operator/templates/serviceaccount.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ apiVersion: v1
22
kind: ServiceAccount
33
metadata:
44
name: gpu-operator
5+
namespace: {{ include "gpu-operator.namespace" . }}
56
labels:
67
{{- include "gpu-operator.labels" . | nindent 4 }}
78
app.kubernetes.io/component: "gpu-operator"

0 commit comments

Comments
 (0)