Skip to content

feat(controller): let the module controller serve its admission webhooks - #237

Merged
duckhawk merged 1 commit into
mainfrom
feat/module-controller-webhooks-in-process
Nov 16, 2026
Merged

duckhawk merged 1 commit into
mainfrom
feat/module-controller-webhooks-in-process

Conversation

@duckhawk

Copy link
Copy Markdown
Member

Description

Adds the webhooksInController option to helm_lib_module_controller_manifests (default false, used only together with webhookEnabled). With it:

  • the webhooks container and its VPA policy are not rendered;
  • the controller container gets the https port (webhooksPort, the port name the webhook Service targets), rendered after the metrics port and before additionalControllerPorts;
  • the webhook certificate Secret (webhook-certs volume, unchanged) is mounted read-only into the controller at webhooksCertMountPath;
  • the controller gets WEBHOOKS_BIND_ADDRESS=:<webhooksPort> and WEBHOOKS_CERT_DIR=<webhooksCertMountPath>.

The checksum/ca annotation and the volume stay. webhooksImageName and webhooksCommand are not used in this mode. Chart version 1.72.38.

The controller side is the webhookserver package of sds-common-lib: it reads the two variables, serves the module's existing handlers on a controller-runtime webhook server inside the manager and reports the pod ready only once the TLS listener is up.

Why do we need it, and what problem does it solve?

Part of reducing the memory requests of the storage modules on master nodes. With webhookEnabled every controller pod runs a second Go process for a few validating handlers; on three masters that is one more container request per controller replica in every module (about 0.45 GiB of working set across the storage modules on a test cluster), for code the controller binary can serve itself.

What is the expected result?

  • Modules that do not set the option render exactly as before.
  • With webhookEnabled: true and webhooksInController: true the controller pod has one container; the webhook Service reaches the controller's https port, and admission works as soon as the pod is Ready.

Checklist

  • The code is covered by unit tests.
  • e2e tests passed.
  • Documentation updated according to the changes.
  • Changes were tested in the Kubernetes cluster manually.

With webhookEnabled the module controller pod runs two Go processes: the
controller and a "webhooks" container that serves a few validating
handlers. On masters that is a container request per controller replica
for handlers the controller binary can serve itself.

Add webhooksInController (default false, used only with webhookEnabled).
With it the webhooks container and its VPA policy are not rendered, and the
controller container gets what the webhooks container had:

- the "https" port (webhooksPort), which the webhook Service targets by
  name, rendered after the metrics port and before additionalControllerPorts;
- the webhook certificate Secret mounted read-only at webhooksCertMountPath;
- WEBHOOKS_BIND_ADDRESS=:<webhooksPort> and
  WEBHOOKS_CERT_DIR=<webhooksCertMountPath>, which the webhookserver
  package of sds-common-lib reads.

The pod keeps the checksum/ca annotation and the webhook-certs volume. The
controller has to serve the handlers there over TLS and report ready only
once the listener is up, since pod readiness is what puts the pod behind
the webhook Service. Modules that do not set the option render as before.

Signed-off-by: v.oleynikov <vasily.oleynikov@flant.com>
@duckhawk
duckhawk merged commit cce54da into main Nov 16, 2026
4 checks passed
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