Skip to content

feat(templatize): add multi-stamp parallel execution for entrypoint runs#5697

Open
geoberle wants to merge 1 commit into
Azure:mainfrom
geoberle:templatize-stamping
Open

feat(templatize): add multi-stamp parallel execution for entrypoint runs#5697
geoberle wants to merge 1 commit into
Azure:mainfrom
geoberle:templatize-stamping

Conversation

@geoberle

Copy link
Copy Markdown
Collaborator

What

ARO HCP deploys management clusters as "stamps" within Azure regions. Previously templatize handled one stamp per invocation. This change makes the execution engine natively iterate stamps in parallel.

Key changes:

Execution state isolation: ExecutionState gains layered outputs (StampOutputs) with RecordOutput/GetOutputs methods. Each stamp's step outputs are stored separately, with GetOutputs returning a merged snapshot (stamp layer over base) to prevent cross-stamp output collision. All step runners (ARM, ARM stack, Helm, shell) use GetOutputs(id.Stamp) for stamp-aware input resolution.

Graph merge via ARO-Tools: graph.MergeStamped() combines per-stamp graphs into a unified execution graph. ResourceGroups and Steps use stamp-keyed types (ResourceGroupKey, StepKey) so per-stamp metadata (different Azure RG names, subscriptions, AKS cluster names) doesn't collide. GetResourceGroup/GetStep provide stamp-aware lookup. Unstamped parent nodes get their Children fixed up to reference all stamped children.

Stamp resolution: BuildStampList determines stamps from either --stamp (single, e.g. from dev settings) or --stamp-count-config-ref (multi, reads count from config). The count flag wins when both are present. Shared helpers in entrypointutils/stamps.go serve both the run and cleanup subcommands.

Cleanup support: cleanup subcommand uses BuildStampedGraph to discover all per-stamp resource groups for deletion. RegionalResourceGroupNames accepts per-stamp configs to include all stamp-variant RG names.

Other: stampConfigExecutor swaps config per stamp with missing-key validation. Stamped step errors include stamp context. Logs include stamp as structured field. ARM deployment names in mgmt-cluster.bicep use stamp-unique suffixes to prevent cross-stamp conflicts.

Why

Testing

Special notes for your reviewer

PR Checklist

  • PR is scoped to a single task (no mixed concerns)
  • Title follows Conventional Commits format
  • Summary explains the "Why" behind the change
  • Linked to relevant ticket/issue
  • Screenshots included (if graph/UI/metrics changes)
  • Self-reviewed the diff
  • CI/CD checks are passing (ignore Tide)
  • Draft PR used for WIP (if applicable)
  • Commit history is clean (rebased/squashed)
  • Tricky code blocks are commented
  • Specific reviewers tagged
  • All comment threads resolved before merge

Copilot AI review requested due to automatic review settings June 17, 2026 16:18
@openshift-ci openshift-ci Bot requested review from raelga and stevekuznetsov June 17, 2026 16:18
@openshift-ci

openshift-ci Bot commented Jun 17, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: geoberle

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@geoberle

Copy link
Copy Markdown
Collaborator Author

/hold
depends on Azure/ARO-Tools#250

Copilot AI 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.

Pull request overview

This PR updates tooling/templatize to support running stamped service-group graphs concurrently within a single entrypoint invocation, while isolating per-stamp execution state (outputs/config/pipelines) to prevent cross-stamp collisions.

Changes:

  • Introduces stamp-layered step outputs via ExecutionState.RecordOutput and ExecutionState.GetOutputs(stamp) and updates step runners (ARM/ARMStack/Helm/Shell) to resolve inputs against the correct stamp view.
  • Switches entrypoint graph generation to graph.ForStampedEntrypoint(...) and adds a stampConfigExecutor wrapper to apply per-stamp configuration during execution.
  • Adds multi-stamp unit tests and updates CLI options/helpers + Makefile wiring to drive stamp-count-based runs/cleanup.

Reviewed changes

Copilot reviewed 15 out of 16 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tooling/templatize/pkg/pipeline/shell.go Shell step input resolution now reads outputs via GetOutputs(id.Stamp) for stamp isolation.
tooling/templatize/pkg/pipeline/run.go Core execution updated for stamped graphs, layered outputs, per-stamp config executor, and stamp-aware graph lookup.
tooling/templatize/pkg/pipeline/run_test.go Adds unit tests covering multi-stamp execution, output isolation, subscription resolution, and error propagation.
tooling/templatize/pkg/pipeline/helm.go Helm runner now resolves replacements/inputs using stamp-scoped outputs.
tooling/templatize/pkg/pipeline/arm.go ARM runner now passes stamp context through and resolves inputs using stamp-scoped outputs.
tooling/templatize/pkg/pipeline/arm_stack.go ARMStack input resolution switched to GetOutputs(id.Stamp); stack name logic remains stamp-influenced via options.Stamp.
tooling/templatize/internal/well_formed_test.go Updates well-formed validation iteration to match new stamped step keying in the graph.
tooling/templatize/go.mod Bumps ARO-Tools config / pipelines versions needed for stamped graph support.
tooling/templatize/go.sum Updates checksums for new ARO-Tools dependency versions.
tooling/templatize/cmd/rolloutoptions.go Persists ConfigResolver in completed rollout options to enable per-stamp config resolution.
tooling/templatize/cmd/entrypoint/run/options.go Entry-point run now precomputes stamped graph inputs (stamp configs/pipelines) and passes them into pipeline execution.
tooling/templatize/cmd/entrypoint/entrypointutils/stamps.go New helpers for stamp list derivation, per-stamp config resolution, and stamped graph assembly.
tooling/templatize/cmd/entrypoint/entrypointutils/options.go Adds --stamp-count-config-ref and updates regional RG precheck extraction to span all stamp configs.
tooling/templatize/cmd/entrypoint/cleanup/options.go Cleanup now builds stamped graph + uses all stamp configs to discover RGs for deletion.
Makefile Updates local-run and cleanup invocations to use --stamp-count-config-ref=mgmt.stamps.count.
dev-infrastructure/templates/mgmt-cluster.bicep Makes module deployment name stamp-unique via uniqueString(resourceGroup().name) to avoid cross-stamp ARM conflicts.

Comment thread tooling/templatize/cmd/entrypoint/run/options.go

Copilot AI 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.

Pull request overview

Copilot reviewed 27 out of 36 changed files in this pull request and generated 7 comments.

Comment thread tooling/templatize/cmd/rolloutoptions.go Outdated
Comment thread tooling/templatize/cmd/pipeline/validate/options.go Outdated
Comment thread tooling/templatize/pkg/pipeline/run.go Outdated
Comment thread tooling/templatize/cmd/entrypoint/run/options.go Outdated
Comment thread tooling/templatize/cmd/entrypoint/entrypointutils/stamps.go Outdated
Comment thread tooling/templatize/pkg/pipeline/run.go
Comment thread tooling/templatize/cmd/entrypoint/entrypointutils/options.go Outdated
Copilot AI review requested due to automatic review settings June 19, 2026 14:56
@geoberle geoberle force-pushed the templatize-stamping branch from 6c2440e to b519c4b Compare June 19, 2026 14:56

Copilot AI 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.

Pull request overview

Copilot reviewed 27 out of 36 changed files in this pull request and generated 3 comments.

Comment thread tooling/templatize/cmd/rolloutoptions.go Outdated
Comment thread tooling/templatize/pkg/pipeline/run.go
Comment thread tooling/templatize/cmd/entrypoint/entrypointutils/options.go Outdated
@geoberle geoberle force-pushed the templatize-stamping branch from b519c4b to a5c75d9 Compare June 19, 2026 15:59
Copilot AI review requested due to automatic review settings June 19, 2026 19:41
@geoberle geoberle force-pushed the templatize-stamping branch from a5c75d9 to 7660073 Compare June 19, 2026 19:41

Copilot AI 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.

Pull request overview

Copilot reviewed 27 out of 36 changed files in this pull request and generated 2 comments.

Comment thread tooling/templatize/cmd/pipeline/validate/options.go Outdated
Comment thread tooling/templatize/pkg/pipeline/run.go Outdated
@geoberle geoberle force-pushed the templatize-stamping branch from 7660073 to dd52a09 Compare June 19, 2026 20:06
Copilot AI review requested due to automatic review settings June 19, 2026 20:14
@geoberle geoberle force-pushed the templatize-stamping branch from dd52a09 to 9579113 Compare June 19, 2026 20:14
@geoberle geoberle force-pushed the templatize-stamping branch from 34702ea to 7f66844 Compare June 22, 2026 11:59
@geoberle

Copy link
Copy Markdown
Collaborator Author

/test e2e-parallel

Copilot AI review requested due to automatic review settings June 23, 2026 05:49
@geoberle geoberle force-pushed the templatize-stamping branch from 7f66844 to 377239d Compare June 23, 2026 05:49

Copilot AI 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.

Pull request overview

Copilot reviewed 29 out of 39 changed files in this pull request and generated 5 comments.

Comment thread tooling/templatize/pkg/pipeline/run.go
Comment thread tooling/templatize/cmd/entrypoint/entrypointutils/options.go Outdated
Comment thread Makefile Outdated
Comment thread Makefile
Comment thread tooling/templatize/cmd/entrypoint/run/options.go
@geoberle geoberle force-pushed the templatize-stamping branch from 377239d to 3df2f94 Compare June 24, 2026 18:05
Copilot AI review requested due to automatic review settings June 25, 2026 06:59
@geoberle geoberle force-pushed the templatize-stamping branch from 3df2f94 to b8f5f84 Compare June 25, 2026 06:59

Copilot AI 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.

Pull request overview

Copilot reviewed 25 out of 35 changed files in this pull request and generated 3 comments.

Comment thread tooling/templatize/pkg/pipeline/run.go Outdated
Comment thread tooling/templatize/cmd/entrypoint/cleanup/options.go
Comment thread tooling/templatize/cmd/entrypoint/entrypointutils/stamps.go Outdated
@geoberle geoberle force-pushed the templatize-stamping branch from b8f5f84 to ef467e1 Compare June 25, 2026 08:05
Copilot AI review requested due to automatic review settings June 25, 2026 14:27
@geoberle geoberle force-pushed the templatize-stamping branch from ef467e1 to 8451726 Compare June 25, 2026 14:27

Copilot AI 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.

Pull request overview

Copilot reviewed 25 out of 35 changed files in this pull request and generated 2 comments.

Comment on lines +32 to +34
// RegionalResourceGroupNames extracts the regional resource group names from the
// base configuration and all per-stamp configurations. This ensures stamped RG
// names (which vary per stamp) are included.
cmd.Flags().StringArrayVar(&opts.TopologyFiles, "topology-config", opts.TopologyFiles, "Path to a topology configuration file. Can be specified multiple times.")
cmd.Flags().StringVar(&opts.Entrypoint, "entrypoint", opts.Entrypoint, "Name of the entrypoint to create Ev2 manifests for. Exclusive with --service-group.")
cmd.Flags().StringVar(&opts.ServiceGroup, "service-group", opts.ServiceGroup, "Name of the service group to create Ev2 manifests for. Exclusive with --entrypoint.")
cmd.Flags().StringVar(&opts.StampCountConfigRef, "stamp-count-config-ref", opts.StampCountConfigRef, "Configuration path where the stamp count is stored (e.g. mgmt.stamps.count). When provided, stamped service groups are executed once per stamp in parallel.")
@geoberle

Copy link
Copy Markdown
Collaborator Author

/test e2e-parallel

@geoberle geoberle force-pushed the templatize-stamping branch from 8451726 to d5eee41 Compare June 26, 2026 12:02
Copilot AI review requested due to automatic review settings June 26, 2026 12:16
@geoberle geoberle force-pushed the templatize-stamping branch from d5eee41 to 19f4318 Compare June 26, 2026 12:16

Copilot AI 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.

Pull request overview

Copilot reviewed 25 out of 35 changed files in this pull request and generated 1 comment.

Comment thread tooling/templatize/cmd/entrypoint/entrypointutils/options.go Outdated
ARO HCP deploys management clusters as "stamps" within Azure regions.
Previously templatize handled one stamp per invocation. This change
makes the execution engine natively iterate stamps in parallel.

Key changes:

Execution state isolation: ExecutionState gains layered outputs
(StampOutputs) with RecordOutput/GetOutputs methods. Each stamp's
step outputs are stored separately, with GetOutputs returning a
merged snapshot (stamp layer over base) to prevent cross-stamp
output collision. All step runners (ARM, ARM stack, Helm, shell)
use GetOutputs(id.Stamp) for stamp-aware input resolution.

Graph merge via ARO-Tools: graph.MergeStamped() combines per-stamp
graphs into a unified execution graph. ResourceGroups and Steps use
stamp-keyed types (ResourceGroupKey, StepKey) so per-stamp metadata
(different Azure RG names, subscriptions, AKS cluster names) doesn't
collide. GetResourceGroup/GetStep provide stamp-aware lookup.
Unstamped parent nodes get their Children fixed up to reference all
stamped children.

Stamp resolution: BuildStampList determines stamps from either
--stamp (single, e.g. from dev settings) or --stamp-count-config-ref
(multi, reads count from config). The count flag wins when both are
present. Shared helpers in entrypointutils/stamps.go serve both the
run and cleanup subcommands.

Cleanup support: cleanup subcommand uses BuildStampedGraph to discover
all per-stamp resource groups for deletion. RegionalResourceGroupNames
accepts per-stamp configs to include all stamp-variant RG names.

Other: stampConfigExecutor swaps config per stamp with missing-key
validation. Stamped step errors include stamp context. Logs include
stamp as structured field. ARM deployment names in mgmt-cluster.bicep
use stamp-unique suffixes to prevent cross-stamp conflicts.
@geoberle geoberle force-pushed the templatize-stamping branch from 19f4318 to 32c078a Compare June 27, 2026 12:27
@geoberle

Copy link
Copy Markdown
Collaborator Author

/test e2e-parallel


// collectResourceGroupTargets extracts all unique (resourceGroup, subscription) pairs across
// every stamp's pipelines. This avoids relying on the execution graph which, in service-group
// mode, only contains resource groups from the first stamp.

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.

I might prefer some other mechanism that requires that we're resolving the graph the same way here that we did during deployment - what is it that causes this to be in "service-group" mode and requires this workaround?

@openshift-ci

openshift-ci Bot commented Jul 4, 2026

Copy link
Copy Markdown

PR needs rebase.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants