* SPIFFE OIDC Discovery Provider Rework Fixes: https://github.com/spiffe/helm-charts-hardened/issues/151 Signed-off-by: Kevin Fox <[email protected]> * Enhance clusterspiffeid's so the discovery provider is independently configurable Signed-off-by: Kevin Fox <[email protected]> * Fix tests Signed-off-by: Kevin Fox <[email protected]> * More fix tests Signed-off-by: Kevin Fox <[email protected]> * More fix tests Signed-off-by: Kevin Fox <[email protected]> * Undo Signed-off-by: Kevin Fox <[email protected]> * Fix logging Signed-off-by: Kevin Fox <[email protected]> * Try to get output Signed-off-by: Kevin Fox <[email protected]> * Try and get error code Signed-off-by: Kevin Fox <[email protected]> * Fix more logging. Switch port used. Signed-off-by: Kevin Fox <[email protected]> * Fix logging Signed-off-by: Kevin Fox <[email protected]> * Fix port Signed-off-by: Kevin Fox <[email protected]> * Fix up logs for nested test and fix values Signed-off-by: Kevin Fox <[email protected]> * Make consistent Signed-off-by: Kevin Fox <[email protected]> * Fix nested test Signed-off-by: Kevin Fox <[email protected]> * Fix insecure mode and test. Signed-off-by: Kevin Fox <[email protected]> * Fix test. Signed-off-by: Kevin Fox <[email protected]> * Fix var scoping issue Signed-off-by: Kevin Fox <[email protected]> * Set the right flags for ingress Signed-off-by: Kevin Fox <[email protected]> * Update dns template Signed-off-by: Kevin Fox <[email protected]> * Use more standard port Signed-off-by: Kevin Fox <[email protected]> * Fix test logging Signed-off-by: Kevin Fox <[email protected]> * Allow reencrypt. Signed-off-by: Kevin Fox <[email protected]> * Remove testing changes Signed-off-by: Kevin Fox <[email protected]> * Fix formatting Signed-off-by: Kevin Fox <[email protected]> * Add LetsEncrypt/ACME/cert-manager support. Remove broken ACME support. Signed-off-by: Kevin Fox <[email protected]> * Use spiffe-helper as a sidecar. Significant space savings and read only cert dir Signed-off-by: Kevin Fox <[email protected]> * Fix the nested test Signed-off-by: Kevin Fox <[email protected]> * Fix merge issue Signed-off-by: Kevin Fox <[email protected]> * Remove 1.29.0 until deps catch up. Related issue: https://github.com/rancher/kubectl/pull/94 Signed-off-by: Kevin Fox <[email protected]> * Add more error checking Signed-off-by: Kevin Fox <[email protected]> * Remove testing code Signed-off-by: Kevin Fox <[email protected]> * Simplify the ids. Fix docs Signed-off-by: Kevin Fox <[email protected]> * Fix logic Signed-off-by: Kevin Fox <[email protected]> * Fix var Signed-off-by: Kevin Fox <[email protected]> * Make cert-manager bits more readable Signed-off-by: Kevin Fox <[email protected]> * Fix template Signed-off-by: Kevin Fox <[email protected]> * Fix openshift ingress Signed-off-by: Kevin Fox <[email protected]> * Incorperate feedback Signed-off-by: Kevin Fox <[email protected]> * Update docs Signed-off-by: Kevin Fox <[email protected]> * Add resource spec Signed-off-by: Kevin Fox <[email protected]> * Remove parts that cant merge yet Signed-off-by: Kevin Fox <[email protected]> * Add support for running spiffe secured discovery provider (default) Signed-off-by: Kevin Fox <[email protected]> * Fix tests Signed-off-by: Kevin Fox <[email protected]> * Incorperate feedback Signed-off-by: Kevin Fox <[email protected]> * Incorperate feedback Signed-off-by: Kevin Fox <[email protected]> * Fix test Signed-off-by: Kevin Fox <[email protected]> * Apply suggestions from code review Co-authored-by: Faisal Memon <[email protected]> Signed-off-by: kfox1111 <[email protected]> * Fix docs Signed-off-by: Kevin Fox <[email protected]> * Apply suggestions from code review Co-authored-by: Faisal Memon <[email protected]> Signed-off-by: kfox1111 <[email protected]> * Incorperate feedback Signed-off-by: Kevin Fox <[email protected]> * Incorperate feedback Signed-off-by: Kevin Fox <[email protected]> * Fix test Signed-off-by: Kevin Fox <[email protected]> * Fix test Signed-off-by: Kevin Fox <[email protected]> * Fix merge conflict Signed-off-by: Kevin Fox <[email protected]> * Fix merge conflict Signed-off-by: Kevin Fox <[email protected]> * Remove defaults Signed-off-by: Kevin Fox <[email protected]> * Apply suggestions from code review Co-authored-by: Faisal Memon <[email protected]> Signed-off-by: kfox1111 <[email protected]> * Fix docs Signed-off-by: Kevin Fox <[email protected]> * Incorperate feedback Signed-off-by: Kevin Fox <[email protected]> * Add missing configurable for the discovery providers csi driver Signed-off-by: Kevin Fox <[email protected]> * Update for changes in spiffe-helper Signed-off-by: Kevin Fox <[email protected]> * Point at upstream Signed-off-by: Kevin Fox <[email protected]> --------- Signed-off-by: Kevin Fox <[email protected]> Signed-off-by: kfox1111 <[email protected]> Co-authored-by: Faisal Memon <[email protected]>
200 lines
7.8 KiB
YAML
200 lines
7.8 KiB
YAML
{{- $tlsEnabled := eq (include "spiffe-oidc-discovery-provider.tls-enabled" .) "true" }}
|
|
{{- $configSum := (include (print $.Template.BasePath "/configmap.yaml") . | sha256sum) }}
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: {{ include "spiffe-oidc-discovery-provider.fullname" . }}
|
|
namespace: {{ include "spiffe-oidc-discovery-provider.namespace" . }}
|
|
labels:
|
|
{{- include "spiffe-oidc-discovery-provider.labels" . | nindent 4 }}
|
|
{{- with .Values.annotations }}
|
|
annotations:
|
|
{{- toYaml . | nindent 4 }}
|
|
{{- end }}
|
|
spec:
|
|
{{- if not .Values.autoscaling.enabled }}
|
|
replicas: {{ .Values.replicaCount }}
|
|
{{- end }}
|
|
selector:
|
|
matchLabels:
|
|
{{- include "spiffe-oidc-discovery-provider.selectorLabels" . | nindent 6 }}
|
|
template:
|
|
metadata:
|
|
annotations:
|
|
checksum/config: {{ $configSum }}
|
|
{{- with .Values.podAnnotations }}
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
labels:
|
|
{{- include "spiffe-oidc-discovery-provider.selectorLabels" . | nindent 8 }}
|
|
release: {{ .Release.Name }}
|
|
release-namespace: {{ .Release.Namespace }}
|
|
component: oidc-discovery-provider
|
|
spec:
|
|
{{- with .Values.imagePullSecrets }}
|
|
imagePullSecrets:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
serviceAccountName: {{ include "spiffe-oidc-discovery-provider.serviceAccountName" . }}
|
|
securityContext:
|
|
{{- include "spire-lib.podsecuritycontext" . | nindent 8 }}
|
|
initContainers:
|
|
{{- if .Values.tls.spire.enabled }}
|
|
- name: init
|
|
securityContext:
|
|
{{- include "spire-lib.securitycontext" . | nindent 12 }}
|
|
resources:
|
|
{{- toYaml .Values.spiffeHelper.resources | nindent 12 }}
|
|
image: {{ template "spire-lib.image" (dict "image" .Values.spiffeHelper.image "global" .Values.global) }}
|
|
imagePullPolicy: {{ .Values.spiffeHelper.image.pullPolicy }}
|
|
args:
|
|
- -config
|
|
- /etc/spiffe-helper.conf
|
|
- -exitWhenReady
|
|
volumeMounts:
|
|
- name: spiffe-workload-api
|
|
mountPath: {{ include "spiffe-oidc-discovery-provider.workload-api-socket-path" . | dir }}
|
|
readOnly: true
|
|
- name: spire-oidc-config
|
|
mountPath: /etc/spiffe-helper.conf
|
|
subPath: spiffe-helper.conf
|
|
readOnly: true
|
|
- name: certdir
|
|
mountPath: /certs
|
|
{{- end }}
|
|
containers:
|
|
- name: {{ .Chart.Name }}
|
|
securityContext:
|
|
{{- include "spire-lib.securitycontext" . | nindent 12 }}
|
|
image: {{ template "spire-lib.image" (dict "appVersion" $.Chart.AppVersion "image" .Values.image "global" .Values.global) }}
|
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
|
args:
|
|
- -config
|
|
- /run/spire/oidc/config/oidc-discovery-provider.conf
|
|
ports:
|
|
- containerPort: 8008
|
|
name: healthz
|
|
{{- if $tlsEnabled }}
|
|
- containerPort: 8443
|
|
name: https
|
|
{{- end }}
|
|
volumeMounts:
|
|
- name: spiffe-workload-api
|
|
mountPath: {{ include "spiffe-oidc-discovery-provider.workload-api-socket-path" . | dir }}
|
|
readOnly: true
|
|
- name: spire-oidc-sockets
|
|
mountPath: /run/spire/oidc-sockets
|
|
readOnly: false
|
|
- name: spire-oidc-config
|
|
mountPath: /run/spire/oidc/config/oidc-discovery-provider.conf
|
|
subPath: oidc-discovery-provider.conf
|
|
readOnly: true
|
|
- name: certdir
|
|
mountPath: /certs
|
|
readOnly: true
|
|
readinessProbe:
|
|
httpGet:
|
|
path: /ready
|
|
port: healthz
|
|
{{- toYaml .Values.readinessProbe | nindent 12 }}
|
|
livenessProbe:
|
|
httpGet:
|
|
path: /live
|
|
port: healthz
|
|
{{- toYaml .Values.livenessProbe | nindent 12 }}
|
|
resources:
|
|
{{- toYaml .Values.resources | nindent 12 }}
|
|
{{- if .Values.tls.spire.enabled }}
|
|
- name: spiffe-helper
|
|
resources:
|
|
{{- toYaml .Values.spiffeHelper.resources | nindent 12 }}
|
|
securityContext:
|
|
{{- include "spire-lib.securitycontext" . | nindent 12 }}
|
|
image: {{ template "spire-lib.image" (dict "image" .Values.spiffeHelper.image "global" .Values.global) }}
|
|
imagePullPolicy: {{ .Values.spiffeHelper.image.pullPolicy }}
|
|
args:
|
|
- -config
|
|
- /etc/spiffe-helper.conf
|
|
volumeMounts:
|
|
- name: spiffe-workload-api
|
|
mountPath: {{ include "spiffe-oidc-discovery-provider.workload-api-socket-path" . | dir }}
|
|
readOnly: true
|
|
- name: spire-oidc-config
|
|
mountPath: /etc/spiffe-helper.conf
|
|
subPath: spiffe-helper.conf
|
|
readOnly: true
|
|
- name: certdir
|
|
mountPath: /certs
|
|
{{- end }}
|
|
{{- if not $tlsEnabled }}
|
|
- name: nginx
|
|
securityContext:
|
|
{{- include "spire-lib.securitycontext" . | nindent 12 }}
|
|
image: {{ template "spire-lib.image" (dict "image" .Values.insecureScheme.nginx.image "global" .Values.global) }}
|
|
imagePullPolicy: {{ .Values.insecureScheme.nginx.image.pullPolicy }}
|
|
ports:
|
|
- containerPort: 8080
|
|
name: http
|
|
volumeMounts:
|
|
- name: spire-oidc-sockets
|
|
mountPath: /run/spire/oidc-sockets
|
|
readOnly: true
|
|
- name: spire-oidc-config
|
|
mountPath: /etc/nginx/conf.d/default.conf
|
|
subPath: default.conf
|
|
readOnly: true
|
|
- name: nginx-tmp
|
|
mountPath: /tmp
|
|
readOnly: false
|
|
resources:
|
|
{{- toYaml .Values.insecureScheme.nginx.resources | nindent 12 }}
|
|
{{- if or (dig "telemetry" "prometheus" "enabled" .Values.telemetry.prometheus.enabled .Values.global) (and (dig "spire" "recommendations" "enabled" false .Values.global) (dig "spire" "recommendations" "prometheus" true .Values.global)) }}
|
|
- name: nginx-exporter
|
|
securityContext:
|
|
{{- include "spire-lib.securitycontext" . | nindent 12 }}
|
|
image: {{ template "spire-lib.image" (dict "image" .Values.telemetry.prometheus.nginxExporter.image "global" .Values.global) }}
|
|
imagePullPolicy: {{ .Values.telemetry.prometheus.nginxExporter.image.pullPolicy }}
|
|
args:
|
|
- -nginx.scrape-uri=http://127.0.0.1:8080/stub_status
|
|
resources:
|
|
{{- toYaml .Values.telemetry.prometheus.nginxExporter.resources | nindent 12 }}
|
|
ports:
|
|
- containerPort: 9113
|
|
name: prom
|
|
{{- end }}
|
|
{{- end }}
|
|
volumes:
|
|
- name: spiffe-workload-api
|
|
csi:
|
|
driver: "{{ .Values.csiDriverName }}"
|
|
readOnly: true
|
|
- name: spire-oidc-sockets
|
|
emptyDir: {}
|
|
- name: spire-oidc-config
|
|
configMap:
|
|
name: {{ include "spiffe-oidc-discovery-provider.fullname" . }}
|
|
- name: nginx-tmp
|
|
emptyDir: {}
|
|
- name: certdir
|
|
{{- if .Values.tls.externalSecret.enabled }}
|
|
secret:
|
|
secretName: {{ .Values.tls.externalSecret.secretName }}
|
|
{{- else if .Values.tls.certManager.enabled }}
|
|
secret:
|
|
secretName: {{ include "spiffe-oidc-discovery-provider.fullname" . }}-cert
|
|
{{- else }}
|
|
emptyDir: {}
|
|
{{- 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 }}
|