You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat: Make OUTBOUND_PORTS_EXCLUDE configurable via annotation or ConfigMap #235
The proxy-init init container has OUTBOUND_PORTS_EXCLUDE hardcoded to 8080 (Keycloak port) in container_builder.go. When agents need to reach services that don't participate in token exchange — such as a local Ollama instance on port 11434 — the traffic gets intercepted by Envoy and fails.
Currently, the only workaround is manually patching the deployment after each deploy:
The webhook should merge the configured exclusions with the mandatory 8080 (Keycloak) exclusion so that 8080 is always excluded.
Use Case
The GitHub Issue Agent demo uses a local Ollama instance (host.docker.internal:11434) for LLM inference. Without excluding port 11434 from the iptables redirect, the Ollama HTTP calls are intercepted by Envoy and fail with Connection refused.
This affects any agent using a non-Keycloak HTTP service that doesn't require token exchange (LLM endpoints, telemetry collectors, etc.).
References
Hardcoded value: kagenti-webhook/internal/webhook/injector/container_builder.go line 475-476
After reviewing the codebase, here's a refined approach that simplifies the original proposal.
Drop the authbridge-config ConfigMap tier
authbridge-config is an auth configuration resource — it holds Keycloak URLs, realm, token policies. Port exclusion is a network interception concern that exists even when token exchange is completely disabled. Any workload with kagenti.io/type: agent gets proxy-init + iptables interception regardless of whether authbridge-config exists. Requiring users to create an auth ConfigMap just to exclude ports conflates two independent concerns.
This uses the existing PlatformConfig system that's already wired into ContainerBuilder with hot-reload support. Add OutboundPortsExclude to ProxyConfig in config/types.go, default to "" in CompiledDefaults(), expose via Helm at defaults.proxy.outboundPortsExclude.
The webhook reads this annotation and uses it instead of the PlatformConfig default when present.
Keycloak 8080 safety
Rather than hardcoding 8080 in the shell script or relying on users to include it, BuildProxyInitContainer() always prepends 8080 to whatever user-configured value it receives (from PlatformConfig or annotation). This guarantees the Keycloak port is never accidentally omitted, regardless of configuration source.
Same approach for INBOUND_PORTS_EXCLUDE
Apply the same two-tier pattern for INBOUND_PORTS_EXCLUDE (currently not set by the webhook at all) to avoid a separate issue later.
Open PR #158 implements option 1 (annotation-based port exclusion). Review posted with requested changes (DCO fix, input validation, revert personal image). Options 2 (ConfigMap) and 3 (Helm values) can be follow-up PRs once #158 lands.
Drop the authbridge-config ConfigMap tier
authbridge-config is an auth configuration resource — it holds Keycloak URLs, realm, token policies. Port exclusion is a network interception concern that exists even when token exchange is completely disabled. Any workload with kagenti.io/type: agent gets proxy-init + iptables interception regardless of whether authbridge-config exists. Requiring users to create an auth ConfigMap just to exclude ports conflates two independent concerns.
Activity
huang195 commentedon Mar 15, 2026
Design Analysis
After reviewing the codebase, here's a refined approach that simplifies the original proposal.
Drop the
authbridge-configConfigMap tierauthbridge-configis an auth configuration resource — it holds Keycloak URLs, realm, token policies. Port exclusion is a network interception concern that exists even when token exchange is completely disabled. Any workload withkagenti.io/type: agentgets proxy-init + iptables interception regardless of whetherauthbridge-configexists. Requiring users to create an auth ConfigMap just to exclude ports conflates two independent concerns.Recommended: two tiers instead of three
Helm values / PlatformConfig (cluster-wide default):
This uses the existing
PlatformConfigsystem that's already wired intoContainerBuilderwith hot-reload support. AddOutboundPortsExcludetoProxyConfiginconfig/types.go, default to""inCompiledDefaults(), expose via Helm atdefaults.proxy.outboundPortsExclude.Pod annotation (per-workload override):
The webhook reads this annotation and uses it instead of the PlatformConfig default when present.
Keycloak 8080 safety
Rather than hardcoding 8080 in the shell script or relying on users to include it,
BuildProxyInitContainer()always prepends8080to whatever user-configured value it receives (from PlatformConfig or annotation). This guarantees the Keycloak port is never accidentally omitted, regardless of configuration source.Same approach for INBOUND_PORTS_EXCLUDE
Apply the same two-tier pattern for
INBOUND_PORTS_EXCLUDE(currently not set by the webhook at all) to avoid a separate issue later.mrsabath commentedon Mar 15, 2026
Open PR #158 implements option 1 (annotation-based port exclusion). Review posted with requested changes (DCO fix, input validation, revert personal image). Options 2 (ConfigMap) and 3 (Helm values) can be follow-up PRs once #158 lands.
huang195 commentedon Mar 15, 2026
@mrsabath regarding option 2 (from above):
Drop the authbridge-config ConfigMap tier
authbridge-config is an auth configuration resource — it holds Keycloak URLs, realm, token policies. Port exclusion is a network interception concern that exists even when token exchange is completely disabled. Any workload with kagenti.io/type: agent gets proxy-init + iptables interception regardless of whether authbridge-config exists. Requiring users to create an auth ConfigMap just to exclude ports conflates two independent concerns.