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-12-07 15:18:25 +00:00
|
|
|
{{- if .Capabilities.APIVersions.Has "admissionregistration.k8s.io/v1" }}
|
|
|
|
apiVersion: admissionregistration.k8s.io/v1
|
|
|
|
{{- else }}
|
2019-12-19 15:57:51 +00:00
|
|
|
apiVersion: admissionregistration.k8s.io/v1beta1
|
2020-12-07 15:18:25 +00:00
|
|
|
{{- end }}
|
2019-12-19 15:57:51 +00:00
|
|
|
kind: MutatingWebhookConfiguration
|
|
|
|
metadata:
|
2024-05-28 11:52:10 +00:00
|
|
|
name: {{ template "openbao.fullname" . }}-agent-injector-cfg
|
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 }}
|
2021-08-16 20:49:26 +00:00
|
|
|
{{- template "injector.webhookAnnotations" . }}
|
2019-12-19 15:57:51 +00:00
|
|
|
webhooks:
|
|
|
|
- name: vault.hashicorp.com
|
2022-03-18 14:15:43 +00:00
|
|
|
failurePolicy: {{ ((.Values.injector.webhook)).failurePolicy | default .Values.injector.failurePolicy }}
|
|
|
|
matchPolicy: {{ ((.Values.injector.webhook)).matchPolicy | default "Exact" }}
|
2020-12-07 15:18:25 +00:00
|
|
|
sideEffects: None
|
2022-03-18 14:15:43 +00:00
|
|
|
timeoutSeconds: {{ ((.Values.injector.webhook)).timeoutSeconds | default "30" }}
|
|
|
|
admissionReviewVersions: ["v1", "v1beta1"]
|
2019-12-19 15:57:51 +00:00
|
|
|
clientConfig:
|
|
|
|
service:
|
2024-05-28 11:52:10 +00:00
|
|
|
name: {{ template "openbao.fullname" . }}-agent-injector-svc
|
|
|
|
namespace: {{ include "openbao.namespace" . }}
|
2019-12-19 15:57:51 +00:00
|
|
|
path: "/mutate"
|
2020-07-14 13:53:33 +00:00
|
|
|
caBundle: {{ .Values.injector.certs.caBundle | quote }}
|
2019-12-19 15:57:51 +00:00
|
|
|
rules:
|
|
|
|
- operations: ["CREATE", "UPDATE"]
|
|
|
|
apiGroups: [""]
|
|
|
|
apiVersions: ["v1"]
|
|
|
|
resources: ["pods"]
|
2022-03-18 14:15:43 +00:00
|
|
|
{{- if or (.Values.injector.namespaceSelector) (((.Values.injector.webhook)).namespaceSelector) }}
|
2019-12-19 15:57:51 +00:00
|
|
|
namespaceSelector:
|
2022-03-18 14:15:43 +00:00
|
|
|
{{ toYaml (((.Values.injector.webhook)).namespaceSelector | default .Values.injector.namespaceSelector) | indent 6}}
|
2019-12-19 15:57:51 +00:00
|
|
|
{{ end }}
|
2022-05-24 16:48:01 +00:00
|
|
|
{{- template "injector.objectSelector" . -}}
|
2019-12-19 15:57:51 +00:00
|
|
|
{{ end }}
|