Add vault-k8s metrics configurable (#372)

This commit is contained in:
Jason O'Donnell 2020-08-20 19:03:12 -04:00 committed by GitHub
parent 4d6e79df45
commit 117fff79bc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 0 deletions

View file

@ -76,6 +76,10 @@ spec:
- name: AGENT_INJECT_SET_SECURITY_CONTEXT
value: "false"
{{- end }}
{{- if .Values.injector.metrics.enabled }}
- name: AGENT_INJECT_TELEMETRY_PATH
value: "/metrics"
{{- end }}
{{- include "vault.extraEnvironmentVars" .Values.injector | nindent 12 }}
args:
- agent-inject

View file

@ -106,6 +106,23 @@ load _helpers
[ "${actual}" = "250m" ]
}
@test "injector/deployment: enable metrics" {
cd `chart_dir`
local object=$(helm template \
--show-only templates/injector-deployment.yaml \
--set 'injector.metrics.enabled=true' \
. | tee /dev/stderr |
yq -r '.spec.template.spec.containers[0].env' | tee /dev/stderr)
local actual=$(echo $object |
yq -r '.[9].name' | tee /dev/stderr)
[ "${actual}" = "AGENT_INJECT_TELEMETRY_PATH" ]
local actual=$(echo $object |
yq -r '.[9].value' | tee /dev/stderr)
[ "${actual}" = "/metrics" ]
}
@test "injector/deployment: manual TLS environment vars" {
cd `chart_dir`
local object=$(helm template \

View file

@ -27,6 +27,10 @@ injector:
# True if you want to enable vault agent injection.
enabled: true
# If true, will enable a node exporter metrics endpoint at /metrics.
metrics:
enabled: false
# External vault server address for the injector to use. Setting this will
# disable deployment of a vault server along with the injector.
externalVaultAddr: ""