
VAULT-571 Matching documented behavior and consul Consul's helm template defaults most of the enabled to the special value `"-"`, which means to inherit from global. This is what is implied should happen in Vault as well according to the documentation for the helm chart: > [global.enabled] The master enabled/disabled configuration. If this is > true, most components will be installed by default. If this is false, > no components will be installed by default and manually opting-in is > required, such as by setting server.enabled to true. (https://www.vaultproject.io/docs/platform/k8s/helm/configuration#enabled) We also simplified the chart logic using a few template helpers. Co-authored-by: Theron Voran <tvoran@users.noreply.github.com>
42 lines
1.8 KiB
YAML
42 lines
1.8 KiB
YAML
{{- template "vault.injectorEnabled" . -}}
|
|
{{- if .injectorEnabled -}}
|
|
{{- if .Capabilities.APIVersions.Has "admissionregistration.k8s.io/v1" }}
|
|
apiVersion: admissionregistration.k8s.io/v1
|
|
{{- else }}
|
|
apiVersion: admissionregistration.k8s.io/v1beta1
|
|
{{- end }}
|
|
kind: MutatingWebhookConfiguration
|
|
metadata:
|
|
name: {{ template "vault.fullname" . }}-agent-injector-cfg
|
|
labels:
|
|
app.kubernetes.io/name: {{ include "vault.name" . }}-agent-injector
|
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
|
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
|
{{- template "injector.webhookAnnotations" . }}
|
|
webhooks:
|
|
- name: vault.hashicorp.com
|
|
failurePolicy: {{ ((.Values.injector.webhook)).failurePolicy | default .Values.injector.failurePolicy }}
|
|
matchPolicy: {{ ((.Values.injector.webhook)).matchPolicy | default "Exact" }}
|
|
sideEffects: None
|
|
timeoutSeconds: {{ ((.Values.injector.webhook)).timeoutSeconds | default "30" }}
|
|
admissionReviewVersions: ["v1", "v1beta1"]
|
|
clientConfig:
|
|
service:
|
|
name: {{ template "vault.fullname" . }}-agent-injector-svc
|
|
namespace: {{ .Release.Namespace }}
|
|
path: "/mutate"
|
|
caBundle: {{ .Values.injector.certs.caBundle | quote }}
|
|
rules:
|
|
- operations: ["CREATE", "UPDATE"]
|
|
apiGroups: [""]
|
|
apiVersions: ["v1"]
|
|
resources: ["pods"]
|
|
{{- if or (.Values.injector.namespaceSelector) (((.Values.injector.webhook)).namespaceSelector) }}
|
|
namespaceSelector:
|
|
{{ toYaml (((.Values.injector.webhook)).namespaceSelector | default .Values.injector.namespaceSelector) | indent 6}}
|
|
{{ end }}
|
|
{{- if or (((.Values.injector.webhook)).objectSelector) (.Values.injector.objectSelector) }}
|
|
objectSelector:
|
|
{{ toYaml (((.Values.injector.webhook)).objectSelector | default .Values.injector.objectSelector) | indent 6}}
|
|
{{ end }}
|
|
{{ end }}
|