2023-02-13 16:48:20 +00:00
|
|
|
{{/*
|
|
|
|
Copyright (c) HashiCorp, Inc.
|
|
|
|
SPDX-License-Identifier: MPL-2.0
|
|
|
|
*/}}
|
|
|
|
|
2024-05-28 11:52:10 +00:00
|
|
|
{{- template "openbao.injectorEnabled" . -}}
|
2022-03-21 16:50:23 +00:00
|
|
|
{{- 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:
|
2024-05-28 11:52:10 +00:00
|
|
|
name: {{ template "openbao.fullname" . }}-agent-injector
|
|
|
|
namespace: {{ include "openbao.namespace" . }}
|
2019-12-19 15:57:51 +00:00
|
|
|
labels:
|
2024-05-28 11:52:10 +00:00
|
|
|
app.kubernetes.io/name: {{ include "openbao.name" . }}-agent-injector
|
2019-12-19 15:57:51 +00:00
|
|
|
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:
|
2024-05-28 11:52:10 +00:00
|
|
|
app.kubernetes.io/name: {{ template "openbao.name" . }}-agent-injector
|
2019-12-19 15:57:51 +00:00
|
|
|
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:
|
2024-05-28 11:52:10 +00:00
|
|
|
app.kubernetes.io/name: {{ template "openbao.name" . }}-agent-injector
|
2019-12-19 15:57:51 +00:00
|
|
|
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" . }}
|
2022-04-28 17:47:40 +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 }}
|
2024-05-28 11:52:10 +00:00
|
|
|
serviceAccountName: "{{ template "openbao.fullname" . }}-agent-injector"
|
2022-08-08 19:48:28 +00:00
|
|
|
{{ template "injector.securityContext.pod" . -}}
|
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 }}
|
2020-06-03 02:10:41 +00:00
|
|
|
{{- end }}
|
2019-12-19 15:57:51 +00:00
|
|
|
containers:
|
|
|
|
- name: sidecar-injector
|
|
|
|
{{ template "injector.resources" . }}
|
2024-05-18 12:00:47 +00:00
|
|
|
image: "{{ .Values.injector.image.registry | default "docker.io" }}/{{ .Values.injector.image.repository }}:{{ .Values.injector.image.tag }}"
|
2019-12-19 15:57:51 +00:00
|
|
|
imagePullPolicy: "{{ .Values.injector.image.pullPolicy }}"
|
2022-08-08 19:48:28 +00:00
|
|
|
{{- template "injector.securityContext.container" . }}
|
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
|
2022-06-07 09:16:37 +00:00
|
|
|
{{- if .Values.global.externalVaultAddr }}
|
|
|
|
value: "{{ .Values.global.externalVaultAddr }}"
|
|
|
|
{{- else if .Values.injector.externalVaultAddr }}
|
2020-02-21 16:16:33 +00:00
|
|
|
value: "{{ .Values.injector.externalVaultAddr }}"
|
|
|
|
{{- else }}
|
2024-05-28 11:52:10 +00:00
|
|
|
value: {{ include "openbao.scheme" . }}://{{ template "openbao.fullname" . }}.{{ include "openbao.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
|
2024-05-28 11:52:10 +00:00
|
|
|
value: {{ template "openbao.fullname" . }}-agent-injector-cfg
|
2019-12-19 15:57:51 +00:00
|
|
|
- name: AGENT_INJECT_TLS_AUTO_HOSTS
|
2024-05-28 11:52:10 +00:00
|
|
|
value: {{ template "openbao.fullname" . }}-agent-injector-svc,{{ template "openbao.fullname" . }}-agent-injector-svc.{{ include "openbao.namespace" . }},{{ template "openbao.fullname" . }}-agent-injector-svc.{{ include "openbao.namespace" . }}.svc
|
2019-12-19 15:57:51 +00:00
|
|
|
{{- 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 }}"
|
2023-05-17 12:59:05 +00:00
|
|
|
{{- if .Values.injector.agentDefaults.ephemeralRequest }}
|
|
|
|
- name: AGENT_INJECT_EPHEMERAL_REQUEST
|
|
|
|
value: "{{ .Values.injector.agentDefaults.ephemeralRequest }}"
|
|
|
|
{{- end }}
|
|
|
|
{{- if .Values.injector.agentDefaults.ephemeralLimit }}
|
|
|
|
- name: AGENT_INJECT_EPHEMERAL_LIMIT
|
|
|
|
value: "{{ .Values.injector.agentDefaults.ephemeralLimit }}"
|
|
|
|
{{- end }}
|
2021-04-12 21:01:14 +00:00
|
|
|
- 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 }}
|
2024-05-28 11:52:10 +00:00
|
|
|
{{- include "openbao.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
|
2023-03-16 19:03:27 +00:00
|
|
|
failureThreshold: {{ .Values.injector.livenessProbe.failureThreshold }}
|
|
|
|
initialDelaySeconds: {{ .Values.injector.livenessProbe.initialDelaySeconds }}
|
|
|
|
periodSeconds: {{ .Values.injector.livenessProbe.periodSeconds }}
|
|
|
|
successThreshold: {{ .Values.injector.livenessProbe.successThreshold }}
|
|
|
|
timeoutSeconds: {{ .Values.injector.livenessProbe.timeoutSeconds }}
|
2019-12-19 15:57:51 +00:00
|
|
|
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
|
2023-03-16 19:03:27 +00:00
|
|
|
failureThreshold: {{ .Values.injector.readinessProbe.failureThreshold }}
|
|
|
|
initialDelaySeconds: {{ .Values.injector.readinessProbe.initialDelaySeconds }}
|
|
|
|
periodSeconds: {{ .Values.injector.readinessProbe.periodSeconds }}
|
|
|
|
successThreshold: {{ .Values.injector.readinessProbe.successThreshold }}
|
|
|
|
timeoutSeconds: {{ .Values.injector.readinessProbe.timeoutSeconds }}
|
|
|
|
startupProbe:
|
|
|
|
httpGet:
|
|
|
|
path: /health/ready
|
|
|
|
port: {{ .Values.injector.port }}
|
|
|
|
scheme: HTTPS
|
|
|
|
failureThreshold: {{ .Values.injector.startupProbe.failureThreshold }}
|
|
|
|
initialDelaySeconds: {{ .Values.injector.startupProbe.initialDelaySeconds }}
|
|
|
|
periodSeconds: {{ .Values.injector.startupProbe.periodSeconds }}
|
|
|
|
successThreshold: {{ .Values.injector.startupProbe.successThreshold }}
|
|
|
|
timeoutSeconds: {{ .Values.injector.startupProbe.timeoutSeconds }}
|
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 }}
|