2022-03-21 16:50:23 +00:00
|
|
|
{{- template "vault.injectorEnabled" . -}}
|
|
|
|
{{- if .injectorEnabled -}}
|
2020-02-06 16:44:38 +00:00
|
|
|
# Deployment for the injector
|
2019-12-19 15:57:51 +00:00
|
|
|
apiVersion: apps/v1
|
|
|
|
kind: Deployment
|
|
|
|
metadata:
|
|
|
|
name: {{ template "vault.fullname" . }}-agent-injector
|
|
|
|
namespace: {{ .Release.Namespace }}
|
|
|
|
labels:
|
|
|
|
app.kubernetes.io/name: {{ include "vault.name" . }}-agent-injector
|
|
|
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
|
|
|
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
|
|
|
component: webhook
|
|
|
|
spec:
|
2021-01-05 11:14:00 +00:00
|
|
|
replicas: {{ .Values.injector.replicas }}
|
2019-12-19 15:57:51 +00:00
|
|
|
selector:
|
|
|
|
matchLabels:
|
|
|
|
app.kubernetes.io/name: {{ template "vault.name" . }}-agent-injector
|
|
|
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
|
|
|
component: webhook
|
2021-12-16 19:21:36 +00:00
|
|
|
{{ template "injector.strategy" . }}
|
2019-12-19 15:57:51 +00:00
|
|
|
template:
|
|
|
|
metadata:
|
|
|
|
labels:
|
|
|
|
app.kubernetes.io/name: {{ template "vault.name" . }}-agent-injector
|
|
|
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
|
|
|
component: webhook
|
2020-12-07 16:28:06 +00:00
|
|
|
{{- if .Values.injector.extraLabels -}}
|
|
|
|
{{- toYaml .Values.injector.extraLabels | nindent 8 -}}
|
|
|
|
{{- end -}}
|
2020-10-01 15:06:53 +00:00
|
|
|
{{ template "injector.annotations" . }}
|
2019-12-19 15:57:51 +00:00
|
|
|
spec:
|
2020-03-20 05:43:52 +00:00
|
|
|
{{ template "injector.affinity" . }}
|
2021-09-17 23:30:49 +00:00
|
|
|
{{ template "injector.topologySpreadConstraints" . }}
|
2020-03-20 05:43:52 +00:00
|
|
|
{{ template "injector.tolerations" . }}
|
|
|
|
{{ template "injector.nodeselector" . }}
|
2020-05-01 01:37:27 +00:00
|
|
|
{{- if .Values.injector.priorityClassName }}
|
|
|
|
priorityClassName: {{ .Values.injector.priorityClassName }}
|
|
|
|
{{- end }}
|
2019-12-19 15:57:51 +00:00
|
|
|
serviceAccountName: "{{ template "vault.fullname" . }}-agent-injector"
|
2020-06-03 02:10:41 +00:00
|
|
|
{{- if not .Values.global.openshift }}
|
2021-04-08 14:03:56 +00:00
|
|
|
hostNetwork: {{ .Values.injector.hostNetwork }}
|
2019-12-19 15:57:51 +00:00
|
|
|
securityContext:
|
|
|
|
runAsNonRoot: true
|
|
|
|
runAsGroup: {{ .Values.injector.gid | default 1000 }}
|
|
|
|
runAsUser: {{ .Values.injector.uid | default 100 }}
|
2020-06-03 02:10:41 +00:00
|
|
|
{{- end }}
|
2019-12-19 15:57:51 +00:00
|
|
|
containers:
|
|
|
|
- name: sidecar-injector
|
|
|
|
{{ template "injector.resources" . }}
|
|
|
|
image: "{{ .Values.injector.image.repository }}:{{ .Values.injector.image.tag }}"
|
|
|
|
imagePullPolicy: "{{ .Values.injector.image.pullPolicy }}"
|
2020-12-14 19:14:29 +00:00
|
|
|
{{- if not .Values.global.openshift }}
|
|
|
|
securityContext:
|
|
|
|
allowPrivilegeEscalation: false
|
|
|
|
{{- end }}
|
2019-12-19 15:57:51 +00:00
|
|
|
env:
|
|
|
|
- name: AGENT_INJECT_LISTEN
|
2021-04-12 20:59:38 +00:00
|
|
|
value: {{ printf ":%v" .Values.injector.port }}
|
2019-12-19 15:57:51 +00:00
|
|
|
- name: AGENT_INJECT_LOG_LEVEL
|
|
|
|
value: {{ .Values.injector.logLevel | default "info" }}
|
|
|
|
- name: AGENT_INJECT_VAULT_ADDR
|
2020-02-21 16:16:33 +00:00
|
|
|
{{- if .Values.injector.externalVaultAddr }}
|
|
|
|
value: "{{ .Values.injector.externalVaultAddr }}"
|
|
|
|
{{- else }}
|
2019-12-19 15:57:51 +00:00
|
|
|
value: {{ include "vault.scheme" . }}://{{ template "vault.fullname" . }}.{{ .Release.Namespace }}.svc:{{ .Values.server.service.port }}
|
2020-02-21 16:16:33 +00:00
|
|
|
{{- end }}
|
2020-03-03 18:32:50 +00:00
|
|
|
- name: AGENT_INJECT_VAULT_AUTH_PATH
|
|
|
|
value: {{ .Values.injector.authPath }}
|
2019-12-19 15:57:51 +00:00
|
|
|
- name: AGENT_INJECT_VAULT_IMAGE
|
|
|
|
value: "{{ .Values.injector.agentImage.repository }}:{{ .Values.injector.agentImage.tag }}"
|
|
|
|
{{- if .Values.injector.certs.secretName }}
|
2020-01-13 17:49:13 +00:00
|
|
|
- name: AGENT_INJECT_TLS_CERT_FILE
|
2019-12-19 15:57:51 +00:00
|
|
|
value: "/etc/webhook/certs/{{ .Values.injector.certs.certName }}"
|
2020-01-13 17:49:13 +00:00
|
|
|
- name: AGENT_INJECT_TLS_KEY_FILE
|
2019-12-19 15:57:51 +00:00
|
|
|
value: "/etc/webhook/certs/{{ .Values.injector.certs.keyName }}"
|
|
|
|
{{- else }}
|
|
|
|
- name: AGENT_INJECT_TLS_AUTO
|
|
|
|
value: {{ template "vault.fullname" . }}-agent-injector-cfg
|
|
|
|
- name: AGENT_INJECT_TLS_AUTO_HOSTS
|
|
|
|
value: {{ template "vault.fullname" . }}-agent-injector-svc,{{ template "vault.fullname" . }}-agent-injector-svc.{{ .Release.Namespace }},{{ template "vault.fullname" . }}-agent-injector-svc.{{ .Release.Namespace }}.svc
|
|
|
|
{{- end }}
|
2020-03-06 20:03:58 +00:00
|
|
|
- name: AGENT_INJECT_LOG_FORMAT
|
|
|
|
value: {{ .Values.injector.logFormat | default "standard" }}
|
|
|
|
- name: AGENT_INJECT_REVOKE_ON_SHUTDOWN
|
2020-03-06 21:59:59 +00:00
|
|
|
value: "{{ .Values.injector.revokeOnShutdown | default false }}"
|
2020-06-03 02:10:41 +00:00
|
|
|
{{- if .Values.global.openshift }}
|
|
|
|
- name: AGENT_INJECT_SET_SECURITY_CONTEXT
|
|
|
|
value: "false"
|
|
|
|
{{- end }}
|
2020-08-20 23:03:12 +00:00
|
|
|
{{- if .Values.injector.metrics.enabled }}
|
|
|
|
- name: AGENT_INJECT_TELEMETRY_PATH
|
|
|
|
value: "/metrics"
|
|
|
|
{{- end }}
|
2021-01-05 11:14:00 +00:00
|
|
|
{{- if and (eq (.Values.injector.leaderElector.enabled | toString) "true") (gt (.Values.injector.replicas | int) 1) }}
|
|
|
|
- name: AGENT_INJECT_USE_LEADER_ELECTOR
|
|
|
|
value: "true"
|
|
|
|
- name: NAMESPACE
|
|
|
|
valueFrom:
|
|
|
|
fieldRef:
|
|
|
|
fieldPath: metadata.namespace
|
|
|
|
{{- end }}
|
2021-04-12 21:01:14 +00:00
|
|
|
- name: AGENT_INJECT_CPU_REQUEST
|
|
|
|
value: "{{ .Values.injector.agentDefaults.cpuRequest }}"
|
|
|
|
- name: AGENT_INJECT_CPU_LIMIT
|
|
|
|
value: "{{ .Values.injector.agentDefaults.cpuLimit }}"
|
|
|
|
- name: AGENT_INJECT_MEM_REQUEST
|
|
|
|
value: "{{ .Values.injector.agentDefaults.memRequest }}"
|
|
|
|
- name: AGENT_INJECT_MEM_LIMIT
|
|
|
|
value: "{{ .Values.injector.agentDefaults.memLimit }}"
|
|
|
|
- name: AGENT_INJECT_DEFAULT_TEMPLATE
|
|
|
|
value: "{{ .Values.injector.agentDefaults.template }}"
|
2021-07-06 16:49:48 +00:00
|
|
|
- name: AGENT_INJECT_TEMPLATE_CONFIG_EXIT_ON_RETRY_FAILURE
|
|
|
|
value: "{{ .Values.injector.agentDefaults.templateConfig.exitOnRetryFailure }}"
|
2021-11-06 02:07:25 +00:00
|
|
|
{{- if .Values.injector.agentDefaults.templateConfig.staticSecretRenderInterval }}
|
|
|
|
- name: AGENT_INJECT_TEMPLATE_STATIC_SECRET_RENDER_INTERVAL
|
|
|
|
value: "{{ .Values.injector.agentDefaults.templateConfig.staticSecretRenderInterval }}"
|
|
|
|
{{- end }}
|
2020-03-19 04:30:22 +00:00
|
|
|
{{- include "vault.extraEnvironmentVars" .Values.injector | nindent 12 }}
|
2021-08-31 22:16:06 +00:00
|
|
|
- name: POD_NAME
|
|
|
|
valueFrom:
|
|
|
|
fieldRef:
|
|
|
|
fieldPath: metadata.name
|
2019-12-19 15:57:51 +00:00
|
|
|
args:
|
|
|
|
- agent-inject
|
|
|
|
- 2>&1
|
|
|
|
livenessProbe:
|
|
|
|
httpGet:
|
|
|
|
path: /health/ready
|
2021-04-12 20:59:38 +00:00
|
|
|
port: {{ .Values.injector.port }}
|
2019-12-19 15:57:51 +00:00
|
|
|
scheme: HTTPS
|
|
|
|
failureThreshold: 2
|
2021-01-05 18:51:28 +00:00
|
|
|
initialDelaySeconds: 5
|
2019-12-19 15:57:51 +00:00
|
|
|
periodSeconds: 2
|
|
|
|
successThreshold: 1
|
|
|
|
timeoutSeconds: 5
|
|
|
|
readinessProbe:
|
|
|
|
httpGet:
|
|
|
|
path: /health/ready
|
2021-04-12 20:59:38 +00:00
|
|
|
port: {{ .Values.injector.port }}
|
2019-12-19 15:57:51 +00:00
|
|
|
scheme: HTTPS
|
|
|
|
failureThreshold: 2
|
2021-01-05 18:51:28 +00:00
|
|
|
initialDelaySeconds: 5
|
2019-12-19 15:57:51 +00:00
|
|
|
periodSeconds: 2
|
|
|
|
successThreshold: 1
|
|
|
|
timeoutSeconds: 5
|
2021-06-10 22:32:22 +00:00
|
|
|
{{- if .Values.injector.certs.secretName }}
|
|
|
|
volumeMounts:
|
|
|
|
- name: webhook-certs
|
|
|
|
mountPath: /etc/webhook/certs
|
|
|
|
readOnly: true
|
|
|
|
{{- end }}
|
2019-12-19 15:57:51 +00:00
|
|
|
{{- if .Values.injector.certs.secretName }}
|
|
|
|
volumes:
|
|
|
|
- name: webhook-certs
|
|
|
|
secret:
|
|
|
|
secretName: "{{ .Values.injector.certs.secretName }}"
|
|
|
|
{{- end }}
|
2021-07-23 16:05:24 +00:00
|
|
|
{{- include "imagePullSecrets" . | nindent 6 }}
|
2019-12-19 15:57:51 +00:00
|
|
|
{{ end }}
|