Add extra initContainers, containers, volumes to agent and server

With plugin support, agents and servers need more customization.
This patch enables initContainers, extraContainers, extraVolumes
and extraVolumeMounts to be added to those services.

Signed-off-by: Kevin Fox <[email protected]>
This commit is contained in:
Kevin Fox
2023-03-02 08:02:19 -08:00
committed by kfox1111
parent 81ac89a911
commit b7f8c86478
7 changed files with 106 additions and 0 deletions
@@ -16,6 +16,9 @@ A Helm chart to install the SPIRE agent.
|-----|------|---------|-------------|
| bundleConfigMap | string | `"spire-bundle"` | |
| clusterName | string | `"example-cluster"` | |
| extraContainers | list | `[]` | |
| extraVolumeMounts | list | `[]` | |
| extraVolumes | list | `[]` | |
| fullnameOverride | string | `""` | |
| healthChecks.port | int | `9980` | override the host port used for health checking |
| image.pullPolicy | string | `"IfNotPresent"` | |
@@ -23,6 +26,7 @@ A Helm chart to install the SPIRE agent.
| image.repository | string | `"spiffe/spire-agent"` | |
| image.version | string | `""` | |
| imagePullSecrets | list | `[]` | |
| initContainers | list | `[]` | |
| logLevel | string | `"info"` | |
| nameOverride | string | `""` | |
| nodeSelector | object | `{}` | |
@@ -43,6 +43,9 @@ spec:
args: ["-t", "30", "-h", "{{ .Release.Name }}-server", "-p", {{ .Values.server.port | quote }}]
resources:
{{- toYaml .Values.waitForIt.resources | nindent 12 }}
{{- if gt (len .Values.initContainers) 0 }}
{{- toYaml .Values.initContainers | nindent 8 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
image: {{ template "spire-agent.image" (dict "appVersion" $.Chart.AppVersion "image" .Values.image) }}
@@ -67,6 +70,9 @@ spec:
readOnly: false
- name: spire-token
mountPath: /var/run/secrets/tokens
{{- if gt (len .Values.extraVolumeMounts) 0 }}
{{- toYaml .Values.extraVolumeMounts | nindent 12 }}
{{- end }}
livenessProbe:
httpGet:
path: /live
@@ -81,6 +87,9 @@ spec:
periodSeconds: 60
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- if gt (len .Values.extraContainers) 0 }}
{{- toYaml .Values.extraContainers | nindent 8 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
@@ -103,3 +112,6 @@ spec:
hostPath:
path: {{ include "spire.agent-socket-path" . | dir }}
type: DirectoryOrCreate
{{- if gt (len .Values.extraVolumes) 0 }}
{{- toYaml .Values.extraVolumes | nindent 8 }}
{{- end }}
@@ -86,3 +86,9 @@ telemetry:
# -- Priority class assigned to daemonset pods
priorityClassName: ""
extraVolumes: []
extraVolumeMounts: []
extraContainers: []
initContainers: []
@@ -49,12 +49,16 @@ A Helm chart to install the SPIRE server.
| dataStorage.enabled | bool | `true` | |
| dataStorage.size | string | `"1Gi"` | |
| dataStorage.storageClass | string | `nil` | |
| extraContainers | list | `[]` | |
| extraVolumeMounts | list | `[]` | |
| extraVolumes | list | `[]` | |
| fullnameOverride | string | `""` | |
| image.pullPolicy | string | `"IfNotPresent"` | |
| image.registry | string | `"ghcr.io"` | |
| image.repository | string | `"spiffe/spire-server"` | |
| image.version | string | `""` | |
| imagePullSecrets | list | `[]` | |
| initContainers | list | `[]` | |
| jwtIssuer | string | `"oidc-discovery.example.org"` | |
| logLevel | string | `"info"` | |
| nameOverride | string | `""` | |
@@ -32,6 +32,10 @@ spec:
shareProcessNamespace: true
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
{{- if gt (len .Values.initContainers) 0 }}
initContainers:
{{- toYaml .Values.initContainers | nindent 8 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
securityContext:
@@ -87,6 +91,9 @@ spec:
mountPath: /run/spire/upstream_ca
readOnly: false
{{ end }}
{{- if gt (len .Values.extraVolumeMounts) 0 }}
{{- toYaml .Values.extraVolumeMounts | nindent 12 }}
{{- end }}
{{- if eq (.Values.controllerManager.enabled | toString) "true" }}
- name: spire-controller-manager
securityContext:
@@ -124,6 +131,9 @@ spec:
subPath: controller-manager-config.yaml
readOnly: true
{{- end }}
{{- if gt (len .Values.extraContainers) 0 }}
{{- toYaml .Values.extraContainers | nindent 8 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
@@ -156,6 +166,9 @@ spec:
configMap:
name: {{ include "spire-controller-manager.fullname" . }}
{{- end }}
{{- if gt (len .Values.extraVolumes) 0 }}
{{- toYaml .Values.extraVolumes | nindent 8 }}
{{- end }}
volumeClaimTemplates:
{{- if eq (.Values.dataStorage.enabled | toString) "true" }}
- metadata:
@@ -161,3 +161,9 @@ controllerManager:
telemetry:
prometheus:
enabled: false
extraVolumes: []
extraVolumeMounts: []
extraContainers: []
initContainers: []