Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add ability to set custom namespace #478

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions deploy/chart/local-path-provisioner/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ Create chart name and version as used by the chart label.
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{- define "local-path-provisioner.namespace" -}}
{{- if .Values.namespaceOverride }}
{{- .Values.namespaceOverride }}
{{- else }}
{{- .Release.Namespace }}
{{- end }}
{{- end -}}

{{/*
Common labels
*/}}
Expand Down
5 changes: 2 additions & 3 deletions deploy/chart/local-path-provisioner/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Values.configmap.name }}
namespace: {{ .Release.Namespace }}
namespace: {{ include "local-path-provisioner.namespace" . }}
labels:
{{ include "local-path-provisioner.labels" . | indent 4 }}
data:
Expand Down Expand Up @@ -38,7 +38,7 @@ data:
kind: Pod
metadata:
name: {{ .Values.configmap.helperPod.name }}
namespace: {{ default .Release.Namespace .Values.configmap.helperPod.namespaceOverride }}
namespace: {{ default (include "local-path-provisioner.namespace" .) .Values.configmap.helperPod.namespaceOverride }}
{{- with .Values.configmap.helperPod.annotations }}
annotations:
{{- toYaml . | nindent 8 }}
Expand All @@ -59,4 +59,3 @@ data:
imagePullPolicy: {{ .Values.image.pullPolicy }}
resources:
{{- toYaml .Values.helperPod.resources | nindent 12 }}

4 changes: 2 additions & 2 deletions deploy/chart/local-path-provisioner/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "local-path-provisioner.fullname" . }}
namespace: {{ .Release.Namespace }}
namespace: {{ include "local-path-provisioner.namespace" . }}
labels:
{{ include "local-path-provisioner.labels" . | indent 4 }}
spec:
Expand Down Expand Up @@ -72,7 +72,7 @@ spec:
mountPath: /etc/config/
env:
- name: POD_NAMESPACE
value: {{ .Release.Namespace }}
value: {{ include "local-path-provisioner.namespace" . }}
- name: CONFIG_MOUNT_PATH
value: /etc/config/
resources:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: v1
kind: Secret
metadata:
name: {{ .Values.defaultSettings.registrySecret }}
namespace: {{ .Release.Namespace }}
namespace: {{ include "local-path-provisioner.namespace" . }}
type: kubernetes.io/dockerconfigjson
data:
.dockerconfigjson: {{ template "local-path-provisioner.secret" . }}
Expand Down
2 changes: 1 addition & 1 deletion deploy/chart/local-path-provisioner/templates/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: {{ include "local-path-provisioner.fullname" . }}
namespace: {{ .Release.Namespace }}
namespace: {{ include "local-path-provisioner.namespace" . }}
labels:
{{ include "local-path-provisioner.labels" . | indent 4 }}
rules:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: {{ include "local-path-provisioner.fullname" . }}
namespace: {{ .Release.Namespace }}
namespace: {{ include "local-path-provisioner.namespace" . }}
labels:
{{ include "local-path-provisioner.labels" . | indent 4 }}
roleRef:
Expand All @@ -13,5 +13,5 @@ roleRef:
subjects:
- kind: ServiceAccount
name: {{ template "local-path-provisioner.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
namespace: {{ include "local-path-provisioner.namespace" . }}
{{- end -}}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ template "local-path-provisioner.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
namespace: {{ include "local-path-provisioner.namespace" . }}
labels:
{{ include "local-path-provisioner.labels" . | indent 4 }}
imagePullSecrets:
Expand Down
2 changes: 1 addition & 1 deletion deploy/chart/local-path-provisioner/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

replicaCount: 1
commonLabels: {}
namespace: local-path-provisioner

image:
repository: rancher/local-path-provisioner
Expand Down Expand Up @@ -162,7 +163,6 @@ configmap:
namespaceOverride: ""
name: "helper-pod"
annotations: {}

# Number of provisioner worker threads to call provision/delete simultaneously.
# workerThreads: 4

Expand Down