Adds AWS KMS KeyManager support (#435)

Co-authored-by: Marco Franssen <[email protected]>
Co-authored-by: kfox1111 <[email protected]>
This commit is contained in:
Maximiliano Churichi
2023-08-18 09:52:51 +02:00
committed by GitHub
co-authored by Marco Franssen kfox1111
parent 77fe43f37d
commit 5e2e8a9188
8 changed files with 110 additions and 2 deletions
@@ -67,8 +67,28 @@ plugins:
{{- end }}
{{- end }}
{{- if gt $keyManagerUsed 1 }}
{{- fail "You can only enable a single KeyManager" }}
{{- with .Values.keyManager.awsKMS }}
{{- if eq (.enabled | toString) "true" }}
{{- $keyManagerUsed = add1 $keyManagerUsed }}
KeyManager:
- aws_kms:
plugin_data:
region: {{ .region | quote }}
key_metadata_file: "/run/spire/data/aws-kms-key-metadata"
{{- if ne .accessKeyID "" }}
access_key_id: "${AWS_KMS_ACCESS_KEY_ID}"
{{- end }}
{{- if ne .secretAccessKey "" }}
secret_access_key: "${AWS_KMS_SECRET_ACCESS_KEY}"
{{- end }}
{{- if or (ne .keyPolicy.policy "") (ne .keyPolicy.existingConfigMap "") }}
key_policy_file: "/run/spire/data/aws-kms-key-policy.json"
{{- end }}
{{- end }}
{{- end }}
{{- if ne $keyManagerUsed 1 }}
{{- fail (printf "You have to enable exactly one Key Manager. There are %d enabled." $keyManagerUsed) }}
{{- end }}
Notifier: