Skip to content

Commit

Permalink
Make injected Agent ephemeral storage configurable through injector.a…
Browse files Browse the repository at this point in the history
…gentDefaults (#798)
  • Loading branch information
krishnadas-m committed May 17, 2023
1 parent 582e7d0 commit b9096ee
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ Features:
Bugs:
* server: Quote `.server.ha.clusterAddr` value [GH-810](https://github.com/hashicorp/vault-helm/pull/810)

Improvements:
* injector: Add `ephemeralLimit` and `ephemeralRequest` as options for configuring Agent's ephemeral storage resources [GH-798](https://github.com/hashicorp/vault-helm/pull/798)

## 0.22.1 (October 26th, 2022)

Changes:
Expand Down
8 changes: 8 additions & 0 deletions templates/injector-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,14 @@ spec:
value: "{{ .Values.injector.agentDefaults.memRequest }}"
- name: AGENT_INJECT_MEM_LIMIT
value: "{{ .Values.injector.agentDefaults.memLimit }}"
{{- if .Values.injector.agentDefaults.ephemeralRequest }}
- name: AGENT_INJECT_EPHEMERAL_REQUEST
value: "{{ .Values.injector.agentDefaults.ephemeralRequest }}"
{{- end }}
{{- if .Values.injector.agentDefaults.ephemeralLimit }}
- name: AGENT_INJECT_EPHEMERAL_LIMIT
value: "{{ .Values.injector.agentDefaults.ephemeralLimit }}"
{{- end }}
- name: AGENT_INJECT_DEFAULT_TEMPLATE
value: "{{ .Values.injector.agentDefaults.template }}"
- name: AGENT_INJECT_TEMPLATE_CONFIG_EXIT_ON_RETRY_FAILURE
Expand Down
11 changes: 11 additions & 0 deletions test/unit/injector-deployment.bats
Original file line number Diff line number Diff line change
Expand Up @@ -963,6 +963,7 @@ EOF
local value=$(echo $object |
yq -r 'map(select(.name=="AGENT_INJECT_MEM_REQUEST")) | .[] .value' | tee /dev/stderr)
[ "${value}" = "64Mi" ]

}

@test "injector/deployment: can set agent default resources" {
Expand All @@ -973,6 +974,8 @@ EOF
--set 'injector.agentDefaults.cpuRequest=cpuRequest' \
--set 'injector.agentDefaults.memLimit=memLimit' \
--set 'injector.agentDefaults.memRequest=memRequest' \
--set 'injector.agentDefaults.ephemeralLimit=ephemeralLimit' \
--set 'injector.agentDefaults.ephemeralRequest=ephemeralRequest' \
. | tee /dev/stderr |
yq -r '.spec.template.spec.containers[0].env' | tee /dev/stderr)

Expand All @@ -991,6 +994,14 @@ EOF
local value=$(echo $object |
yq -r 'map(select(.name=="AGENT_INJECT_MEM_REQUEST")) | .[] .value' | tee /dev/stderr)
[ "${value}" = "memRequest" ]

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

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

@test "injector/deployment: agent default template" {
Expand Down
6 changes: 6 additions & 0 deletions values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,12 @@
"memRequest": {
"type": "string"
},
"ephemeralLimit": {
"type": "string"
},
"ephemeralRequest": {
"type": "string"
},
"template": {
"type": "string"
},
Expand Down
2 changes: 2 additions & 0 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ injector:
cpuRequest: "250m"
memLimit: "128Mi"
memRequest: "64Mi"
# ephemeralLimit: "128Mi"
# ephemeralRequest: "64Mi"

# Default template type for secrets when no custom template is specified.
# Possible values include: "json" and "map".
Expand Down

0 comments on commit b9096ee

Please sign in to comment.