2019-12-19 15:57:51 +00:00
|
|
|
{{- if and (eq (.Values.injector.enabled | toString) "true" ) (eq (.Values.global.enabled | toString) "true") }}
|
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
|
|
|
|
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" . }}
|
|
|
|
{{ 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
|
|
|
|
value: ":8080"
|
|
|
|
- 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 }}
|
2020-03-19 04:30:22 +00:00
|
|
|
{{- include "vault.extraEnvironmentVars" .Values.injector | nindent 12 }}
|
2019-12-19 15:57:51 +00:00
|
|
|
args:
|
|
|
|
- agent-inject
|
|
|
|
- 2>&1
|
|
|
|
livenessProbe:
|
|
|
|
httpGet:
|
|
|
|
path: /health/ready
|
|
|
|
port: 8080
|
|
|
|
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
|
|
|
|
port: 8080
|
|
|
|
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-01-05 11:14:00 +00:00
|
|
|
{{- if and (eq (.Values.injector.leaderElector.enabled | toString) "true") (gt (.Values.injector.replicas | int) 1) }}
|
|
|
|
- name: leader-elector
|
|
|
|
image: {{ .Values.injector.leaderElector.image.repository }}:{{ .Values.injector.leaderElector.image.tag }}
|
|
|
|
args:
|
|
|
|
- --election={{ template "vault.fullname" . }}-agent-injector-leader
|
|
|
|
- --election-namespace={{ .Release.Namespace }}
|
|
|
|
- --http=0.0.0.0:4040
|
|
|
|
- --ttl={{ .Values.injector.leaderElector.ttl }}
|
|
|
|
livenessProbe:
|
|
|
|
httpGet:
|
|
|
|
path: /
|
|
|
|
port: 4040
|
|
|
|
scheme: HTTP
|
|
|
|
failureThreshold: 2
|
2021-01-05 18:51:28 +00:00
|
|
|
initialDelaySeconds: 5
|
2021-01-05 11:14:00 +00:00
|
|
|
periodSeconds: 2
|
|
|
|
successThreshold: 1
|
|
|
|
timeoutSeconds: 5
|
|
|
|
readinessProbe:
|
|
|
|
httpGet:
|
|
|
|
path: /
|
|
|
|
port: 4040
|
|
|
|
scheme: HTTP
|
|
|
|
failureThreshold: 2
|
2021-01-05 18:51:28 +00:00
|
|
|
initialDelaySeconds: 5
|
2021-01-05 11:14:00 +00:00
|
|
|
periodSeconds: 2
|
|
|
|
successThreshold: 1
|
|
|
|
timeoutSeconds: 5
|
|
|
|
{{- end }}
|
2019-12-19 15:57:51 +00:00
|
|
|
{{- if .Values.injector.certs.secretName }}
|
|
|
|
volumeMounts:
|
|
|
|
- name: webhook-certs
|
|
|
|
mountPath: /etc/webhook/certs
|
|
|
|
readOnly: true
|
|
|
|
volumes:
|
|
|
|
- name: webhook-certs
|
|
|
|
secret:
|
|
|
|
secretName: "{{ .Values.injector.certs.secretName }}"
|
|
|
|
{{- end }}
|
2020-06-02 14:09:48 +00:00
|
|
|
{{- if .Values.global.imagePullSecrets }}
|
|
|
|
imagePullSecrets:
|
|
|
|
{{- toYaml .Values.global.imagePullSecrets | nindent 8 }}
|
|
|
|
{{- end }}
|
2019-12-19 15:57:51 +00:00
|
|
|
{{ end }}
|