Enable global config for clusterName, trustDomain, and bundleConfigMap (#156)

This commit is contained in:
kfox1111
2023-04-02 19:28:49 +02:00
committed by GitHub
parent b54c41aee0
commit 87904164ad
13 changed files with 92 additions and 33 deletions
@@ -103,3 +103,27 @@ Create the name of the service account to use
{{- define "spire-agent.socket-path" -}}
{{- print .Values.socketPath }}
{{- end }}
{{- define "spire-agent.cluster-name" }}
{{- if ne (len (dig "spire" "clusterName" "" .Values.global)) 0 }}
{{- .Values.global.spire.clusterName }}
{{- else }}
{{- .Values.clusterName }}
{{- end }}
{{- end }}
{{- define "spire-agent.trust-domain" }}
{{- if ne (len (dig "spire" "trustDomain" "" .Values.global)) 0 }}
{{- .Values.global.spire.trustDomain }}
{{- else }}
{{- .Values.trustDomain }}
{{- end }}
{{- end }}
{{- define "spire-agent.bundle-configmap" }}
{{- if ne (len (dig "spire" "bundleConfigMap" "" .Values.global)) 0 }}
{{- .Values.global.spire.bundleConfigMap }}
{{- else }}
{{- .Values.bundleConfigMap }}
{{- end }}
{{- end }}
@@ -12,13 +12,13 @@ data:
server_port = {{ .Values.server.port | quote }}
socket_path = {{ include "spire-agent.socket-path" . | quote }}
trust_bundle_path = "/run/spire/bundle/bundle.crt"
trust_domain = {{ .Values.trustDomain | quote }}
trust_domain = {{ include "spire-agent.trust-domain" . | quote }}
}
plugins {
NodeAttestor "k8s_psat" {
plugin_data {
cluster = {{ .Values.clusterName | quote }}
cluster = {{ include "spire-agent.cluster-name" . | quote }}
}
}
@@ -100,7 +100,7 @@ spec:
name: {{ include "spire-agent.fullname" . }}
- name: spire-bundle
configMap:
name: {{ .Values.bundleConfigMap }}
name: {{ include "spire-agent.bundle-configmap" . }}
- name: spire-token
projected:
sources: