Namespace override

This patch makes it possible to install the subcharts in different
namespaces as needed.

Signed-off-by: Kevin Fox <[email protected]>
This commit is contained in:
kfox1111
2023-03-13 15:03:16 -07:00
committed by GitHub
parent 661000a29a
commit 03db6bb5fe
40 changed files with 221 additions and 58 deletions
@@ -30,6 +30,7 @@ A Helm chart to install the SPIRE agent.
| initContainers | list | `[]` | |
| logLevel | string | `"info"` | |
| nameOverride | string | `""` | |
| namespaceOverride | string | `""` | |
| nodeSelector | object | `{}` | |
| podAnnotations | object | `{}` | |
| podSecurityContext | object | `{}` | |
@@ -37,6 +38,7 @@ A Helm chart to install the SPIRE agent.
| resources | object | `{}` | |
| securityContext | object | `{}` | |
| server.address | string | `""` | |
| server.namespaceOverride | string | `""` | |
| server.port | int | `8081` | |
| serviceAccount.annotations | object | `{}` | |
| serviceAccount.create | bool | `true` | |
@@ -23,6 +23,25 @@ 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 "spire-agent.namespace" -}}
{{- if .Values.namespaceOverride -}}
{{- .Values.namespaceOverride -}}
{{- else -}}
{{- .Release.Namespace -}}
{{- end -}}
{{- end -}}
{{- define "spire-agent.server.namespace" -}}
{{- if .Values.server.namespaceOverride -}}
{{- .Values.server.namespaceOverride -}}
{{- else -}}
{{- .Release.Namespace -}}
{{- end -}}
{{- end -}}
{{/*
Create chart name and version as used by the chart label.
*/}}
@@ -77,7 +96,7 @@ Create the name of the service account to use
{{- if .Values.server.address }}
{{- .Values.server.address }}
{{- else }}
{{ .Release.Name }}-server
{{ .Release.Name }}-server.{{ include "spire-agent.server.namespace" . }}
{{- end }}
{{- end }}
@@ -2,7 +2,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "spire-agent.fullname" . }}
namespace: {{ .Release.Namespace }}
namespace: {{ include "spire-agent.namespace" . }}
data:
agent.conf: |
agent {
@@ -3,7 +3,7 @@ apiVersion: apps/v1
kind: DaemonSet
metadata:
name: {{ include "spire-agent.fullname" . }}
namespace: {{ .Release.Namespace }}
namespace: {{ include "spire-agent.namespace" . }}
labels:
{{- include "spire-agent.labels" . | nindent 4 }}
spec:
@@ -16,11 +16,10 @@ kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{ include "spire-agent.fullname" . }}
namespace: {{ .Release.Namespace }}
subjects:
- kind: ServiceAccount
name: {{ include "spire-agent.fullname" . }}
namespace: {{ .Release.Namespace }}
name: {{ include "spire-agent.serviceAccountName" . }}
namespace: {{ include "spire-agent.namespace" . }}
roleRef:
kind: ClusterRole
name: {{ include "spire-agent.fullname" . }}
@@ -3,7 +3,7 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "spire-agent.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
namespace: {{ include "spire-agent.namespace" . }}
labels:
{{- include "spire-agent.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
@@ -13,6 +13,7 @@ image:
imagePullSecrets: []
nameOverride: ""
namespaceOverride: ""
fullnameOverride: ""
serviceAccount:
@@ -60,6 +61,7 @@ bundleConfigMap: spire-bundle
server:
address: ""
port: 8081
namespaceOverride: ""
healthChecks:
# -- override the host port used for health checking