Repository navigation
[fix] Allow Postgres egress for agent-sandbox controller and proxy - #374
Merged
Merged
Conversation
Contributor
|
| Filename | Overview |
|---|---|
| charts/retool/templates/_helpers.tpl | postgresEgressPort now picks the port from the active Postgres connection path. It fixes the earlier mismatch for custom postgres.port values. |
| charts/retool/templates/agent_sandbox_networkpolicy.yaml | The controller and proxy share destination-scoped Postgres egress rules. No new issue was found in the latest changes. |
| charts/retool/values.yaml | Documents the Postgres egress port, allowlist, and explicit allow-any switch. |
| values.yaml | Keeps the published defaults in sync with charts/retool/values.yaml. |
| charts/retool/templates/NOTES.txt | Warns when the agent sandbox policy has no allowed Postgres destination. |
| charts/retool/Chart.yaml | Raises the chart version for the template change. |
Reviews (3): Last reviewed commit: "Allow Postgres egress for agent-sandbox ..." | Re-trigger Greptile
westrik
force-pushed
the
r2_allow_postgres_egress
branch
from
September 14, 2026 21:12
fb99473 to
09f54f2
Compare
With `rr.agentSandbox.networkPolicy.enabled: true`, the controller's
only open-Internet egress was `0.0.0.0/0` restricted to ports 443/6443
and the proxy's allow-all rule subtracted `blockedRanges` (all of
RFC 1918) — so `STATE_BACKEND: postgres` was unreachable.
Add destination-scoped Postgres egress rules, shared by both policies
(`retool.agentSandbox.postgresEgressRules`):
- inherited in-cluster subchart -> automatic podSelector rule
- `postgresAllowlist` -> CIDR strings or
podSelector/namespaceSelector maps
- `postgresAllowAny` -> opt-in any-destination escape
hatch for urlSecretName DSNs
The rule port mirrors `postgresUrlEnv`'s precedence so the policy always
matches what the pods dial (`retool.agentSandbox.postgresEgressPort`):
`postgres.port` on the fields path, the inherited backend port on the
inherit path, and `postgresPort` (default 5432, null to disable) only
for DSNs (`postgres.url` / `urlSecretName`) whose port Helm cannot read.
A NOTES.txt warning fires when the policy is on but no destination is
allowed — fail-closed, since NetworkPolicy rules add together and a
blanket port-only rule would reopen all of blockedRanges on that port.
westrik
force-pushed
the
r2_allow_postgres_egress
branch
from
September 14, 2026 21:18
09f54f2 to
376bc84
Compare
westrik
marked this pull request as ready for review
September 14, 2026 21:21
jamie-retool
approved these changes
Sep 14, 2026
richard-davison-retool
approved these changes
Sep 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With
rr.agentSandbox.networkPolicy.enabled: true, the controller's only open-Internet egress was0.0.0.0/0restricted to ports 443/6443 and the proxy's allow-all rule subtractedblockedRanges(all of RFC 1918) — soSTATE_BACKEND: postgreswas unreachable.Add destination-scoped Postgres egress rules, shared by both policies (
retool.agentSandbox.postgresEgressRules):postgresAllowlist→ CIDR strings or podSelector/namespaceSelector mapspostgresAllowAny→ opt-in any-destination escape hatch for urlSecretName DSNsThe rule port mirrors
postgresUrlEnv's precedence so the policy always matches what the pods dial (retool.agentSandbox.postgresEgressPort):postgres.porton the fields path, the inherited backend port on the inherit path, andpostgresPort(default 5432, null to disable) only for DSNs (postgres.url/urlSecretName) whose port Helm cannot read.A NOTES.txt warning fires when the policy is on but no destination is allowed. This fails closed, since NetworkPolicy rules add together and a blanket port-only rule would reopen all of blockedRanges on that port.