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 values to Helm chart for using a shared credentials file #341

Merged
merged 2 commits into from
Jun 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
10 changes: 10 additions & 0 deletions templates/helm/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,13 @@ If release name contains chart name it will be used as a full name.
{{- .Release.Namespace -}}
{{- end -}}
{{- end -}}

{{/* The mount path for the shared credentials file */}}
{{- define "aws.credentials.secret_mount_path" -}}
{{- "/var/run/secrets/aws" -}}
{{- end -}}

{{/* The path the shared credentials file is mounted */}}
{{- define "aws.credentials.path" -}}
{{- printf "%s/%s" (include "aws.credentials.secret_mount_path" .) .Values.aws.credentials.secretKey -}}
{{- end -}}
16 changes: 16 additions & 0 deletions templates/helm/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,16 @@ spec:
value: {{ .Values.log.level | quote }}
- name: ACK_RESOURCE_TAGS
value: {{ join "," .Values.resourceTags | quote }}
{{- if .Values.aws.credentials.secretName }}
- name: AWS_SHARED_CREDENTIALS_FILE
value: {{ include "aws.credentials.path" . }}
- name: AWS_PROFILE
value: {{ .Values.aws.credentials.profile }}
volumeMounts:
- name: {{ .Values.aws.credentials.secretName }}
mountPath: {{ include "aws.credentials.secret_mount_path" . }}
readOnly: true
{{- end }}
securityContext:
allowPrivilegeEscalation: false
privileged: false
Expand All @@ -101,3 +111,9 @@ spec:
hostIPC: false
hostNetwork: false
hostPID: false
{{ if .Values.aws.credentials.secretName -}}
volumes:
- name: {{ .Values.aws.credentials.secretName }}
secret:
secretName: {{ .Values.aws.credentials.secretName }}
{{ end -}}
15 changes: 15 additions & 0 deletions templates/helm/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,21 @@
},
"endpoint": {
"type": "string"
},
"credentials": {
"description": "AWS credentials information",
"properties": {
"secretName": {
"type": "string"
},
"secretKey": {
"type": "string"
},
"profile": {
"type": "string"
}
},
"type": "object"
}
},
"type": "object"
Expand Down
7 changes: 7 additions & 0 deletions templates/helm/values.yaml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ aws:
# If specified, use the AWS region for AWS API calls
region: ""
endpoint_url: ""
credentials:
# If specified, Secret with shared credentials file to use.
secretName: ""
# Secret stringData key that contains the credentials
secretKey: "credentials"
# Profile used for AWS credentials
profile: "default"

# log level for the controller
log:
Expand Down