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
+61
View File
@@ -0,0 +1,61 @@
spire-agent:
initContainers:
- name: extra-init
image: busybox
command:
- sh
- -xec
- |
echo 'hi there' > /extra/file
volumeMounts:
- name: extra
mountPath: /extra
extraContainers:
- name: extra
image: busybox
command:
- sh
- -xec
- |
[ -f /extra/file ]
while true; do sleep 1000; done
volumeMounts:
- name: extra
mountPath: /extra
extraVolumeMounts:
- name: extra
mountPath: /extra
extraVolumes:
- name: extra
emptyDir: {}
spire-server:
initContainers:
- name: extra-init
image: busybox
command:
- sh
- -xec
- |
echo 'hi there' > /extra/file
volumeMounts:
- name: extra
mountPath: /extra
extraContainers:
- name: extra
image: busybox
command:
- sh
- -xec
- |
[ -f /extra/file ]
while true; do sleep 1000; done
volumeMounts:
- name: extra
mountPath: /extra
extraVolumeMounts:
- name: extra
mountPath: /extra
extraVolumes:
- name: extra
emptyDir: {}
@@ -16,6 +16,9 @@ A Helm chart to install the SPIRE agent.
|-----|------|---------|-------------| |-----|------|---------|-------------|
| bundleConfigMap | string | `"spire-bundle"` | | | bundleConfigMap | string | `"spire-bundle"` | |
| clusterName | string | `"example-cluster"` | | | clusterName | string | `"example-cluster"` | |
| extraContainers | list | `[]` | |
| extraVolumeMounts | list | `[]` | |
| extraVolumes | list | `[]` | |
| fullnameOverride | string | `""` | | | fullnameOverride | string | `""` | |
| healthChecks.port | int | `9980` | override the host port used for health checking | | healthChecks.port | int | `9980` | override the host port used for health checking |
| image.pullPolicy | string | `"IfNotPresent"` | | | image.pullPolicy | string | `"IfNotPresent"` | |
@@ -23,6 +26,7 @@ A Helm chart to install the SPIRE agent.
| image.repository | string | `"spiffe/spire-agent"` | | | image.repository | string | `"spiffe/spire-agent"` | |
| image.version | string | `""` | | | image.version | string | `""` | |
| imagePullSecrets | list | `[]` | | | imagePullSecrets | list | `[]` | |
| initContainers | list | `[]` | |
| logLevel | string | `"info"` | | | logLevel | string | `"info"` | |
| nameOverride | string | `""` | | | nameOverride | string | `""` | |
| nodeSelector | object | `{}` | | | nodeSelector | object | `{}` | |
@@ -43,6 +43,9 @@ spec:
args: ["-t", "30", "-h", "{{ .Release.Name }}-server", "-p", {{ .Values.server.port | quote }}] args: ["-t", "30", "-h", "{{ .Release.Name }}-server", "-p", {{ .Values.server.port | quote }}]
resources: resources:
{{- toYaml .Values.waitForIt.resources | nindent 12 }} {{- toYaml .Values.waitForIt.resources | nindent 12 }}
{{- if gt (len .Values.initContainers) 0 }}
{{- toYaml .Values.initContainers | nindent 8 }}
{{- end }}
containers: containers:
- name: {{ .Chart.Name }} - name: {{ .Chart.Name }}
image: {{ template "spire-agent.image" (dict "appVersion" $.Chart.AppVersion "image" .Values.image) }} image: {{ template "spire-agent.image" (dict "appVersion" $.Chart.AppVersion "image" .Values.image) }}
@@ -67,6 +70,9 @@ spec:
readOnly: false readOnly: false
- name: spire-token - name: spire-token
mountPath: /var/run/secrets/tokens mountPath: /var/run/secrets/tokens
{{- if gt (len .Values.extraVolumeMounts) 0 }}
{{- toYaml .Values.extraVolumeMounts | nindent 12 }}
{{- end }}
livenessProbe: livenessProbe:
httpGet: httpGet:
path: /live path: /live
@@ -81,6 +87,9 @@ spec:
periodSeconds: 60 periodSeconds: 60
resources: resources:
{{- toYaml .Values.resources | nindent 12 }} {{- toYaml .Values.resources | nindent 12 }}
{{- if gt (len .Values.extraContainers) 0 }}
{{- toYaml .Values.extraContainers | nindent 8 }}
{{- end }}
{{- with .Values.nodeSelector }} {{- with .Values.nodeSelector }}
nodeSelector: nodeSelector:
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}
@@ -103,3 +112,6 @@ spec:
hostPath: hostPath:
path: {{ include "spire.agent-socket-path" . | dir }} path: {{ include "spire.agent-socket-path" . | dir }}
type: DirectoryOrCreate 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 # -- Priority class assigned to daemonset pods
priorityClassName: "" priorityClassName: ""
extraVolumes: []
extraVolumeMounts: []
extraContainers: []
initContainers: []
@@ -49,12 +49,16 @@ A Helm chart to install the SPIRE server.
| dataStorage.enabled | bool | `true` | | | dataStorage.enabled | bool | `true` | |
| dataStorage.size | string | `"1Gi"` | | | dataStorage.size | string | `"1Gi"` | |
| dataStorage.storageClass | string | `nil` | | | dataStorage.storageClass | string | `nil` | |
| extraContainers | list | `[]` | |
| extraVolumeMounts | list | `[]` | |
| extraVolumes | list | `[]` | |
| fullnameOverride | string | `""` | | | fullnameOverride | string | `""` | |
| image.pullPolicy | string | `"IfNotPresent"` | | | image.pullPolicy | string | `"IfNotPresent"` | |
| image.registry | string | `"ghcr.io"` | | | image.registry | string | `"ghcr.io"` | |
| image.repository | string | `"spiffe/spire-server"` | | | image.repository | string | `"spiffe/spire-server"` | |
| image.version | string | `""` | | | image.version | string | `""` | |
| imagePullSecrets | list | `[]` | | | imagePullSecrets | list | `[]` | |
| initContainers | list | `[]` | |
| jwtIssuer | string | `"oidc-discovery.example.org"` | | | jwtIssuer | string | `"oidc-discovery.example.org"` | |
| logLevel | string | `"info"` | | | logLevel | string | `"info"` | |
| nameOverride | string | `""` | | | nameOverride | string | `""` | |
@@ -32,6 +32,10 @@ spec:
shareProcessNamespace: true shareProcessNamespace: true
securityContext: securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }} {{- toYaml .Values.podSecurityContext | nindent 8 }}
{{- if gt (len .Values.initContainers) 0 }}
initContainers:
{{- toYaml .Values.initContainers | nindent 8 }}
{{- end }}
containers: containers:
- name: {{ .Chart.Name }} - name: {{ .Chart.Name }}
securityContext: securityContext:
@@ -87,6 +91,9 @@ spec:
mountPath: /run/spire/upstream_ca mountPath: /run/spire/upstream_ca
readOnly: false readOnly: false
{{ end }} {{ end }}
{{- if gt (len .Values.extraVolumeMounts) 0 }}
{{- toYaml .Values.extraVolumeMounts | nindent 12 }}
{{- end }}
{{- if eq (.Values.controllerManager.enabled | toString) "true" }} {{- if eq (.Values.controllerManager.enabled | toString) "true" }}
- name: spire-controller-manager - name: spire-controller-manager
securityContext: securityContext:
@@ -124,6 +131,9 @@ spec:
subPath: controller-manager-config.yaml subPath: controller-manager-config.yaml
readOnly: true readOnly: true
{{- end }} {{- end }}
{{- if gt (len .Values.extraContainers) 0 }}
{{- toYaml .Values.extraContainers | nindent 8 }}
{{- end }}
{{- with .Values.nodeSelector }} {{- with .Values.nodeSelector }}
nodeSelector: nodeSelector:
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}
@@ -156,6 +166,9 @@ spec:
configMap: configMap:
name: {{ include "spire-controller-manager.fullname" . }} name: {{ include "spire-controller-manager.fullname" . }}
{{- end }} {{- end }}
{{- if gt (len .Values.extraVolumes) 0 }}
{{- toYaml .Values.extraVolumes | nindent 8 }}
{{- end }}
volumeClaimTemplates: volumeClaimTemplates:
{{- if eq (.Values.dataStorage.enabled | toString) "true" }} {{- if eq (.Values.dataStorage.enabled | toString) "true" }}
- metadata: - metadata:
@@ -161,3 +161,9 @@ controllerManager:
telemetry: telemetry:
prometheus: prometheus:
enabled: false enabled: false
extraVolumes: []
extraVolumeMounts: []
extraContainers: []
initContainers: []