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
16 changes: 12 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,13 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Checkout pgdog
- name: Checkout pgdog-enterprise
uses: actions/checkout@v4
with:
repository: pgdogdev/pgdog
ref: main
repository: pgdogdev/pgdog-enterprise
ref: main-ent
path: pgdog-source
token: ${{ secrets.PGDOG_ENTERPRISE_TOKEN }}

- name: Install Helm
uses: azure/setup-helm@v4
Expand Down Expand Up @@ -78,7 +79,7 @@ jobs:
sudo pip3 install cmake==3.31.6

- name: Build pgdog
run: cargo build
run: cargo build --bin pgdog --bin gateway
working-directory: pgdog-source

- name: Validate configs
Expand All @@ -90,5 +91,12 @@ jobs:
rm -f /tmp/pgdog.toml
./test/generate-config.sh "$values_file" /tmp/pgdog.toml
./pgdog-source/target/debug/pgdog --config=/tmp/pgdog.toml configcheck

# Check if gateway is enabled and validate gateway config
rm -f /tmp/gateway.toml
if ./test/generate-gateway-config.sh "$values_file" /tmp/gateway.toml 2>/dev/null; then
echo "==> Validating gateway config for $name..."
./pgdog-source/target/debug/gateway --config=/tmp/gateway.toml configcheck
fi
done
echo "==> All configs valid!"
1 change: 1 addition & 0 deletions templates/gateway/gateway-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,5 @@ data:
ping_interval = {{ .Values.gateway.stats.pingInterval | default 1000 }}
push_interval = {{ .Values.gateway.stats.pushInterval | default 1000 }}
config_interval = {{ .Values.gateway.stats.configInterval | default 1000 }}
query_stats_interval = {{ .Values.gateway.stats.queryStatsInterval | default 60_000 }}
{{- end }}
27 changes: 27 additions & 0 deletions test/generate-gateway-config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash
set -eo pipefail

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-gateway.yaml gateway-config.toml"
exit 1
fi

VALUES_FILE="$1"

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

if [ -z "$output" ] || [ "$output" = "null" ]; then
echo "No gateway config found. Make sure gateway.enabled is true in your values file."
exit 1
fi

if [ -z "$2" ]; then
echo "$output"
else
echo "$output" > "$2"
fi
66 changes: 66 additions & 0 deletions test/values-gateway.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Test gateway configuration (Enterprise Edition)
gateway:
enabled: true
port: 8443
bindAddress: "0.0.0.0"
image:
repository: ghcr.io/pgdogdev/pgdog-enterprise/gateway
tag: "main-ent"
pullPolicy: Always
resources:
requests:
cpu: 500m
memory: 512Mi
limits:
cpu: 1000m
memory: 1Gi
tls:
existingSecret: "gateway-tls-secret"
control:
url: "wss://control.example.com/ws"
token: "test-token-12345"
stats:
activeQueriesInterval: 2000
pingInterval: 1500
pushInterval: 3000
configInterval: 5000
service:
type: ClusterIP
annotations:
service.beta.kubernetes.io/aws-load-balancer-internal: "true"
nodeSelector:
node-type: gateway
tolerations:
- key: dedicated
operator: Equal
value: gateway
effect: NoSchedule
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchLabels:
app: pgdog-gateway
topologyKey: kubernetes.io/hostname
connectFromPgdog: true

# Enable query stats since gateway is enabled
queryStats:
enabled: true
queryPlanThreshold: 500
queryPlanMaxAge: 30000
queryPlansCache: 200
maxErrors: 50
maxErrorAge: 600000

# Basic database config for testing gateway integration
databases:
- name: primary
host: postgres.example.com
port: 5432

users:
- username: app_user
password: secret123
Loading