Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add staticSecretRenderInterval to injector #621

Merged
merged 7 commits into from
Nov 6, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions templates/injector-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ spec:
value: "{{ .Values.injector.agentDefaults.template }}"
- name: AGENT_INJECT_TEMPLATE_CONFIG_EXIT_ON_RETRY_FAILURE
value: "{{ .Values.injector.agentDefaults.templateConfig.exitOnRetryFailure }}"
- name: AGENT_INJECT_TEMPLATE_CONFIG_STATIC_SECRET_RENDER_INTERVAL
kaitoii11 marked this conversation as resolved.
Show resolved Hide resolved
value: "{{ .Values.injector.agentDefaults.templateConfig.staticSecretRenderInterval }}"
{{- include "vault.extraEnvironmentVars" .Values.injector | nindent 12 }}
- name: POD_NAME
valueFrom:
Expand Down
29 changes: 27 additions & 2 deletions test/unit/injector-deployment.bats
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ load _helpers
[ "${value}" = "RELEASE-NAME-vault-agent-injector-svc,RELEASE-NAME-vault-agent-injector-svc.${namespace:-default},RELEASE-NAME-vault-agent-injector-svc.${namespace:-default}.svc" ]
}

@test "injector/deployment: manual TLS adds volume mount" {
@test "injector/deployment: manual TLS adds volume mount" {
cd `chart_dir`
local object=$(helm template \
--show-only templates/injector-deployment.yaml \
Expand Down Expand Up @@ -695,4 +695,29 @@ load _helpers
local value=$(echo $object |
yq -r 'map(select(.name=="AGENT_INJECT_TEMPLATE_CONFIG_EXIT_ON_RETRY_FAILURE")) | .[] .value' | tee /dev/stderr)
[ "${value}" = "false" ]
}
}

@test "injector/deployment: agent default template_config.static_secret_render_interval" {
cd `chart_dir`
local object=$(helm template \
--show-only templates/injector-deployment.yaml \
. | tee /dev/stderr |
yq -r '.spec.template.spec.containers[0].env' | tee /dev/stderr)

local value=$(echo $object |
yq -r 'map(select(.name=="AGENT_INJECT_TEMPLATE_CONFIG_STATIC_SECRET_RENDER_INTERVAL")) | .[] .value' | tee /dev/stderr)
[ "${value}" = "5m" ]
}

@test "injector/deployment: can set agent template_config.static_secret_render_interval" {
cd `chart_dir`
local object=$(helm template \
--show-only templates/injector-deployment.yaml \
--set='injector.agentDefaults.templateConfig.staticSecretRenderInterval=1m' \
. | tee /dev/stderr |
yq -r '.spec.template.spec.containers[0].env' | tee /dev/stderr)

local value=$(echo $object |
yq -r 'map(select(.name=="AGENT_INJECT_TEMPLATE_CONFIG_STATIC_SECRET_RENDER_INTERVAL")) | .[] .value' | tee /dev/stderr)
[ "${value}" = "1m" ]
}
1 change: 1 addition & 0 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ injector:
# Default values within Agent's template_config stanza.
templateConfig:
exitOnRetryFailure: true
staticSecretRenderInterval: "5m"
kaitoii11 marked this conversation as resolved.
Show resolved Hide resolved

# Mount Path of the Vault Kubernetes Auth Method.
authPath: "auth/kubernetes"
Expand Down