Skip to content

OCPBUGS-98983: improve guest cluster state management reliability - #9198

Merged
openshift-merge-bot[bot] merged 1 commit into
openshift:mainfrom
ironcladlou:ws/e2e-v2-aws
Aug 4, 2026
Merged

OCPBUGS-98983: improve guest cluster state management reliability#9198
openshift-merge-bot[bot] merged 1 commit into
openshift:mainfrom
ironcladlou:ws/e2e-v2-aws

Conversation

@ironcladlou

@ironcladlou ironcladlou commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Before this commit, only guest cluster names were tracked, and infra IDs were auto generated and not persisted outside the hostedcluster. So, if infra setup fails and the hostedcluster is never persisted, downstream steps can no longer identify the infra for cleanup, causing destroy-guests to fail and infra to be leaked.

This commit solves the problem and also makes the overall design more predictable and flexible by introducing a ClusterManifest that captures the identity of a guest cluster before any infra is provisioned, serving as an up-front declaration of intent that downstream steps consume.

This eliminates the old cluster name files entirely and provides a more stable and robust interface for inter-process communication between steps. Guests can now be reliably destroyed in the absence of a hostedcluster.

Summary by CodeRabbit

  • New Features

    • Added a shared cluster manifest tracking names, variants, namespaces, and infrastructure identifiers.
    • Updated test execution, guest cleanup, and diagnostics to discover clusters through the manifest.
    • Added variant-based resolution for parallel and sequential test suites.
    • Added configurable base-domain support for AWS cluster cleanup.
  • Bug Fixes

    • Improved lifecycle and cleanup error reporting with cluster metadata.
    • Added validation for missing or unknown cluster variants.
  • Tests

    • Added coverage for manifest handling, cluster lookup, and variant resolution.

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: LGTM mode

@openshift-ci-robot openshift-ci-robot added jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Jul 31, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@ironcladlou: This pull request references Jira Issue OCPBUGS-98983, which is invalid:

  • expected the bug to target the "5.0.0" version, but no target version was set

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

Before this commit, only guest cluster names were tracked, and infra IDs were auto generated and not persisted outside the hostedcluster. So, if infra setup fails and the hostedcluster is never persisted, downstream steps can no longer identify the infra for cleanup, causing destroy-guests to fail and infra to be leaked.

This commit solves the problem and also makes the overall design more predictable and flexible by introducing a ClusterManifest that captures the identity of a guest cluster before any infra is provisioned, serving as an up-front declaration of intent that downstream steps consume.

This eliminates the old cluster name files entirely and provides a more stable and robust interface for inter-process communication between steps. Guests can now be reliably destroyed in the absence of a hostedcluster.

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci Bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. do-not-merge/needs-area labels Jul 31, 2026
@ironcladlou

Copy link
Copy Markdown
Contributor Author

/pipeline help

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

The e2e v2 lifecycle now writes cluster identities to a shared JSON manifest before provisioning. Platform specifications and test matrices identify clusters by variants. Test execution resolves variants through the manifest. Dump and destroy commands use manifest entries instead of derived names, cluster files, and shared namespace settings. Manifest read/write, lookup, and variant resolution behavior has new tests.

Sequence Diagram(s)

sequenceDiagram
  participant create_guests
  participant lifecycle_manifest
  participant run_tests
  participant destroy_guests
  create_guests->>lifecycle_manifest: Write cluster manifest before provisioning
  run_tests->>lifecycle_manifest: Read manifest and resolve test variants
  lifecycle_manifest-->>run_tests: Return cluster name and namespace
  destroy_guests->>lifecycle_manifest: Read manifest for cleanup identities
  lifecycle_manifest-->>destroy_guests: Return name, namespace, and infrastructure ID
Loading

Possibly related PRs

Suggested reviewers: cblecker, jparrill, bryan-cox


Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 error)

Check name Status Explanation Resolution
No-Sensitive-Data-In-Logs ❌ Error The destroy path logs the full hypershift argument list, including the newly added configurable --base-domain value, which may expose an internal hostname. Do not log full command arguments. Redact or omit --base-domain and other environment-derived sensitive values before logging.
✅ Passed checks (10 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed The PR adds no Ginkgo title declarations. New t.Run titles are fixed string literals, and generated-looking cluster IDs remain test data, not titles.
Test Structure And Quality ✅ Passed The PR adds only standard-library table tests, not Ginkgo tests; they use t.TempDir, have no cluster operations or waits, and include diagnostic failure messages.
Topology-Aware Scheduling Compatibility ✅ Passed Changed files are e2e commands and lifecycle manifest/config code; no deployment manifests, operators, controllers, or topology scheduling constraints were added or modified.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed The commit adds only standard-library testing.T unit tests; it adds no Ginkgo tests, IPv4-only literals, or external connectivity requirements.
No-Weak-Crypto ✅ Passed The patch adds no MD5, SHA-1, DES, RC4, Blowfish, or ECB usage; its unchanged SHA-256 name derivation and non-secret comparisons do not violate the check.
Container-Privileges ✅ Passed The commit changes only Go files; added lines contain no privileged, hostPID, hostNetwork, hostIPC, SYS_ADMIN, or allowPrivilegeEscalation settings and define no Kubernetes pod manifests.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: improving guest cluster state management reliability through shared manifest-based identity tracking.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@openshift-ci
openshift-ci Bot requested review from cblecker and jparrill July 31, 2026 16:28
@openshift-ci openshift-ci Bot added area/platform/aws PR/issue for AWS (AWSPlatform) platform area/platform/azure PR/issue for Azure (AzurePlatform) platform area/testing Indicates the PR includes changes for e2e testing and removed do-not-merge/needs-area labels Jul 31, 2026
@ironcladlou

Copy link
Copy Markdown
Contributor Author

/test ?

@ironcladlou

Copy link
Copy Markdown
Contributor Author

/test e2e-v2-aws

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
test/e2e/v2/cmd/destroy-guests/main.go (1)

92-116: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Add context/timeout for external hypershift commands in destroy and dump helpers. destroyCluster and dumpCluster call exec.Command.Run() directly and can block forever if hypershift hangs, while the parallel goroutines wait on wg.Wait(). Use a bounded context.Context and exec.CommandContext for the hypershift destroy cluster and hypershift dump cluster calls.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/e2e/v2/cmd/destroy-guests/main.go` around lines 92 - 116, The external
hypershift invocations can hang indefinitely, blocking parallel cleanup
completion. In test/e2e/v2/cmd/destroy-guests/main.go:92-116, update
destroyCluster to create a bounded context and use exec.CommandContext for the
destroy command; in test/e2e/v2/cmd/dump-guests/main.go:67-94, apply the same
context timeout and CommandContext pattern to dumpCluster, preserving the
existing command arguments and error reporting.

Source: Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@test/e2e/v2/cmd/destroy-guests/main.go`:
- Around line 92-116: The external hypershift invocations can hang indefinitely,
blocking parallel cleanup completion. In
test/e2e/v2/cmd/destroy-guests/main.go:92-116, update destroyCluster to create a
bounded context and use exec.CommandContext for the destroy command; in
test/e2e/v2/cmd/dump-guests/main.go:67-94, apply the same context timeout and
CommandContext pattern to dumpCluster, preserving the existing command arguments
and error reporting.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: c535fb89-ce9c-4496-8fc0-bbb0bbf843e0

📥 Commits

Reviewing files that changed from the base of the PR and between 53daedc and f33df5f.

📒 Files selected for processing (9)
  • test/e2e/v2/cmd/create-guests/main.go
  • test/e2e/v2/cmd/destroy-guests/main.go
  • test/e2e/v2/cmd/dump-guests/main.go
  • test/e2e/v2/cmd/run-tests/main.go
  • test/e2e/v2/lifecycle/aws.go
  • test/e2e/v2/lifecycle/azure.go
  • test/e2e/v2/lifecycle/manifest.go
  • test/e2e/v2/lifecycle/manifest_test.go
  • test/e2e/v2/lifecycle/platform.go

@codecov

codecov Bot commented Jul 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 44.94%. Comparing base (deb9479) to head (5b6a3a7).
⚠️ Report is 15 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #9198   +/-   ##
=======================================
  Coverage   44.94%   44.94%           
=======================================
  Files         778      778           
  Lines       97427    97427           
=======================================
  Hits        43790    43790           
  Misses      50616    50616           
  Partials     3021     3021           
Flag Coverage Δ
cmd-support 38.62% <ø> (ø)
cpo-hostedcontrolplane 47.28% <ø> (ø)
cpo-other 45.67% <ø> (ø)
hypershift-operator 54.93% <ø> (ø)
other 34.32% <ø> (ø)

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ironcladlou

Copy link
Copy Markdown
Contributor Author

/pipeline required

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Scheduling tests matching the pipeline_run_if_changed or not excluded by pipeline_skip_if_only_changed parameters:
/test e2e-aks-4-22
/test e2e-aws-4-22
/test e2e-aks
/test e2e-aws
/test e2e-aws-upgrade-hypershift-operator
/test e2e-kubevirt-aws-ovn-reduced
/test e2e-v2-aws
/test e2e-v2-azure-self-managed
/test e2e-v2-gke

@openshift-ci-robot openshift-ci-robot added jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. and removed jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Aug 3, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@ironcladlou: This pull request references Jira Issue OCPBUGS-98983, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (5.0.0) matches configured target version for branch (5.0.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, POST)
Details

In response to this:

Before this commit, only guest cluster names were tracked, and infra IDs were auto generated and not persisted outside the hostedcluster. So, if infra setup fails and the hostedcluster is never persisted, downstream steps can no longer identify the infra for cleanup, causing destroy-guests to fail and infra to be leaked.

This commit solves the problem and also makes the overall design more predictable and flexible by introducing a ClusterManifest that captures the identity of a guest cluster before any infra is provisioned, serving as an up-front declaration of intent that downstream steps consume.

This eliminates the old cluster name files entirely and provides a more stable and robust interface for inter-process communication between steps. Guests can now be reliably destroyed in the absence of a hostedcluster.

Summary by CodeRabbit

  • New Features

  • Added a shared cluster manifest tracking names, variants, namespaces, and infrastructure identifiers.

  • Updated test execution, guest cleanup, and diagnostics to discover clusters through the manifest.

  • Added variant-based resolution for parallel and sequential test suites.

  • Bug Fixes

  • Improved lifecycle and cleanup error reporting with cluster metadata.

  • Added validation for missing or unknown cluster variants.

  • Tests

  • Added coverage for manifest handling, cluster lookup, and variant resolution.

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 openshift-eng/jira-lifecycle-plugin repository.

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
test/e2e/v2/lifecycle/manifest.go (1)

12-12: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Document the exported manifest API.

ManifestFileName, WriteManifest, and ReadManifest have no Go doc comments. LookupCluster documents only the success case. Document unknown-variant errors and nil-receiver behavior.

As per path instructions, “Keep exported manifest APIs documented with actual behavior, including panic/error conditions.”

Also applies to: 30-30, 42-42, 55-56

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/e2e/v2/lifecycle/manifest.go` at line 12, Document the exported manifest
API symbols ManifestFileName, WriteManifest, ReadManifest, and LookupCluster
with Go doc comments describing their actual behavior. Include LookupCluster’s
unknown-variant error behavior and nil-receiver behavior, plus any panic or
error conditions for the other exported APIs; keep the documentation adjacent to
each declaration.

Source: Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@test/e2e/v2/lifecycle/manifest.go`:
- Around line 30-36: Add a shared manifest validator covering non-nil manifests,
required identity fields, and non-empty unique variants; invoke it in
WriteManifest before serialization and in ReadManifest after deserialization.
Update LookupCluster to nil-check the manifest and return contextual errors for
invalid or duplicate variants instead of selecting the first match. Add tests
covering missing identity or variants, duplicate variants, serialization
validation, and lookup failures.

---

Nitpick comments:
In `@test/e2e/v2/lifecycle/manifest.go`:
- Line 12: Document the exported manifest API symbols ManifestFileName,
WriteManifest, ReadManifest, and LookupCluster with Go doc comments describing
their actual behavior. Include LookupCluster’s unknown-variant error behavior
and nil-receiver behavior, plus any panic or error conditions for the other
exported APIs; keep the documentation adjacent to each declaration.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: eaf0f3e3-8039-46ca-9cb6-c140511e9c7e

📥 Commits

Reviewing files that changed from the base of the PR and between f33df5f and 3906fb9.

📒 Files selected for processing (9)
  • test/e2e/v2/cmd/create-guests/main.go
  • test/e2e/v2/cmd/destroy-guests/main.go
  • test/e2e/v2/cmd/dump-guests/main.go
  • test/e2e/v2/cmd/run-tests/main.go
  • test/e2e/v2/lifecycle/aws.go
  • test/e2e/v2/lifecycle/azure.go
  • test/e2e/v2/lifecycle/manifest.go
  • test/e2e/v2/lifecycle/manifest_test.go
  • test/e2e/v2/lifecycle/platform.go
🚧 Files skipped from review as they are similar to previous changes (8)
  • test/e2e/v2/cmd/run-tests/main.go
  • test/e2e/v2/lifecycle/manifest_test.go
  • test/e2e/v2/cmd/destroy-guests/main.go
  • test/e2e/v2/lifecycle/aws.go
  • test/e2e/v2/lifecycle/platform.go
  • test/e2e/v2/lifecycle/azure.go
  • test/e2e/v2/cmd/dump-guests/main.go
  • test/e2e/v2/cmd/create-guests/main.go

Comment on lines +30 to +36
func WriteManifest(dir string, m *ClusterManifest) error {
data, err := json.MarshalIndent(m, "", " ")
if err != nil {
return fmt.Errorf("marshaling cluster manifest: %w", err)
}
path := filepath.Join(dir, ManifestFileName)
if err := os.WriteFile(path, data, 0600); err != nil {

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.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Reject incomplete and ambiguous manifests before resolution.

WriteManifest accepts a nil manifest and serializes it as null. ReadManifest accepts missing identity fields and duplicate Variant values. LookupCluster returns the first duplicate and dereferences m without a nil check. This can select the wrong Name, InfraID, or Namespace, or prevent cleanup from using a valid infrastructure ID.

Add a shared validator for non-nil manifests, required identity fields, and unique non-empty variants. Call it before writing and after reading. Make LookupCluster return contextual errors for nil manifests and duplicate variants. Add tests for missing and duplicate variants.

Suggested validation hooks
 func WriteManifest(dir string, m *ClusterManifest) error {
+	if err := validateManifest(m); err != nil {
+		return fmt.Errorf("validating cluster manifest before write: %w", err)
+	}
 	data, err := json.MarshalIndent(m, "", "  ")

 func ReadManifest(dir string) (*ClusterManifest, error) {
 	...
 	if err := json.Unmarshal(data, &m); err != nil {
 		return nil, fmt.Errorf("unmarshaling cluster manifest: %w", err)
 	}
+	if err := validateManifest(&m); err != nil {
+		return nil, fmt.Errorf("validating cluster manifest from %s: %w", path, err)
+	}

 func (m *ClusterManifest) LookupCluster(variant string) (ClusterEntry, error) {
+	if m == nil {
+		return ClusterEntry{}, fmt.Errorf("looking up cluster variant %q: manifest is nil", variant)
+	}
 	...
 }

As per path instructions, “manifest and variant resolution failures fail loudly,” “always nil-check pointers before dereferencing,” and “add or update tests for serialization, missing/duplicate variants, and lookup failures.” Based on the supplied lifecycle consumer and PR objective, LookupCluster participates in variant resolution and the manifest is required for downstream cleanup.

Also applies to: 42-52, 55-62

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/e2e/v2/lifecycle/manifest.go` around lines 30 - 36, Add a shared
manifest validator covering non-nil manifests, required identity fields, and
non-empty unique variants; invoke it in WriteManifest before serialization and
in ReadManifest after deserialization. Update LookupCluster to nil-check the
manifest and return contextual errors for invalid or duplicate variants instead
of selecting the first match. Add tests covering missing identity or variants,
duplicate variants, serialization validation, and lookup failures.

Source: Path instructions

@cwbotbot

cwbotbot commented Aug 3, 2026

Copy link
Copy Markdown

Test Results

e2e-aws

e2e-aks

Before this commit, only guest cluster names were tracked, and infra IDs were auto
generated and not persisted outside the hostedcluster. So, if infra setup fails and
the hostedcluster is never persisted, downstream steps can no longer identify the
infra for cleanup, causing destroy-guests to fail and infra to be leaked.

This commit solves the problem and also makes the overall design more predictable
and flexible by introducing a `ClusterManifest` that captures the identity of a
guest cluster before any infra is provisioned, serving as an up-front declaration
of intent that downstream steps consume.

This eliminates the old cluster name files entirely and provides a more stable
and robust interface for inter-process communication between steps. Guests can
now be reliably destroyed in the absence of a hostedcluster.
@openshift-ci-robot

Copy link
Copy Markdown

@ironcladlou: This pull request references Jira Issue OCPBUGS-98983, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (5.0.0) matches configured target version for branch (5.0.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, POST)
Details

In response to this:

Before this commit, only guest cluster names were tracked, and infra IDs were auto generated and not persisted outside the hostedcluster. So, if infra setup fails and the hostedcluster is never persisted, downstream steps can no longer identify the infra for cleanup, causing destroy-guests to fail and infra to be leaked.

This commit solves the problem and also makes the overall design more predictable and flexible by introducing a ClusterManifest that captures the identity of a guest cluster before any infra is provisioned, serving as an up-front declaration of intent that downstream steps consume.

This eliminates the old cluster name files entirely and provides a more stable and robust interface for inter-process communication between steps. Guests can now be reliably destroyed in the absence of a hostedcluster.

Summary by CodeRabbit

  • New Features

  • Added a shared cluster manifest tracking names, variants, namespaces, and infrastructure identifiers.

  • Updated test execution, guest cleanup, and diagnostics to discover clusters through the manifest.

  • Added variant-based resolution for parallel and sequential test suites.

  • Added configurable base-domain support for AWS cluster cleanup.

  • Bug Fixes

  • Improved lifecycle and cleanup error reporting with cluster metadata.

  • Added validation for missing or unknown cluster variants.

  • Tests

  • Added coverage for manifest handling, cluster lookup, and variant resolution.

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 openshift-eng/jira-lifecycle-plugin repository.

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
test/e2e/v2/cmd/destroy-guests/main.go (1)

87-108: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Add cancellation and a timeout to each destroy command.

Pass a context.Context into destroyCluster, create a bounded context in main, and use exec.CommandContext. A hung hypershift destroy process can block the goroutine and waitGroup.Wait(), leaving cleanup without cancellation.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/e2e/v2/cmd/destroy-guests/main.go` around lines 87 - 108, Update
destroyCluster to accept a context.Context and create commands with
exec.CommandContext so cancellation terminates each hypershift destroy process.
In main, derive a bounded timeout context for cleanup and pass it through every
destroyCluster invocation, ensuring the existing waitGroup flow can exit when
the timeout or parent cancellation occurs.

Source: Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@test/e2e/v2/cmd/destroy-guests/main.go`:
- Around line 87-108: Update destroyCluster to accept a context.Context and
create commands with exec.CommandContext so cancellation terminates each
hypershift destroy process. In main, derive a bounded timeout context for
cleanup and pass it through every destroyCluster invocation, ensuring the
existing waitGroup flow can exit when the timeout or parent cancellation occurs.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: e1e67253-9f4e-43f3-b1c8-b167215fa484

📥 Commits

Reviewing files that changed from the base of the PR and between 3906fb9 and 5b6a3a7.

📒 Files selected for processing (9)
  • test/e2e/v2/cmd/create-guests/main.go
  • test/e2e/v2/cmd/destroy-guests/main.go
  • test/e2e/v2/cmd/dump-guests/main.go
  • test/e2e/v2/cmd/run-tests/main.go
  • test/e2e/v2/lifecycle/aws.go
  • test/e2e/v2/lifecycle/azure.go
  • test/e2e/v2/lifecycle/manifest.go
  • test/e2e/v2/lifecycle/manifest_test.go
  • test/e2e/v2/lifecycle/platform.go
🚧 Files skipped from review as they are similar to previous changes (7)
  • test/e2e/v2/cmd/dump-guests/main.go
  • test/e2e/v2/lifecycle/azure.go
  • test/e2e/v2/lifecycle/aws.go
  • test/e2e/v2/cmd/run-tests/main.go
  • test/e2e/v2/lifecycle/platform.go
  • test/e2e/v2/lifecycle/manifest.go
  • test/e2e/v2/lifecycle/manifest_test.go

@ironcladlou

Copy link
Copy Markdown
Contributor Author

/pipeline required

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Scheduling tests matching the pipeline_run_if_changed or not excluded by pipeline_skip_if_only_changed parameters:
/test e2e-aks-4-22
/test e2e-aws-4-22
/test e2e-aks
/test e2e-aws
/test e2e-aws-upgrade-hypershift-operator
/test e2e-kubevirt-aws-ovn-reduced
/test e2e-v2-aws
/test e2e-v2-azure-self-managed
/test e2e-v2-gke

@ironcladlou ironcladlou changed the title WIP: OCPBUGS-98983: improve guest cluster state management reliability OCPBUGS-98983: improve guest cluster state management reliability Aug 3, 2026
@openshift-ci openshift-ci Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 3, 2026
@ironcladlou

Copy link
Copy Markdown
Contributor Author

/test e2e-aws
/test e2e-kubevirt-aws-ovn-reduced

@ironcladlou

Copy link
Copy Markdown
Contributor Author

/test e2e-kubevirt-aws-ovn-reduced

@ironcladlou

Copy link
Copy Markdown
Contributor Author

/verified by e2e regression analysis

@openshift-ci-robot

Copy link
Copy Markdown

@ironcladlou: No Jira issue with key OCPBUGS-98983 exists in the tracker at https://redhat.atlassian.net.
Once a valid jira issue is referenced in the title of this pull request, request a refresh with /jira refresh.

Details

In response to this:

/verified by e2e regression analysis

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 openshift-eng/jira-lifecycle-plugin repository.

@mgencur

mgencur commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Aug 4, 2026
@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Tests from second stage were triggered manually. Pipeline can be controlled only manually, until HEAD changes. Use command to trigger second stage.

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

A couple of nits, otherwise lgtm

sharedDir := os.Getenv("SHARED_DIR")
manifest, err := lifecycle.ReadManifest(sharedDir)
if err != nil {
log.Fatalf("Failed to read cluster manifest: %v", err)

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.

Consider logging an error and just exiting here. If for some reason the step to create the manifest failed, this shouldn't result in further failures.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

log.Fatalf exits after logging

namespace := os.Getenv("HYPERSHIFT_NAMESPACE")
if namespace == "" {
namespace = "clusters"
log.Fatalf("Failed to read cluster manifest: %v", err)

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.

Same as with destroy guests. If you can't read the manifest, just log the error and exit.

@csrwng

csrwng commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

/override ci/prow/e2e-kubevirt-aws-ovn-reduced

@csrwng csrwng added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 4, 2026
@openshift-ci

openshift-ci Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

@csrwng: Overrode contexts on behalf of csrwng: ci/prow/e2e-kubevirt-aws-ovn-reduced

Details

In response to this:

/override ci/prow/e2e-kubevirt-aws-ovn-reduced

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.

@openshift-ci

openshift-ci Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

Approval requirements bypassed by manually added approval.

This pull-request has been approved by: ironcladlou

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

@ironcladlou

Copy link
Copy Markdown
Contributor Author

/verified by e2e regression analysis

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Aug 4, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@ironcladlou: This PR has been marked as verified by e2e regression analysis.

Details

In response to this:

/verified by e2e regression analysis

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 openshift-eng/jira-lifecycle-plugin repository.

@csrwng

csrwng commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

/verified by e2e

@openshift-ci-robot

Copy link
Copy Markdown

@csrwng: This PR has been marked as verified by e2e.

Details

In response to this:

/verified by e2e

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci

openshift-ci Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

@ironcladlou: all tests passed!

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

@openshift-merge-bot
openshift-merge-bot Bot merged commit 4009f0f into openshift:main Aug 4, 2026
43 checks passed
@openshift-ci-robot

Copy link
Copy Markdown

@ironcladlou: Jira Issue OCPBUGS-98983: Some pull requests linked via external trackers have merged:

The following pull request, linked via external tracker, has not merged:

All associated pull requests must be merged or unlinked from the Jira bug in order for it to move to the next state. Once unlinked, request a bug refresh with /jira refresh.

Jira Issue OCPBUGS-98983 has not been moved to the MODIFIED state.

This PR is marked as verified. If the remaining PRs listed above are marked as verified before merging, the issue will automatically be moved to VERIFIED after all of the changes from the PRs are available in an accepted nightly payload.

Details

In response to this:

Before this commit, only guest cluster names were tracked, and infra IDs were auto generated and not persisted outside the hostedcluster. So, if infra setup fails and the hostedcluster is never persisted, downstream steps can no longer identify the infra for cleanup, causing destroy-guests to fail and infra to be leaked.

This commit solves the problem and also makes the overall design more predictable and flexible by introducing a ClusterManifest that captures the identity of a guest cluster before any infra is provisioned, serving as an up-front declaration of intent that downstream steps consume.

This eliminates the old cluster name files entirely and provides a more stable and robust interface for inter-process communication between steps. Guests can now be reliably destroyed in the absence of a hostedcluster.

Summary by CodeRabbit

  • New Features

  • Added a shared cluster manifest tracking names, variants, namespaces, and infrastructure identifiers.

  • Updated test execution, guest cleanup, and diagnostics to discover clusters through the manifest.

  • Added variant-based resolution for parallel and sequential test suites.

  • Added configurable base-domain support for AWS cluster cleanup.

  • Bug Fixes

  • Improved lifecycle and cleanup error reporting with cluster metadata.

  • Added validation for missing or unknown cluster variants.

  • Tests

  • Added coverage for manifest handling, cluster lookup, and variant resolution.

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 openshift-eng/jira-lifecycle-plugin repository.

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

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. area/platform/aws PR/issue for AWS (AWSPlatform) platform area/platform/azure PR/issue for Azure (AzurePlatform) platform area/testing Indicates the PR includes changes for e2e testing jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants