Skip to content

feat: pass LOG_LEVEL to the webhooks container, expose a CSI node metrics port - #210

Open
duckhawk wants to merge 1 commit into
mainfrom
feat/webhooks-envs-and-csi-node-metrics-port
Open

feat: pass LOG_LEVEL to the webhooks container, expose a CSI node metrics port#210
duckhawk wants to merge 1 commit into
mainfrom
feat/webhooks-envs-and-csi-node-metrics-port

Conversation

@duckhawk

Copy link
Copy Markdown
Member

Description

Two additive parameters, both needed by the storage modules that are consolidating on one logger and one metrics endpoint.

helm_lib_module_controller_manifests — the webhooks container now gets an env: block:

  • LOG_LEVEL, from helm_lib_module_controller_log_level, exactly as the controller container already gets it.
  • additionalWebhooksEnvs, the counterpart of the existing additionalControllerEnvs.

helm_lib_csi_node_manifests — new nodeMetricsPort, which renders a named metrics containerPort on the node container.

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

The webhooks container gets no environment at all, and there is no way to add any. A module that wants to set the webhook's log level has to override webhooksCommand; and because overriding the command means restating the TLS flags, it also has to restate webhooksCertMountPath. The result is a chart carrying a copy of lib-helm's own default command purely to pass one variable, which then silently drifts from the library's. Injecting LOG_LEVEL from the same helper the controller uses also means the two containers of one Deployment cannot disagree about the level.

helm_lib_csi_node_manifests exposes no container port. helm_lib_csi_controller_manifests has additionalControllerPorts and helm_lib_module_controller_manifests has controllerMetricsPort, but a CSI node DaemonSet has neither — and it has no Service either, so the only way to scrape it today is a PodMonitor on a numeric targetPort, which silently follows the container's port if it ever moves. A named port lets the PodMonitor select it by name.

What is the expected result?

Both parameters are additive. A chart that sets neither renders exactly as before, with one intended exception: webhookEnabled: true now adds LOG_LEVEL to the webhooks container, so the controller Deployment rolls once on upgrade. The webhook binaries that do not read it are unaffected.

With them set:

{{- include "helm_lib_module_controller_manifests" (list . (dict
  "valuesKey" "csiCeph"
  "webhookEnabled" true
  "controllerMetricsPort" 8080
  "additionalWebhooksEnvs" (list (dict "name" "METRICS_BIND_ADDRESS" "value" ":8081"))
)) }}

{{- include "helm_lib_csi_node_manifests" (list . (dict
  "nodeImage" $nodeImage
  "driverFQDN" "ceph.csi.storage.deckhouse.io"
  "nodeMetricsPort" 8080
)) }}

renders LOG_LEVEL plus METRICS_BIND_ADDRESS on the webhooks container, and a named metrics port on the CSI node container that a PodMonitor can reference as port: metrics.

Covered by four new cases in helm_lib_module_controller_manifests_test.yaml and helm_lib_csi_node_test.yaml: the level reaches the webhooks container as the numeric value, additionalWebhooksEnvs is appended after it, the named port renders when nodeMetricsPort is set, and no ports key appears when it is not. helm unittest ./tests/ — 362 passed.

Chart version bumped to 1.72.16; 1.72.15 is taken by the open VPA PR, so this leaves that one free to merge in either order.

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.

…rics port

Two gaps that block the storage modules from moving onto one logger and one
metrics endpoint.

The webhooks container gets no environment at all, and there is no way to add
any: a module wanting to set its log level has to override webhooksCommand, and
because overriding the command means restating the TLS flags, it ends up
restating webhooksCertMountPath too. LOG_LEVEL is now injected the same way the
controller container gets it -- from helm_lib_module_controller_log_level, so the
two containers of one Deployment cannot disagree about the level -- and
additionalWebhooksEnvs covers anything else a module needs.

helm_lib_csi_node_manifests exposes no container port. helm_lib_csi_controller_
manifests has additionalControllerPorts and helm_lib_module_controller_manifests
has controllerMetricsPort, but a CSI node DaemonSet has neither, and it has no
Service either, so scraping it means a PodMonitor on a numeric targetPort that
silently follows the port if it ever moves. nodeMetricsPort renders a named
"metrics" containerPort a PodMonitor can select by name.

Both are additive: a chart that sets neither renders exactly as before.

Signed-off-by: v.oleynikov <vasily.oleynikov@flant.com>
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.

1 participant