Skip to content

Commit e38fd78

Browse files
authored
PMM-13725 Allow specifying namespace. (#483)
* PMM-13725 Allow specifying namespace. * PMM-13725 update helm chart version.
1 parent c152ee3 commit e38fd78

11 files changed

+25
-3
lines changed

charts/pmm/templates/_helpers.tpl

+7
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ Create chart name and version as used by the chart label.
3030
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
3131
{{- end }}
3232

33+
{{/*
34+
Allows overriding the install namespace in combined charts.
35+
*/}}
36+
{{- define "pmm.namespace" -}}
37+
{{- default .Release.Namespace .Values.namespaceOverride | trunc 63 | trimSuffix "-" }}
38+
{{- end }}
39+
3340
{{/*
3441
Common labels
3542
*/}}

charts/pmm/templates/clusterrole.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ apiVersion: rbac.authorization.k8s.io/v1
33
kind: ClusterRole
44
metadata:
55
name: {{ include "pmm.fullname" . }}
6+
namespace: {{ include "pmm.namespace" . }}
67
labels:
78
{{- include "pmm.labels" . | nindent 4 }}
89
rules:

charts/pmm/templates/clusterrolebinding.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ roleRef:
1111
subjects:
1212
- kind: ServiceAccount
1313
name: {{ include "pmm.serviceAccountName" . }}
14-
namespace: {{ .Release.Namespace }}
14+
namespace: {{ include "pmm.namespace" . }}
1515
{{- else }}
1616
apiVersion: rbac.authorization.k8s.io/v1
1717
kind: ClusterRoleBinding
@@ -24,6 +24,6 @@ roleRef:
2424
subjects:
2525
- kind: ServiceAccount
2626
name: {{ include "pmm.serviceAccountName" . }}
27-
namespace: {{ .Release.Namespace }}
27+
namespace: {{ include "pmm.namespace" . }}
2828
{{- end }}
2929
{{- end }}

charts/pmm/templates/configmap.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ apiVersion: v1
33
kind: ConfigMap
44
metadata:
55
name: {{ include "pmm.fullname" . }}
6+
namespace: {{ include "pmm.namespace" . }}
67
labels:
78
{{- include "pmm.labels" . | nindent 4 }}
89
data:

charts/pmm/templates/ingress.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ apiVersion: networking.k8s.io/v1
77
kind: Ingress
88
metadata:
99
name: {{ include "pmm.fullname" . }}
10+
namespace: {{ include "pmm.namespace" . }}
1011
labels:
1112
{{- include "pmm.labels" . | nindent 4 }}
1213
{{- if or .Values.ingress.annotations .Values.ingress.nginxInc }}
@@ -84,6 +85,7 @@ apiVersion: networking.k8s.io/v1
8485
kind: Ingress
8586
metadata:
8687
name: {{ include "pmm.fullname" . }}-grpc
88+
namespace: {{ include "pmm.namespace" . }}
8789
labels:
8890
{{- include "pmm.labels" . | nindent 4 }}
8991
annotations:

charts/pmm/templates/secret-certs.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ apiVersion: v1
33
kind: Secret
44
metadata:
55
name: {{ .Values.certs.name }}
6+
namespace: {{ include "pmm.namespace" . }}
67
labels:
78
{{- include "pmm.labels" . | nindent 4 }}
89
{{- with .Values.serviceAccount.annotations }}

charts/pmm/templates/secret.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ apiVersion: v1
33
kind: Secret
44
metadata:
55
name: {{ .Values.secret.name }}
6+
namespace: {{ include "pmm.namespace" . }}
67
labels:
78
{{- include "pmm.labels" . | nindent 4 }}
89
{{- with .Values.secret.annotations }}

charts/pmm/templates/service.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ apiVersion: v1
33
kind: Service
44
metadata:
55
name: {{ .Values.service.name }}
6+
namespace: {{ include "pmm.namespace" . }}
67
labels:
78
{{- include "pmm.labels" . | nindent 4 }}
89
{{- with .Values.service.annotations }}

charts/pmm/templates/serviceaccount.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ apiVersion: v1
33
kind: ServiceAccount
44
metadata:
55
name: {{ include "pmm.serviceAccountName" . }}
6+
namespace: {{ include "pmm.namespace" . }}
67
labels:
78
{{- include "pmm.labels" . | nindent 4 }}
89
{{- with .Values.serviceAccount.annotations }}

charts/pmm/templates/statefulset.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ apiVersion: apps/v1
22
kind: StatefulSet
33
metadata:
44
name: {{ include "pmm.fullname" . }}
5+
namespace: {{ include "pmm.namespace" . }}
56
labels:
67
{{- include "pmm.labels" . | nindent 4 }}
78
spec:
@@ -16,6 +17,7 @@ spec:
1617
metadata:
1718
annotations:
1819
{{- include "pmm.podAnnotations" . | nindent 8 }}
20+
namespace: {{ include "pmm.namespace" . }}
1921
labels:
2022
{{- include "pmm.selectorLabels" . | nindent 8 }}
2123
spec:
@@ -124,6 +126,7 @@ spec:
124126
kind: PersistentVolumeClaim
125127
metadata:
126128
name: {{ .Values.storage.name }}
129+
namespace: {{ include "pmm.namespace" . }}
127130
spec:
128131
{{- if .Values.storage.selector }}
129132
selector:

charts/pmm/values.yaml

+5-1
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,10 @@ storage:
200200
##
201201
nameOverride: ""
202202

203+
## @param namespaceOverride String to override namespace. Defaults to the value of .Release.Namespace.
204+
##
205+
namespaceOverride: ""
206+
203207
## @param extraLabels Labels to add to all deployed objects
204208
##
205209
extraLabels: {}
@@ -211,7 +215,7 @@ extraLabels: {}
211215
## @param serviceAccount.name Name of the service account to use. If not set and create is true, a name is generated using the fullname template.
212216
##
213217
serviceAccount:
214-
create: true
218+
create: false
215219
annotations: {}
216220
name: "pmm-service-account"
217221

0 commit comments

Comments
 (0)