-
Notifications
You must be signed in to change notification settings - Fork 888
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Vault Agent sidecar to CSI Provider (#749)
Adds Agent as a sidecar for the CSI Provider to: * Cache k8s auth login leases * Cache secret leases * Automatically renew renewable leases in the background
- Loading branch information
Showing
10 changed files
with
366 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{{- template "vault.csiEnabled" . -}} | ||
{{- if and (.csiEnabled) (eq (.Values.csi.agent.enabled | toString) "true") -}} | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ template "vault.fullname" . }}-csi-provider-agent-config | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
helm.sh/chart: {{ include "vault.chart" . }} | ||
app.kubernetes.io/name: {{ include "vault.name" . }}-csi-provider | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
data: | ||
config.hcl: | | ||
vault { | ||
{{- if .Values.global.externalVaultAddr }} | ||
"address" = "{{ .Values.global.externalVaultAddr }}" | ||
{{- else }} | ||
"address" = "{{ include "vault.scheme" . }}://{{ template "vault.fullname" . }}.{{ .Release.Namespace }}.svc:{{ .Values.server.service.port }}" | ||
{{- end }} | ||
} | ||
cache {} | ||
listener "unix" { | ||
address = "/var/run/vault/agent.sock" | ||
tls_disable = true | ||
} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/usr/bin/env bats | ||
|
||
load _helpers | ||
|
||
@test "csi/Agent-ConfigMap: disabled by default" { | ||
cd `chart_dir` | ||
local actual=$( (helm template \ | ||
--show-only templates/csi-agent-configmap.yaml \ | ||
. || echo "---") | tee /dev/stderr | | ||
yq 'length > 0' | tee /dev/stderr) | ||
[ "${actual}" = "false" ] | ||
} | ||
|
||
@test "csi/Agent-ConfigMap: name" { | ||
cd `chart_dir` | ||
local actual=$(helm template \ | ||
--show-only templates/csi-agent-configmap.yaml \ | ||
--set "csi.enabled=true" \ | ||
. | tee /dev/stderr | | ||
yq -r '.metadata.name' | tee /dev/stderr) | ||
[ "${actual}" = "release-name-vault-csi-provider-agent-config" ] | ||
} | ||
|
||
@test "csi/Agent-ConfigMap: Vault addr not affected by injector setting" { | ||
cd `chart_dir` | ||
local actual=$(helm template \ | ||
--show-only templates/csi-agent-configmap.yaml \ | ||
--set "csi.enabled=true" \ | ||
--release-name not-external-test \ | ||
--set 'injector.externalVaultAddr=http://vault-outside' \ | ||
. | tee /dev/stderr | | ||
yq -r '.data["config.hcl"]' | tee /dev/stderr) | ||
echo "${actual}" | grep "http://not-external-test-vault.default.svc:8200" | ||
} | ||
|
||
@test "csi/Agent-ConfigMap: Vault addr correctly set for externalVaultAddr" { | ||
cd `chart_dir` | ||
local actual=$(helm template \ | ||
--show-only templates/csi-agent-configmap.yaml \ | ||
--set "csi.enabled=true" \ | ||
--set 'global.externalVaultAddr=http://vault-outside' \ | ||
. | tee /dev/stderr | | ||
yq -r '.data["config.hcl"]' | tee /dev/stderr) | ||
echo "${actual}" | grep "http://vault-outside" | ||
} |
Oops, something went wrong.