Skip to content

feat(wrt): strip temporal_ prefix from HPA metric matchLabels when en… - #611

Open
pranavthakur0-0 wants to merge 1 commit into
temporalio:mainfrom
pranavthakur0-0:feat/wrt-hpa-strip-temporal-prefix
Open

pranavthakur0-0 wants to merge 1 commit into
temporalio:mainfrom
pranavthakur0-0:feat/wrt-hpa-strip-temporal-prefix

Conversation

@pranavthakur0-0

Copy link
Copy Markdown

Fixes #588

What was changed

  • Added default-off controller flag --wrt-hpa-match-labels-strip-temporal-prefix and env WRT_HPA_MATCH_LABELS_STRIP_TEMPORAL_PREFIX.
  • Added Helm value workerResourceTemplate.hpaMatchLabelsStripTemporalPrefix (schema + manager Deployment env).
  • When enabled, auto-injected WorkerResourceTemplate HPA external metric matchLabels use worker_deployment_name, worker_build_id, and namespace instead of temporal_worker_deployment_name, temporal_worker_build_id, and temporal_namespace.
  • Plumbed the setting through reconciler → planner → WRT renderer; webhook rejects the unprefixed keys when stripping is enabled (same controller-owned guarantee as temporal_*).
  • Documented the Helm setting in docs/worker-resource-templates.md.
  • Unit tests (env parsing, render/planner, webhook) and Helm validate workflow checks for the new env default and --set true.

Why?

Self-hosted Temporal Server OpenMetrics use native label names (worker_deployment_name, etc.). Temporal Cloud metrics use the temporal_* prefix. Today the controller always injects temporal_*, which breaks HPA external metrics against self-hosted backends unless operators rename labels out of band. This implements the maintainer plan for #588: optional prefix stripping on the three hardcoded injected keys only, without changing KEDA triggers, pod selectors, or metric values.

Testing

  • go test ./api/v1alpha1 ./internal/k8s ./internal/planner ./internal/controller
  • Helm validate CI / helm template asserts WRT_HPA_MATCH_LABELS_STRIP_TEMPORAL_PREFIX defaults to false and renders true when the value is enabled

…abled

Add default-off CLI/Helm flag so self-hosted metrics can use worker_deployment_name,
worker_build_id, and namespace; extend webhook validation when stripping is on.
@CLAassistant

CLAassistant commented Sep 19, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

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.

[Feature Request] Support worker_version selectors in WorkerResourceTemplate

2 participants