Skip to content

Commit 2364ebe

Browse files
authored
Test enterprise config (#54)
* Test gateway config * use right branch * fix chart typo
1 parent 2eda9db commit 2364ebe

File tree

4 files changed

+106
-4
lines changed

4 files changed

+106
-4
lines changed

.github/workflows/test.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,13 @@ jobs:
3838
- name: Checkout repository
3939
uses: actions/checkout@v4
4040

41-
- name: Checkout pgdog
41+
- name: Checkout pgdog-enterprise
4242
uses: actions/checkout@v4
4343
with:
44-
repository: pgdogdev/pgdog
45-
ref: main
44+
repository: pgdogdev/pgdog-enterprise
45+
ref: main-ent
4646
path: pgdog-source
47+
token: ${{ secrets.PGDOG_ENTERPRISE_TOKEN }}
4748

4849
- name: Install Helm
4950
uses: azure/setup-helm@v4
@@ -78,7 +79,7 @@ jobs:
7879
sudo pip3 install cmake==3.31.6
7980
8081
- name: Build pgdog
81-
run: cargo build
82+
run: cargo build --bin pgdog --bin gateway
8283
working-directory: pgdog-source
8384

8485
- name: Validate configs
@@ -90,5 +91,12 @@ jobs:
9091
rm -f /tmp/pgdog.toml
9192
./test/generate-config.sh "$values_file" /tmp/pgdog.toml
9293
./pgdog-source/target/debug/pgdog --config=/tmp/pgdog.toml configcheck
94+
95+
# Check if gateway is enabled and validate gateway config
96+
rm -f /tmp/gateway.toml
97+
if ./test/generate-gateway-config.sh "$values_file" /tmp/gateway.toml 2>/dev/null; then
98+
echo "==> Validating gateway config for $name..."
99+
./pgdog-source/target/debug/gateway --config=/tmp/gateway.toml configcheck
100+
fi
93101
done
94102
echo "==> All configs valid!"

templates/gateway/gateway-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,5 @@ data:
3131
ping_interval = {{ .Values.gateway.stats.pingInterval | default 1000 }}
3232
push_interval = {{ .Values.gateway.stats.pushInterval | default 1000 }}
3333
config_interval = {{ .Values.gateway.stats.configInterval | default 1000 }}
34+
query_stats_interval = {{ .Values.gateway.stats.queryStatsInterval | default 60_000 }}
3435
{{- end }}

test/generate-gateway-config.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
set -eo pipefail
3+
4+
TEST_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
5+
CHART_DIR="$TEST_DIR/.."
6+
7+
if [ -z "$1" ]; then
8+
echo "Usage: $0 <values-file> [output-file]"
9+
echo "Example: $0 values-gateway.yaml gateway-config.toml"
10+
exit 1
11+
fi
12+
13+
VALUES_FILE="$1"
14+
15+
output=$(helm template pgdog "$CHART_DIR" -f "$VALUES_FILE" \
16+
| yq -r 'select(.kind == "ConfigMap" and .metadata.name == "pgdog-gateway") | .data["config.toml"]')
17+
18+
if [ -z "$output" ] || [ "$output" = "null" ]; then
19+
echo "No gateway config found. Make sure gateway.enabled is true in your values file."
20+
exit 1
21+
fi
22+
23+
if [ -z "$2" ]; then
24+
echo "$output"
25+
else
26+
echo "$output" > "$2"
27+
fi

test/values-gateway.yaml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Test gateway configuration (Enterprise Edition)
2+
gateway:
3+
enabled: true
4+
port: 8443
5+
bindAddress: "0.0.0.0"
6+
image:
7+
repository: ghcr.io/pgdogdev/pgdog-enterprise/gateway
8+
tag: "main-ent"
9+
pullPolicy: Always
10+
resources:
11+
requests:
12+
cpu: 500m
13+
memory: 512Mi
14+
limits:
15+
cpu: 1000m
16+
memory: 1Gi
17+
tls:
18+
existingSecret: "gateway-tls-secret"
19+
control:
20+
url: "wss://control.example.com/ws"
21+
token: "test-token-12345"
22+
stats:
23+
activeQueriesInterval: 2000
24+
pingInterval: 1500
25+
pushInterval: 3000
26+
configInterval: 5000
27+
service:
28+
type: ClusterIP
29+
annotations:
30+
service.beta.kubernetes.io/aws-load-balancer-internal: "true"
31+
nodeSelector:
32+
node-type: gateway
33+
tolerations:
34+
- key: dedicated
35+
operator: Equal
36+
value: gateway
37+
effect: NoSchedule
38+
affinity:
39+
podAntiAffinity:
40+
preferredDuringSchedulingIgnoredDuringExecution:
41+
- weight: 100
42+
podAffinityTerm:
43+
labelSelector:
44+
matchLabels:
45+
app: pgdog-gateway
46+
topologyKey: kubernetes.io/hostname
47+
connectFromPgdog: true
48+
49+
# Enable query stats since gateway is enabled
50+
queryStats:
51+
enabled: true
52+
queryPlanThreshold: 500
53+
queryPlanMaxAge: 30000
54+
queryPlansCache: 200
55+
maxErrors: 50
56+
maxErrorAge: 600000
57+
58+
# Basic database config for testing gateway integration
59+
databases:
60+
- name: primary
61+
host: postgres.example.com
62+
port: 5432
63+
64+
users:
65+
- username: app_user
66+
password: secret123

0 commit comments

Comments
 (0)