diff --git a/charts/kor/templates/_helpers.tpl b/charts/kor/templates/_helpers.tpl index f1d042fa..5106eec9 100644 --- a/charts/kor/templates/_helpers.tpl +++ b/charts/kor/templates/_helpers.tpl @@ -23,6 +23,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 "kor.namespace" -}} +{{- if .Values.namespaceOverride }} +{{- .Values.namespaceOverride }} +{{- else }} +{{- .Release.Namespace }} +{{- end }} +{{- end }} + {{/* Create chart name and version as used by the chart label. */}} diff --git a/charts/kor/templates/cronjob.yaml b/charts/kor/templates/cronjob.yaml index 67c07d7b..0a0100ef 100644 --- a/charts/kor/templates/cronjob.yaml +++ b/charts/kor/templates/cronjob.yaml @@ -22,6 +22,8 @@ spec: args: ["{{ .Values.cronJob.command }} --slack-webhook-url {{ .Values.cronJob.slackWebhookUrl }}"] {{- else if and .Values.cronJob.slackChannel .Values.cronJob.slackAuthToken }} args: ["{{ .Values.cronJob.command }} --slack-channel {{ .Values.cronJob.slackChannel }} --slack-auth-token {{ .Values.cronJob.slackAuthToken }}"] + {{- else }} + args: ["{{ .Values.cronJob.command }}"] {{- end }} {{- if .Values.cronJob.env }} env: diff --git a/charts/kor/templates/role.yaml b/charts/kor/templates/role.yaml index 288227a0..6883e5bb 100644 --- a/charts/kor/templates/role.yaml +++ b/charts/kor/templates/role.yaml @@ -3,7 +3,6 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: name: {{ include "kor.serviceAccountName" . }}-read-resources-role - namespace: {{ .Values.namespace }} rules: - apiGroups: ["*"] resources: diff --git a/charts/kor/templates/rolebinding.yaml b/charts/kor/templates/rolebinding.yaml index 9eed0c78..d39855ba 100644 --- a/charts/kor/templates/rolebinding.yaml +++ b/charts/kor/templates/rolebinding.yaml @@ -3,11 +3,9 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: name: {{ include "kor.serviceAccountName" . }}-read-resources-role-binding - namespace: {{ .Values.namespace }} subjects: - kind: ServiceAccount name: {{ include "kor.serviceAccountName" . }} - namespace: {{ .Values.namespace }} roleRef: kind: Role name: {{ include "kor.serviceAccountName" . }}-read-resources-role @@ -20,7 +18,7 @@ metadata: subjects: - kind: ServiceAccount name: {{ include "kor.serviceAccountName" . }} - namespace: {{ .Values.namespace }} + namespace: {{ include "kor.namespace" . }} roleRef: kind: ClusterRole name: {{ include "kor.serviceAccountName" . }}-read-resources-clusterrole diff --git a/charts/kor/values.yaml b/charts/kor/values.yaml index 83ce223c..d3077b22 100644 --- a/charts/kor/values.yaml +++ b/charts/kor/values.yaml @@ -1,5 +1,3 @@ -namespace: kor - cronJob: enabled: true name: kor