Skip to content

Commit

Permalink
helm: Fix indenting on database autodiscovery (#10622)
Browse files Browse the repository at this point in the history
I had previously assumed that db_service.aws and db_service.databases.aws were the same key; they are not. This PR fixes this error.
  • Loading branch information
webvictim authored Feb 25, 2022
1 parent 278b3b7 commit aa1d3c6
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
21 changes: 21 additions & 0 deletions examples/chart/teleport-kube-agent/aws-and-manual-db.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
authToken: auth-token
proxyAddr: proxy.example.com:3080
roles: db
awsDatabases:
- types: ["rds"]
regions: ["us-east-1"]
tags:
"*": "*"
- types: ["rds"]
regions: ["us-west-2"]
tags:
"env": "development"
databases:
- name: aurora
uri: "postgres-aurora-instance-1.xxx.us-east-1.rds.amazonaws.com:5432"
protocol: "postgres"
labels:
database: staging
annotations:
serviceAccount:
eks.amazonaws.com/role-arn: arn:aws:iam::1234567890:role/my-rds-autodiscovery-role
9 changes: 3 additions & 6 deletions examples/chart/teleport-kube-agent/templates/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,8 @@ data:
{{- if not (or (.Values.awsDatabases) (.Values.databases)) }}
{{- fail "'awsDatabases' and/or 'databases' is required in chart values when db role is enabled, see README" }}
{{- end }}
databases:
{{- if .Values.awsDatabases }}
aws:
aws:
{{- range $awsDb := .Values.awsDatabases }}
{{- if not (hasKey $awsDb "types") }}
{{- fail "'types' is required for all 'awsDatabases' in chart values when key is set and db role is enabled, see README" }}
Expand All @@ -70,13 +69,11 @@ data:
{{- fail "'tags' is required for all 'awsDatabases' in chart values when key is set and db role is enabled, see README" }}
{{- end }}
{{- end }}
{{- toYaml .Values.awsDatabases | nindent 8 }}
{{- toYaml .Values.awsDatabases | nindent 6 }}
{{- end }}
{{- if .Values.databases }}
databases:
{{- range $db := .Values.databases }}
{{- if (and ($.Values.awsDatabases) (hasKey $db "aws")) }}
{{- fail "The 'aws' key cannot be used under 'databases' when 'awsDatabases' is also set - use autodiscovery for AWS databases, or run a separate agent without awsDatabases" }}
{{- end }}
{{- if not (hasKey $db "name") }}
{{- fail "'name' is required for all 'databases' in chart values when db role is enabled, see README" }}
{{- end }}
Expand Down

0 comments on commit aa1d3c6

Please sign in to comment.