add hostNetwork value to injector deployment (#471)

* add hostNetwork value to injector deployment

* adding unit tests
This commit is contained in:
Paul Witt 2021-04-08 10:03:56 -04:00 committed by GitHub
parent b24457323b
commit a2a07b2a02
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 0 deletions

View file

@ -36,6 +36,7 @@ spec:
{{- end }} {{- end }}
serviceAccountName: "{{ template "vault.fullname" . }}-agent-injector" serviceAccountName: "{{ template "vault.fullname" . }}-agent-injector"
{{- if not .Values.global.openshift }} {{- if not .Values.global.openshift }}
hostNetwork: {{ .Values.injector.hostNetwork }}
securityContext: securityContext:
runAsNonRoot: true runAsNonRoot: true
runAsGroup: {{ .Values.injector.gid | default 1000 }} runAsGroup: {{ .Values.injector.gid | default 1000 }}

View file

@ -543,3 +543,25 @@ load _helpers
yq -r '.spec.template.metadata.labels.foo' | tee /dev/stderr) yq -r '.spec.template.metadata.labels.foo' | tee /dev/stderr)
[ "${actual}" = "bar" ] [ "${actual}" = "bar" ]
} }
#--------------------------------------------------------------------
# hostNetwork
@test "injector/deployment: injector.hostNetwork not set" {
cd `chart_dir`
local actual=$(helm template \
--show-only templates/injector-deployment.yaml \
. | tee /dev/stderr |
yq -r '.spec.template.spec.hostNetwork' | tee /dev/stderr)
[ "${actual}" = "false" ]
}
@test "injector/deployment: injector.hostNetwork is set" {
cd `chart_dir`
local actual=$(helm template \
--show-only templates/injector-deployment.yaml \
--set 'injector.hostNetwork=true' \
. | tee /dev/stderr |
yq -r '.spec.template.spec.hostNetwork' | tee /dev/stderr)
[ "${actual}" = "true" ]
}

View file

@ -168,6 +168,10 @@ injector:
# This should be a YAML map of the labels to apply to the injector # This should be a YAML map of the labels to apply to the injector
extraLabels: {} extraLabels: {}
# Should the injector pods run on the host network (useful when using
# an alternate CNI in EKS)
hostNetwork: false
# Injector service specific config # Injector service specific config
service: service:
# Extra annotations to attach to the injector service # Extra annotations to attach to the injector service