Skip to content

feat(trait): Add metricType support to the KEDA trait triggers - #6740

Merged
squakez merged 1 commit into
apache:mainfrom
wojciechgrazawskiahnl:feat/keda-trait-metrictype
Aug 5, 2026
Merged

feat(trait): Add metricType support to the KEDA trait triggers#6740
squakez merged 1 commit into
apache:mainfrom
wojciechgrazawskiahnl:feat/keda-trait-metrictype

Conversation

@wojciechgrazawskiahnl

Copy link
Copy Markdown
Contributor

This PR adds support for specifying a trigger-level metricType in the KEDA trait, mapping to KEDA's ScaleTriggers.metricType field (Utilization, AverageValue or Value).

This is required for compatibility with KEDA v2.18+, which removed the deprecated metadata.type field for the cpu and memory scalers. Without a way to set the trigger-level metricType, those scalers can no longer be configured through the KEDA trait on recent KEDA versions.

Changes

  • Added the MetricType field to KedaTrigger (pkg/apis/camel/v1/trait/keda.go), exposed as the metric-type trait property and validated against the enum Utilization/AverageValue/Value.
  • Added the MetricType field to the KEDA duck type ScaleTriggers (pkg/apis/duck/keda/v1alpha1/duck_types.go).
  • Propagated MetricType from the trait trigger to the generated ScaledObject triggers (pkg/trait/keda.go).
  • Regenerated CRDs and API docs.
  • Added TestKedaMetricType covering a cpu trigger with metricType: Utilization.

Example

traits:
  keda:
    triggers:
      - type: cpu
        metricType: Utilization
        metadata:
          value: "70"

Release Note

Add metricType support to the KEDA trait triggers (required for cpu/memory scalers on KEDA v2.18+).

@squakez squakez left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, thanks! Just a minor comment change if you wish to apply.

Comment thread pkg/apis/camel/v1/trait/keda.go Outdated
@wojciechgrazawskiahnl

Copy link
Copy Markdown
Contributor Author

LGTM, thanks! Just a minor comment change if you wish to apply.

Is there a chance to include it in 2.11.0 release ?

@squakez

squakez commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

LGTM, thanks! Just a minor comment change if you wish to apply.

Is there a chance to include it in 2.11.0 release ?

Yes, for sure.

Add an optional trigger-level `metricType` field to the KEDA trait
(`Utilization`, `AverageValue` or `Value`), mapping to KEDA's
ScaleTriggers.metricType. Required by the cpu/memory scalers in KEDA
v2.18+ where the deprecated metadata.type was removed.

Regenerated CRDs, Helm CRDs and API docs.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@wojciechgrazawskiahnl
wojciechgrazawskiahnl force-pushed the feat/keda-trait-metrictype branch from 70a5d18 to a47ad80 Compare August 5, 2026 07:54
@wojciechgrazawskiahnl

Copy link
Copy Markdown
Contributor Author

@squakez
Could you please re-run the workflow one more time? The earlier failure was because my fork had fallen behind — I've now rebased the branch onto the latest upstream main, so it should be green.

@wojciechgrazawskiahnl

Copy link
Copy Markdown
Contributor Author

@squakez
Seems failure of this job is not related to my changes https://github.com/apache/camel-k/actions/runs/30986861500/job/92246567792?pr=6740, can You please re-trigger it ?

@squakez

squakez commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Checks failure unrelated. Merging.

@squakez
squakez merged commit 2dd4504 into apache:main Aug 5, 2026
12 of 13 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.

keda trait cannot set trigger-level metricType — CPU/memory scalers broken on KEDA v2.18+

3 participants