injector: add templateConfig.exitOnRetryFailure annotation (#560)

* injector: add templateConfig.exitOnRetryFailure annotation

* update values.schema.json
This commit is contained in:
Calvin Leung Huang 2021-07-06 09:49:48 -07:00 committed by GitHub
parent f67b844d30
commit 14d1f97edd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 39 additions and 0 deletions

View file

@ -107,6 +107,8 @@ spec:
value: "{{ .Values.injector.agentDefaults.memLimit }}" value: "{{ .Values.injector.agentDefaults.memLimit }}"
- name: AGENT_INJECT_DEFAULT_TEMPLATE - name: AGENT_INJECT_DEFAULT_TEMPLATE
value: "{{ .Values.injector.agentDefaults.template }}" value: "{{ .Values.injector.agentDefaults.template }}"
- name: AGENT_INJECT_TEMPLATE_CONFIG_EXIT_ON_RETRY_FAILURE
value: "{{ .Values.injector.agentDefaults.templateConfig.exitOnRetryFailure }}"
{{- include "vault.extraEnvironmentVars" .Values.injector | nindent 12 }} {{- include "vault.extraEnvironmentVars" .Values.injector | nindent 12 }}
args: args:
- agent-inject - agent-inject

View file

@ -640,3 +640,28 @@ load _helpers
yq -r 'map(select(.name=="AGENT_INJECT_DEFAULT_TEMPLATE")) | .[] .value' | tee /dev/stderr) yq -r 'map(select(.name=="AGENT_INJECT_DEFAULT_TEMPLATE")) | .[] .value' | tee /dev/stderr)
[ "${value}" = "json" ] [ "${value}" = "json" ]
} }
@test "injector/deployment: agent default template_config.exit_on_retry_failure" {
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_EXIT_ON_RETRY_FAILURE")) | .[] .value' | tee /dev/stderr)
[ "${value}" = "true" ]
}
@test "injector/deployment: can set agent template_config.exit_on_retry_failure" {
cd `chart_dir`
local object=$(helm template \
--show-only templates/injector-deployment.yaml \
--set='injector.agentDefaults.templateConfig.exitOnRetryFailure=false' \
. | 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_EXIT_ON_RETRY_FAILURE")) | .[] .value' | tee /dev/stderr)
[ "${value}" = "false" ]
}

View file

@ -186,6 +186,14 @@
}, },
"template": { "template": {
"type": "string" "type": "string"
},
"templateConfig": {
"type": "object",
"properties": {
"exitOnRetryFailure": {
"type": "boolean"
}
}
} }
} }
}, },

View file

@ -75,6 +75,10 @@ injector:
# Possible values include: "json" and "map". # Possible values include: "json" and "map".
template: "map" template: "map"
# Default values within Agent's template_config stanza.
templateConfig:
exitOnRetryFailure: true
# Mount Path of the Vault Kubernetes Auth Method. # Mount Path of the Vault Kubernetes Auth Method.
authPath: "auth/kubernetes" authPath: "auth/kubernetes"