{{- $fullname := include "spire.fullname" . }} apiVersion: apps/v1 kind: StatefulSet metadata: name: {{ $fullname }}-server labels: {{- include "spire.server.labels" . | nindent 4 }} spec: {{- if not .Values.autoscaling.enabled }} replicas: {{ .Values.replicaCount }} {{- end }} serviceName: {{ include "spire.fullname" . }}-server selector: matchLabels: {{- include "spire.server.selectorLabels" . | nindent 6 }} template: metadata: {{- with .Values.podAnnotations }} annotations: {{- toYaml . | nindent 8 }} {{- end }} labels: {{- include "spire.server.selectorLabels" . | nindent 8 }} spec: {{- with .Values.imagePullSecrets }} imagePullSecrets: {{- range . }} - name: {{ printf "%s-%s" $fullname .name }} {{- end }} {{- end }} serviceAccountName: {{ include "spire.serviceAccountName" . }}-server shareProcessNamespace: true securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} containers: - name: {{ .Chart.Name }}-server securityContext: {{- toYaml .Values.securityContext | nindent 12 }} image: "{{ .Values.server.image.repository }}:{{ .Values.server.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.server.image.pullPolicy }} args: - -config - /run/spire/config/server.conf ports: - name: grpc containerPort: 8081 protocol: TCP volumeMounts: - name: spire-server-socket mountPath: {{ include "spire.sockets" . }} readOnly: false - name: spire-config mountPath: /run/spire/config readOnly: true {{- if eq (.Values.server.dataStorage.enabled | toString) "true" }} - name: spire-data mountPath: /run/spire/data readOnly: false {{ end }} livenessProbe: httpGet: path: /live port: 8080 failureThreshold: 2 initialDelaySeconds: 15 periodSeconds: 60 timeoutSeconds: 3 readinessProbe: httpGet: path: /ready port: 8080 initialDelaySeconds: 5 periodSeconds: 5 resources: {{- toYaml .Values.resources | nindent 12 }} - name: {{ .Chart.Name }}-workload-registrar securityContext: {{- toYaml .Values.securityContext | nindent 12 }} image: "{{ .Values.workloadRegistrar.image.repository }}:{{ .Values.workloadRegistrar.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.workloadRegistrar.image.pullPolicy }} args: - -config - /run/spire/k8s-workload-registrar/config/workload-registrar.conf ports: - containerPort: 8443 name: registrar-port volumeMounts: - name: spire-server-socket mountPath: {{ include "spire.sockets" . }} readOnly: true - name: spire-workload-registrar-config mountPath: /run/spire/k8s-workload-registrar/config readOnly: true {{- if eq (.Values.oidc.enabled | toString) "true" }} - name: spire-oidc image: "{{ .Values.oidc.image.repository }}:{{ .Values.oidc.image.tag | default .Chart.AppVersion }}" args: - -config - /run/spire/oidc/config/oidc-discovery-provider.conf ports: - containerPort: {{ .Values.oidc.service.port }} name: spire-oidc-port volumeMounts: - name: spire-server-socket mountPath: {{ include "spire.sockets" . }} readOnly: true - name: spire-oidc-config mountPath: /run/spire/oidc/config/ readOnly: true {{- if eq (.Values.server.dataStorage.enabled | toString) "true" }} - name: spire-data mountPath: /run/spire/data readOnly: false {{ end }} readinessProbe: exec: command: ["/bin/ps", "aux", " ||", "grep", "oidc-discovery-provider -config /run/spire/oidc/config/oidc-discovery-provider.conf"] initialDelaySeconds: 5 periodSeconds: 5 {{ end }} {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.affinity }} affinity: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.tolerations }} tolerations: {{- toYaml . | nindent 8 }} {{- end }} volumes: - name: spire-workload-registrar-config configMap: name: {{ include "spire.fullname" . }}-workload-registrar - name: spire-config configMap: name: {{ include "spire.fullname" . }}-server {{- if eq (.Values.oidc.enabled | toString) "true" }} - name: spire-oidc-config configMap: name: {{ include "spire.fullname" . }}-oidc-discovery-provider {{ end }} - name: spire-server-socket hostPath: path: /run/spire/server-sockets type: DirectoryOrCreate volumeClaimTemplates: {{- if eq (.Values.server.dataStorage.enabled | toString) "true" }} - metadata: name: spire-data spec: accessModes: - {{ .Values.server.dataStorage.accessMode | default "ReadWriteOnce" }} resources: requests: storage: {{ .Values.server.dataStorage.size }} {{- if .Values.server.dataStorage.storageClass }} storageClassName: {{ .Values.server.dataStorage.storageClass }} {{- end }} {{ end }}