Skip to content

feat(management-proxy): expose replicas, panic threshold and admin bind address - #2717

Open
philxiao wants to merge 1 commit into
weka:mainfrom
philxiao:feat/management-proxy-tunables
Open

feat(management-proxy): expose replicas, panic threshold and admin bind address#2717
philxiao wants to merge 1 commit into
weka:mainfrom
philxiao:feat/management-proxy-tunables

Conversation

@philxiao

@philxiao philxiao commented Aug 4, 2026

Copy link
Copy Markdown

Makes three management-proxy settings configurable via the chart. Defaults preserve current behaviour.

value default was
managementProxy.replicas 2 hardcoded 2
managementProxy.healthyPanicThreshold 50 never emitted (Envoy's implicit 50)
managementProxy.adminBindAddress 0.0.0.0 hardcoded 0.0.0.0

Why healthyPanicThreshold matters

healthy_panic_threshold was never emitted into the Envoy config, so Envoy's 50% default applied. Once fewer than half the upstreams fail their health check, Envoy enters panic mode and load balances across all hosts — including ones it knows are down.

Where only some management IPs are reachable from the pod network, this turns a partial outage into a near-total one: most requests get routed into connect timeouts even though a healthy subset exists. Setting the threshold to 0 keeps traffic on the reachable subset and degrades gracefully.

We hit this on a cluster where a subset of the management IPs was unreachable from the pod network — the proxy was healthy, the reachable backends were healthy, and the API was still effectively down.

adminBindAddress

Envoy's admin API is unauthenticated and includes /quitquitquit and /drain_listeners. With hostNetwork: true that is exposed on the node's network, so this allows restricting it to loopback.

When the admin address is not 0.0.0.0, the liveness/readiness probes switch from HTTPGet /ready on 9901 to a TCP check on the proxy listener — kubelet probes the pod IP and cannot reach loopback, so the HTTP probe would fail by construction.

--use-dynamic-base-id under hostNetwork

Envoy keys its shared-memory region and its @envoy_domain_socket_* abstract sockets off --base-id, which defaults to 0. The abstract socket namespace is per network namespace, so under hostNetwork the proxy collides with any other Envoy in the host netns — notably cilium-envoy, which runs hostNetwork on every node in a Cilium cluster using L7 features. It's a hard startup error and a crash loop:

unable to bind domain socket with base_id=0, id=0, errno=98

--use-dynamic-base-id makes Envoy pick a free base id. Applied only when hostNetwork is enabled, since in a pod netns base id 0 is unambiguous and changing it would be a needless behaviour change.

Notes

  • The chart renders healthyPanicThreshold with a kindIs "invalid" check rather than default, because default swallows an explicit 0 — which is the value most worth setting.
  • The MANAGEMENT_PROXY_* env is read per operator instance, so these are effectively per-Kubernetes-cluster; they are shared between multiple WekaClusters managed by the same operator. Happy to move any of them onto WekaCluster.spec.managementProxy for per-cluster override if you'd prefer that shape.
  • go build ./internal/... and go vet on the changed packages are clean.

🤖 Generated with Claude Code

…nd address

Adds managementProxy.replicas (was hardcoded to 2),
managementProxy.healthyPanicThreshold and managementProxy.adminBindAddress.

healthy_panic_threshold was never emitted, so Envoy's 50% default applied: once
fewer than half the upstreams pass their health check, Envoy stops honouring
health checks and load balances across all hosts, including ones it knows are
down. Where only some management IPs are reachable from the pod network this
turns a partial outage into a near-total one; setting it to 0 keeps traffic on
the reachable subset.

adminBindAddress allows restricting Envoy's unauthenticated admin API to
loopback, which matters with hostNetwork. The probes switch from HTTPGet /ready
on 9901 to a TCP check on the proxy listener when it is not 0.0.0.0, since
kubelet probes the pod IP and cannot reach loopback.

Also pass --use-dynamic-base-id when hostNetwork is enabled. Envoy keys its
shared memory and abstract domain sockets off --base-id, defaulting to 0, and
the abstract namespace is per netns, so it collides with any other Envoy in the
host netns and crash-loops with "unable to bind domain socket with base_id=0,
id=0, errno=98".

Defaults preserve current behaviour.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@philxiao
philxiao requested a review from a team as a code owner August 4, 2026 22:54
@graphite-app

graphite-app Bot commented Aug 4, 2026

Copy link
Copy Markdown

Graphite Automations

"Add anton/matt/sergey/kristina as reviwers on operator PRs" took an action on this PR • (08/04/26)

3 reviewers were added to this PR based on Anton Bykov's automation.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR makes several Envoy management-proxy behaviors configurable via the Helm chart (and operator env/config), aiming to preserve existing defaults while enabling safer operation under partial upstream reachability and hostNetwork.

Changes:

  • Add configurable managementProxy.replicas, managementProxy.healthyPanicThreshold, and managementProxy.adminBindAddress surfaced through chart → env vars → operator config.
  • Emit healthy_panic_threshold and configurable admin bind address into the generated Envoy config; adjust probes and Envoy command line (dynamic base-id under hostNetwork).
  • Update the management-proxy Deployment to use the new settings (replicas, command, probe handler, hostNetwork).

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
internal/controllers/wekacluster/funcs_management_proxy.go Generate Envoy config with new LB/admin settings; update Deployment wiring (replicas/command/probes/hostNetwork).
internal/config/env.go Add operator config fields and env parsing for the new management-proxy settings.
charts/weka-operator/values.yaml Expose new managementProxy values and document their intent/defaults.
charts/weka-operator/templates/manager.yaml Plumb new chart values into MANAGEMENT_PROXY_* env vars for the operator Deployment.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/config/env.go
Comment on lines +601 to +605
Config.ManagementProxyReplicas = getIntEnvOrDefault("MANAGEMENT_PROXY_REPLICAS", 2)
// Envoy's own default is 50. Set to 0 to disable panic mode, so the proxy
// only ever routes to upstreams that pass their health check.
Config.ManagementProxyHealthyPanicThreshold = getIntEnvOrDefault("MANAGEMENT_PROXY_HEALTHY_PANIC_THRESHOLD", 50)
Config.ManagementProxyAdminBindAddress = env.GetString("MANAGEMENT_PROXY_ADMIN_BIND_ADDRESS", "0.0.0.0")
Comment on lines +457 to +459
# Defaults for every cluster this operator manages. Each of these can be
# overridden per cluster via WekaCluster.spec.managementProxy.
#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants