Skip to content

fix(keda): show JSON-based scaler config in the resources editor - #3184

Merged
rmnbrd merged 3 commits into
stagingfrom
fix/keda-scaler-json-config
Nov 6, 2026
Merged

rmnbrd merged 3 commits into
stagingfrom
fix/keda-scaler-json-config

Conversation

@RemiBonnet

@RemiBonnet RemiBonnet commented Nov 6, 2026 •

Copy link
Copy Markdown
Member

Summary

Issue: Pylon #5246

KEDA scalers created through the Terraform provider with a JSON-based config only populate config_json on the autoscaling response. The resources settings form only read config_yaml when building its default values, so the scaler configuration editor rendered empty for these scalers, even though the scaler itself was correctly configured and running.

This PR displays, edits and saves these scalers as JSON:

  • Display: when config_yaml is absent, the form loads config_json pretty-printed and marks the scaler as JSON-based (configFormat: 'json').
  • Editor: the label (Configuration (JSON) / Configuration (YAML)), syntax highlighting and hint follow the scaler's format. If a JSON-based config stops being a valid JSON object, a warning says it will be saved as YAML.
  • Save: JSON-based scalers are sent back as config_json, so saving from the Console doesn't switch a Terraform-managed scaler to config_yaml (which would create drift). Content that isn't a valid JSON object falls back to config_yaml. Both the editor warning and the payload use the same parseScalerJsonConfig helper.

Changes:

  • service-resources-settings.tsx: getDefaultValues falls back to config_json and sets configFormat.
  • keda-scalers-fields.tsx: dynamic label, editor language and hint, plus the invalid-JSON warning.
  • autoscaling-payload.ts: configFormat is passed through the form request, parseScalerJsonConfig is exported, and JSON scalers are sent as config_json.
  • application-creation-flow.interface.ts: optional configFormat on scalers. New scalers default to YAML, and the service creation flow is unchanged.
  • Specs for the config_json fallback and config_yaml precedence, the dynamic label and warning, and the payload format, including invalid JSON and valid JSON that isn't an object.

Screenshots / Recordings

Before After
Scaler configuration editor empty for a Terraform-created scaler Editor labeled Configuration (JSON) showing the pretty-printed JSON config

Testing

  • Changes tested locally in the relevant Console's pages and Storybooks
  • yarn test or yarn test -u (if you need to regenerate snapshots)
  • yarn format
  • yarn lint

PR Checklist

  • I followed naming, styling, and TypeScript rules (see .cursor/rules)
  • I performed a self-review (diff inspected, dead code removed)
  • I titled the PR using Conventional Commits with a scope when possible (e.g. feat(service): add new Terraform service) - required for semantic-release
  • I only kept necessary comments, written in English (watch for useless AI comments)
  • I involved a designer to validate UI changes if I am not a designer
  • I covered new business logic with tests (unit)
  • I confirmed CI is green (Codecov red can be accepted)
  • I reviewed and executed locally any AI-assisted code

🤖 Generated with Claude Code

@nx-cloud

nx-cloud Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit cb66595

Command Status Duration Result
nx run console:build --parallel=3 --configurati... ✅ Succeeded 1m 51s View ↗
nx affected --target=test --parallel=3 --config... ✅ Succeeded <1s View ↗
nx affected --target=lint --parallel=3 ✅ Succeeded <1s View ↗
nx-cloud record -- yarn nx format:check ✅ Succeeded 2s View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-11-06 12:58:46 UTC

@cubic-dev-ai cubic-dev-ai Bot 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.

All reported issues were addressed across 1 file

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

@codecov

codecov Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 87.50000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 55.79%. Comparing base (6f94cb9) to head (cb66595).

Files with missing lines Patch % Lines
...-resources-settings/service-resources-settings.tsx 50.00% 0 Missing and 1 partial ⚠️
...re/src/lib/keda/components/keda-scalers-fields.tsx 85.71% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           staging    #3184      +/-   ##
===========================================
+ Coverage    55.50%   55.79%   +0.28%     
===========================================
  Files         1395     1391       -4     
  Lines        31307    31172     -135     
  Branches      9508     9509       +1     
===========================================
+ Hits         17378    17391      +13     
+ Misses       11228    11078     -150     
- Partials      2701     2703       +2     
Flag Coverage Δ
unittests 55.79% <87.50%> (+0.28%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@cubic-dev-ai cubic-dev-ai Bot 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.

All reported issues were addressed across 7 files (changes from recent commits).

Requires human review: Auto-approval blocked because this review re-detected 1 unresolved issue already reported by Cubic.

View guided diff | Turn on auto-fix | Re-trigger cubic

qovery-agent and others added 3 commits November 6, 2026 13:53
KEDA scalers created through the Terraform provider with a JSON config
only populate `config_json`, while the console editor only read
`config_yaml` when building form defaults, leaving the scaler config
field empty. Fall back to stringifying `config_json` since the editor
accepts YAML, which is a superset of JSON.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…JSON

Share a parseScalerJsonConfig helper between the scaler editor and the
autoscaling payload, so the editor warns when a JSON-based config will be
saved as YAML. Add payload tests for valid JSON that isn't an object.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@lmillie-qovery
lmillie-qovery force-pushed the fix/keda-scaler-json-config branch from f55e05a to cb66595 Compare November 6, 2026 12:55
@rmnbrd
rmnbrd enabled auto-merge (squash) November 6, 2026 14:11

@rmnbrd rmnbrd 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.

Tested and approved

@rmnbrd
rmnbrd merged commit f1dda38 into staging Nov 6, 2026
8 checks passed
@rmnbrd
rmnbrd deleted the fix/keda-scaler-json-config branch November 6, 2026 14:14
@RemiBonnet

Copy link
Copy Markdown
Member Author

🎉 This PR is included in version 1.382.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants