Skip to content

Commit

Permalink
Added namespaceOverride value
Browse files Browse the repository at this point in the history
  • Loading branch information
Flyffies authored Sep 8, 2023
1 parent bb1dd92 commit ce0209b
Show file tree
Hide file tree
Showing 14 changed files with 30 additions and 0 deletions.
11 changes: 11 additions & 0 deletions deploy/charts/x509-certificate-exporter/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,17 @@ If release name contains chart name it will be used as a full name.
{{- end -}}
{{- end -}}

{{/*
Allow the release namespace to be overridden for multi-namespace deployments in combined charts
*/}}
{{- define "x509-certificate-exporter.namespace" -}}
{{- if .Values.namespaceOverride }}
{{- .Values.namespaceOverride }}
{{- else }}
{{- .Release.Namespace }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ apiVersion: {{ include "capabilities.rbac.apiVersion" . }}
kind: ClusterRole
metadata:
name: {{ include "x509-certificate-exporter.secretsExporterClusterRoleName" . }}
namespace: {{ include "x509-certificate-exporter.namespace" . }}
labels:
{{- include "x509-certificate-exporter.labels" . | nindent 4 }}
{{- with .Values.rbac.secretsExporter.clusterRoleAnnotations }}
Expand Down Expand Up @@ -59,6 +60,7 @@ apiVersion: {{ include "capabilities.rbac.apiVersion" . }}
kind: ClusterRole
metadata:
name: {{ include "x509-certificate-exporter.hostPathsExporterClusterRoleName" . }}
namespace: {{ include "x509-certificate-exporter.namespace" . }}
labels:
{{- include "x509-certificate-exporter.labels" . | nindent 4 }}
{{- with .Values.rbac.hostPathsExporter.clusterRoleAnnotations }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ apiVersion: {{ include "capabilities.rbac.apiVersion" . }}
kind: ClusterRoleBinding
metadata:
name: {{ include "x509-certificate-exporter.secretsExporterClusterRoleBindingName" . }}
namespace: {{ include "x509-certificate-exporter.namespace" . }}
labels:
{{- include "x509-certificate-exporter.labels" . | nindent 4 }}
{{- with .Values.rbac.secretsExporter.clusterRoleBindingAnnotations }}
Expand All @@ -26,6 +27,7 @@ apiVersion: {{ include "capabilities.rbac.apiVersion" . }}
kind: ClusterRoleBinding
metadata:
name: {{ include "x509-certificate-exporter.hostPathsExporterClusterRoleBindingName" . }}
namespace: {{ include "x509-certificate-exporter.namespace" . }}
labels:
{{- include "x509-certificate-exporter.labels" . | nindent 4 }}
{{- with .Values.rbac.hostPathsExporter.clusterRoleBindingAnnotations }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ apiVersion: apps/v1
kind: DaemonSet
metadata:
name: {{ printf "%s-%s" (include "x509-certificate-exporter.fullname" $) $dsName }}
namespace: {{ include "x509-certificate-exporter.namespace" . }}
labels:
{{- include "x509-certificate-exporter.labels" $ | nindent 4 }}
spec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ apiVersion: {{ include "capabilities.deployment.apiVersion" . }}
kind: Deployment
metadata:
name: {{ include "x509-certificate-exporter.secretsExporterName" . }}
namespace: {{ include "x509-certificate-exporter.namespace" . }}
labels:
{{- include "x509-certificate-exporter.labels" . | nindent 4 }}
spec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: {{ printf "%s-%s" (include "x509-certificate-exporter.fullname" $) "dashboard" | trunc 63 | trimSuffix "-" }}
namespace: {{ include "x509-certificate-exporter.namespace" . }}
labels:
{{- include "x509-certificate-exporter.labels" . | nindent 4 }}
{{ .Values.grafana.sidecarLabel | quote }}: {{ .Values.grafana.sidecarLabelValue | quote }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
name: {{ include "x509-certificate-exporter.fullname" . }}-podmonitor
namespace: {{ include "x509-certificate-exporter.namespace" . }}
labels:
{{- include "x509-certificate-exporter.labels" . | nindent 4 }}
{{- with .Values.prometheusPodMonitor.extraLabels }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
name: {{ include "x509-certificate-exporter.fullname" . }}
namespace: {{ include "x509-certificate-exporter.namespace" . }}
labels:
{{- include "x509-certificate-exporter.labels" . | nindent 4 }}
{{- with .Values.prometheusRules.extraLabels }}
Expand Down
2 changes: 2 additions & 0 deletions deploy/charts/x509-certificate-exporter/templates/psp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ apiVersion: policy/v1beta1
kind: PodSecurityPolicy
metadata:
name: {{ include "x509-certificate-exporter.secretsExporterName" . }}
namespace: {{ include "x509-certificate-exporter.namespace" . }}
labels:
{{- include "x509-certificate-exporter.labels" . | nindent 4 }}
spec:
Expand Down Expand Up @@ -40,6 +41,7 @@ apiVersion: policy/v1beta1
kind: PodSecurityPolicy
metadata:
name: {{ printf "%s-%s" (include "x509-certificate-exporter.fullname" $) $dsName }}
namespace: {{ include "x509-certificate-exporter.namespace" . }}
labels:
{{- include "x509-certificate-exporter.labels" $ | nindent 4 }}
spec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: v1
kind: Service
metadata:
name: {{ include "x509-certificate-exporter.fullname" . }}
namespace: {{ include "x509-certificate-exporter.namespace" . }}
labels:
{{- include "x509-certificate-exporter.labels" . | nindent 4 }}
{{- with .Values.service.extraLabels }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "x509-certificate-exporter.secretsExporterServiceAccountName" . }}
namespace: {{ include "x509-certificate-exporter.namespace" . }}
labels:
{{- include "x509-certificate-exporter.labels" . | nindent 4 }}
{{- with .Values.rbac.secretsExporter.serviceAccountAnnotations }}
Expand All @@ -18,6 +19,7 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "x509-certificate-exporter.hostPathsExporterServiceAccountName" . }}
namespace: {{ include "x509-certificate-exporter.namespace" . }}
labels:
{{- include "x509-certificate-exporter.labels" . | nindent 4 }}
{{- with .Values.rbac.hostPathsExporter.serviceAccountAnnotations }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ include "x509-certificate-exporter.fullname" . }}
namespace: {{ include "x509-certificate-exporter.namespace" . }}
labels:
{{- include "x509-certificate-exporter.labels" . | nindent 4 }}
{{- with .Values.prometheusServiceMonitor.extraLabels }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: v1
kind: Secret
metadata:
name: {{ include "x509-certificate-exporter.webConfigurationSecretName" . }}
namespace: {{ include "x509-certificate-exporter.namespace" . }}
labels:
{{- include "x509-certificate-exporter.labels" . | nindent 4 }}
data:
Expand Down
3 changes: 3 additions & 0 deletions deploy/charts/x509-certificate-exporter/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ nameOverride: ""
# -- Fully override x509-certificate-exporter.fullname template
fullnameOverride: ""

# -- Override the deployment namespace
namespaceOverride: ""

# -- Additional objects to deploy with the release
extraDeploy: []
# -- Same as `extraDeploy` but objects won't go through the templating engine
Expand Down

0 comments on commit ce0209b

Please sign in to comment.