Skip to content

Commit d3ce312

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

File tree

5 files changed

+8
-0
lines changed

5 files changed

+8
-0
lines changed

deployments/gpu-operator/templates/_helpers.tpl

Lines changed: 4 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 -}}
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).

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)