Skip to content

feat(rhdh-upgrade-helper): AI-assisted 1.y→2.y chart migration - #30

Open
rm3l wants to merge 22 commits into
redhat-developer:mainfrom
rm3l:RHIDP-17323--create-ai-assisted-migration-support-for-1-y-2-y-chart
Open

rm3l wants to merge 22 commits into
redhat-developer:mainfrom
rm3l:RHIDP-17323--create-ai-assisted-migration-support-for-1-y-2-y-chart

Conversation

@rm3l

@rm3l rm3l commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

Summary

Adds chart values migration support to the rhdh-upgrade-helper skill for RHDH Helm chart major version upgrades (1.y → 2.y).

The 2.y chart flattens the nested upstream.backstage.* / global.* values structure to root-level keys. This implementation combines:

  • Deterministic translation engine (103 key mappings + 4 removed keys) applied automatically by a stdlib-only Python script
  • AI-assisted resolution of 8 ambiguous areas (ingress, args, extraEnvFrom, auth secret, init containers, networkPolicy, Intelligent Assistant, Orchestrator) via a structured workflow
  • Behavioral change warnings (PostgreSQL version, HPA defaults, digest/tag interaction, air-gapped plugin limitations)
  • Internal template detection — flags janus-idp.* Helm template references that need updating to rhdh.*, with guidance to inspect _helpers.tpl
  • Image digest clearing — dynamically scans all image paths and clears digest when any of registry/repository/tag is explicitly set
  • Go template .Values.* reference rewriting — automatically replaces .Values.global.*, .Values.upstream.*, and .Values.route.* references with their 2.y equivalents (e.g., .Values.global.host → .Values.host). Flags decomposed fields and unmapped references for review.
  • Chart-managed defaults handling — comments out unconditional chart defaults in extraVolumes, extraVolumeMounts, extraEnv, and extraInitContainers (e.g., dynamic-plugins-root, npmcacache, APP_CONFIG_backend_listen_port) so users can see what was there and uncomment if needed. Flags conditional defaults (BACKEND_SECRET, POSTGRES_*, backstage-app-config, etc.) for review.
  • Header recommendation — output files include a TIP advising users to only include customized values for easier maintenance and smoother future upgrades

The migration script never modifies original input files — output is written next to the original with a versioned suffix (e.g., values.yaml → values-2.1.yaml). Multiple input files are supported, preserving the customer's file separation. Review comments are placed inline next to each affected field.

Deliverables

  • references/chart-migration-1y-2y.md — authoritative mapping tables, ambiguous area guidance, and full chart-default inventory
  • scripts/migrate-chart-values.py — deterministic migration engine with multi-file support, .Values.* ref rewriting, chart-default commenting, and --to versioned output
  • workflows/chart-migration.md — 5-step AI-assisted migration workflow with chart version resolution (official repo first, upstream fallback)
  • SKILL.md routing, scoring model, and config analysis updates
  • Eval suite with 4 cases and 5 judges

Usage

# Single file — output written next to the original
python3 scripts/migrate-chart-values.py values.yaml --to 2.1

# Multiple files — each output next to its original
python3 scripts/migrate-chart-values.py base.yaml prod.yaml --to 2.1

# Explicit output path
python3 scripts/migrate-chart-values.py values.yaml --to 2.1 -o /tmp/migrated.yaml

# stdout
python3 scripts/migrate-chart-values.py values.yaml --to 2.1 -o -

Test plan

  • Script runs against simple fixture (exit 0, 24 keys migrated)
  • Script runs against complex fixture with all 8 ambiguous areas (exit 1, 41 keys, 8 review areas)
  • Script runs against minimal/edge fixture (exit 0, 1 key)
  • Multi-file mode produces separate versioned output files next to originals
  • --to flag generates correct filenames (e.g., values-2.1.yaml)
  • Fallback to -migrated suffix when --to is omitted
  • Image digest cleared for any custom image override (registry, repository, or tag)
  • janus-idp.* template references detected and flagged inline
  • .Values.global.* / .Values.upstream.* template references rewritten to 2.y paths
  • Unconditional chart defaults commented out (not removed) with "uncomment if needed" header
  • Conditional chart defaults flagged for review (not removed)
  • Header TIP recommending only customized values included in output
  • MIGRATION-REVIEW comments placed inline next to corresponding fields
  • Chart version resolution: official repo checked first, upstream fallback
  • Pre-commit hooks pass
  • Test against real customer 1.y values files (path-based routing, custom registry, custom tag)
  • Validate output with helm template against chart 3.4.5 (appVersion 2.1.0)

Ref: RHIDP-17323

Assisted-by: Claude

rm3l added 4 commits October 8, 2026 09:22
Add chart values migration support for RHDH Helm chart major version
upgrades. The 2.x chart flattens the nested upstream.backstage.*/global.*
values structure to root-level keys while keeping the same chart name.

- Add chart-migration-1x-2x.md reference with 130+ deterministic
  mappings and 8 ambiguous areas (ingress, args, extraEnvFrom, auth
  secret, init containers, networkPolicy, Intelligent Assistant,
  Orchestrator)
- Add migrate-chart-values.py script that applies deterministic
  mappings and flags ambiguous areas with MIGRATION-REVIEW markers
- Add chart-migration.md workflow orchestrating deterministic
  translation + AI-assisted resolution of ambiguous areas
- Add 2.1 release notes covering chart structural changes
- Update SKILL.md routing for major version detection
- Update config-scoring.md with chart migration scoring categories
- Update config-analysis.md with 1.x vs 2.x values format detection
- Add eval suite with 4 cases and 5 judge functions

Addresses: RHIDP-17323

Assisted-by: Claude
…values file

Make it explicit in the script docstring, --output help text, workflow,
and reference that the migration produces a separate output file and
the customer's original values file is never touched.

Assisted-by: Claude
Customers often split Helm values across files (base, env overrides,
secrets). The migration script now accepts multiple inputs and migrates
each independently, preserving the file separation. When multiple files
are given, -o must be a directory; the JSON report aggregates across
all files.

Assisted-by: Claude
Multi-file output now uses the target version in filenames when --to is
provided (e.g., base-2.1.yaml), falling back to -migrated suffix when
omitted. The source file header also includes the target version.

Assisted-by: Claude
rm3l added 13 commits October 8, 2026 13:36
Fixes ruff F401 (unused os, re, StringIO) and I001 (unsorted imports).

Assisted-by: Claude
The chart migration reference already covers all structural changes.
A proper release notes file should be added when RHDH 2.1 is GA with
the full scope of changes, not just chart restructuring.

Assisted-by: Claude
Use 1.y and 2.y consistently to refer to minor version ranges,
avoiding confusion with literal "x" or "times" readings. Renames
files (chart-migration-1y-2y.md, fixtures) and updates all prose,
identifiers, and path references across 21 files.

Assisted-by: Claude
Use --repo flag for single-command helm template/upgrade instead of
requiring a pre-added repo. Prefer charts.openshift.io, fall back to
upstream rhdh-chart Helm repo with version from Chart.yaml on the
release branch. Note multi-file order must match original 1.y install.

Assisted-by: Claude
…ult images

When a custom image is used (registry != registry.redhat.io or
repository != rhdh/rhdh-hub-rhel10), set digest to empty string and
flag for review. For default images with a custom tag, flag for review
without auto-clearing so the customer can choose the right digest.

Assisted-by: Claude
…digest logic

Scan migrated values for Helm template references containing
"janus-idp" (e.g., janus-idp.hostname) and flag them for review,
since the 2.y chart renamed internal templates to rhdh.*.

Simplify image digest clearing to dynamically scan all image paths
instead of using hardcoded defaults — any explicitly set registry,
repository, or tag now triggers digest clearing.

Assisted-by: Claude
…grations

RHDH Local uses podman compose with app-config files and cannot
process Helm values or resolve Go template expressions. The correct
validation path for chart migrations is helm template.

Assisted-by: Claude
…ponding fields

Use the mapped_to path from each review item to find the matching
YAML line and insert the MIGRATION-REVIEW comment directly above it,
instead of grouping all comments in the file header.

Assisted-by: Claude
Explain that these are internal chart templates that may change
between versions, and suggest inspecting _helpers.tpl to confirm
the current names.

Assisted-by: Claude
…kflow

Add a dedicated section explaining how product versions map to chart
versions differently between the official repo (product version =
chart version) and the upstream repo (read Chart.yaml from the
release branch or tag). All helm commands reference this section.

Assisted-by: Claude
… --report

Output files are now written next to the original with a versioned
suffix by default (e.g. values.yaml → values-2.1.yaml). The JSON
report flag is removed — the annotated YAML and stderr summary
are sufficient.

Assisted-by: Claude
@rm3l rm3l changed the title feat(rhdh-upgrade-helper): AI-assisted 1.x→2.x chart migration feat(rhdh-upgrade-helper): AI-assisted 1.y→2.y chart migration Oct 9, 2026
@rm3l
rm3l marked this pull request as ready for review October 9, 2026 09:19
@rm3l
rm3l requested review from a team and karthikjeeyar as code owners October 9, 2026 09:19
rm3l added 2 commits October 9, 2026 12:06
…, add header tip

- Scan and replace .Values.global.*/upstream.*/route.* Go template
  references with their 2.y equivalents (e.g. .Values.global.host →
  .Values.host). Flag decomposed fields and unmapped refs for review.
- Deterministically remove unconditional chart-managed defaults from
  extraVolumes, extraVolumeMounts, extraEnv, and extraInitContainers
  (7 volumes, 9 mount paths, 2 env vars, 1 init container). Flag
  conditional defaults (backstage-app-config, BACKEND_SECRET, POSTGRES_*,
  APP_CONFIG_*_baseUrl, wait-for-db) for review.
- Prevent PyYAML from line-wrapping OCI {{ "{{inherit}}" }} strings
  via width=10000.
- Add header recommendation to only include customized fields.
- Update workflow and reference docs with new areas and full inventory.

Assisted-by: Claude
…removing them

Unconditional chart-managed defaults in extra* fields are now commented
out in the migrated output rather than silently removed. This lets users
see what was there and uncomment if they need to customize.

Assisted-by: Claude
Comment thread eval/rhdh-upgrade-helper/chart-migration/fixtures/edge-empty-1y-values.yaml Outdated
Comment thread skills/rhdh-upgrade-helper/references/config-analysis.md Outdated
Comment thread skills/rhdh-upgrade-helper/scripts/migrate-chart-values.py
Comment thread skills/rhdh-upgrade-helper/scripts/migrate-chart-values.py
Comment thread skills/rhdh-upgrade-helper/workflows/chart-migration.md
Comment thread skills/rhdh-upgrade-helper/workflows/chart-migration.md Outdated
Comment thread skills/rhdh-upgrade-helper/workflows/chart-migration.md
Comment thread skills/rhdh-upgrade-helper/workflows/chart-migration.md Outdated
Comment thread skills/rhdh-upgrade-helper/workflows/chart-migration.md
Comment thread skills/rhdh-upgrade-helper/references/chart-migration-1y-2y.md
Comment thread skills/rhdh-upgrade-helper/workflows/chart-migration.md
Comment thread skills/rhdh-upgrade-helper/workflows/full-report.md Outdated
Comment thread skills/rhdh-upgrade-helper/SKILL.md
rm3l and others added 3 commits October 9, 2026 14:14
Add SUPPORTED_VERSIONS set (currently only 2.1). When --to specifies an
unsupported version, the script exits 3 instead of erroring, so the
broader upgrade assessment can continue without blocking.

Patch versions (e.g., 2.1.1) match their major.minor (2.1). Omitting
--to skips the check entirely.

Assisted-by: Claude
…stream migration guide

Remove duplicated mapping tables, behavioral changes, removed values,
and new features from the skill reference — all now maintained in the
upstream rhdh-chart migration guide (redhat-developer/rhdh-chart#603).

The skill reference is now a thin delta containing only what the
upstream guide does not: ambiguous area transformation algorithms,
parent-path .Values.* rewriting entries, and the decomposed fields
list.

670 → 332 lines.

Co-authored-by: Tomas Kral <tkral@redhat.com>
Co-authored-by: Nick Boldt <nboldt@redhat.com>
Assisted-by: Claude
- Drop edge-empty fixture and eval case 04 (subset of 01-simple)
- Lock config-analysis doc text to 1.10 → 2.1
- Use "1.10 → 2.1" in full-report.md major version handling
- Prefer highest tag over branch for chart version resolution
- Clarify -o default comment in workflow

Co-authored-by: Nick Boldt <nboldt@redhat.com>
Co-authored-by: Tomas Kral <tkral@redhat.com>
Assisted-by: Claude
@rm3l
rm3l requested review from kadel and nickboldt October 9, 2026 15:54
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.

3 participants