Skip to content
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
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ jobs:
for values_file in test/values-*.yaml; do
name=$(basename "$values_file" .yaml | sed 's/values-//')
echo "==> Validating config for $name..."
rm -f /tmp/pgdog.toml
./test/generate-config.sh "$values_file" /tmp/pgdog.toml
./test/generate-config.sh "$values_file" /tmp/pgdog.toml /tmp/users.toml
docker run --rm \
-v /tmp/pgdog.toml:/tmp/pgdog.toml:ro \
-v /tmp/users.toml:/tmp/users.toml:ro \
"$PGDOG_IMAGE" \
/usr/local/bin/pgdog --config=/tmp/pgdog.toml configcheck
/usr/local/bin/pgdog --config=/tmp/pgdog.toml --users=/tmp/users.toml configcheck
done
echo "==> All configs valid!"
4 changes: 2 additions & 2 deletions Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: v1
name: pgdog
version: v0.93
appVersion: "v0.1.61"
version: v0.94
appVersion: "v0.1.63"
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,6 @@ users:
password: "hunter2" # See ExternalSecrets for secure storage
```

Set `authType` on a user to override the general `authType` setting. It accepts
the same values and renders as `auth_type` in `users.toml`.

**⚠️ For production**: Use ExternalSecrets instead of plain text
passwords (see ExternalSecrets section below).

Expand Down
3 changes: 3 additions & 0 deletions templates/secrets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ idle_timeout = {{ .idleTimeout }}
{{- if .readOnly }}
read_only = {{ .readOnly }}
{{- end }}
{{- if hasKey . "readWriteSplit" }}
read_write_split = {{ .readWriteSplit | quote }}
{{- end }}
{{- if hasKey . "schemaAdmin" }}
schema_admin = {{ .schemaAdmin }}
{{- end }}
Expand Down
14 changes: 11 additions & 3 deletions test/generate-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,26 @@ TEST_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
CHART_DIR="$TEST_DIR/.."

if [ -z "$1" ]; then
echo "Usage: $0 <values-file> [output-file]"
echo "Example: $0 values-full.yaml pgdog.toml"
echo "Usage: $0 <values-file> [output-file] [users-output-file]"
echo "Example: $0 values-full.yaml pgdog.toml users.toml"
exit 1
fi

VALUES_FILE="$1"

output=$(helm template pgdog "$CHART_DIR" -f "$VALUES_FILE" \
rendered=$(helm template pgdog "$CHART_DIR" -f "$VALUES_FILE")
output=$(echo "$rendered" \
| yq -r 'select(.kind == "ConfigMap" and .metadata.name == "pgdog") | .data["pgdog.toml"]')

if [ -z "$2" ]; then
echo "$output"
else
echo "$output" > "$2"
fi

if [ -n "$3" ]; then
# An absent Secret (e.g. externally managed users) produces an empty users file.
echo "$rendered" \
| yq -r 'select(.kind == "Secret" and .metadata.name == "pgdog") | .data["users.toml"] // ""' \
| base64 -d > "$3"
fi
3 changes: 2 additions & 1 deletion test/values-control.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ databases:
port: 5432

users:
- username: app_user
- name: app_user
database: primary
password: secret123
9 changes: 6 additions & 3 deletions test/values-full.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,13 @@ databases:
shard: 1

users:
- username: app_user
- name: app_user
database: primary
password: secret123
poolMode: transaction
- username: admin_user
poolerMode: transaction
readWriteSplit: exclude_primary
- name: admin_user
database: primary
password: admin123

shardedTables:
Expand Down
3 changes: 2 additions & 1 deletion test/values-rewrite.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ databases:
port: 5432

users:
- username: app_user
- name: app_user
database: primary
password: secret123
1 change: 1 addition & 0 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ databases: []
# camelCase format.
# Set identity on a user to match the identity in its client TLS certificate.
# Set authType on a user to override the general authType setting.
# Set readWriteSplit on a user to render read_write_split in users.toml (optional).
# Set serverIamRegion to the AWS region for RDS IAM authentication
# when serverAuth is rds_iam.
# Set serverIamAssumeRole to an IAM role ARN to assume for RDS IAM authentication
Expand Down
Loading