Skip to content

CNTRLPLANE-3646: make lifecycle binaries configurable for non-CI environments - #9021

Closed
ironcladlou wants to merge 1 commit into
openshift:mainfrom
ironcladlou:e2e-v2-binary-config
Closed

CNTRLPLANE-3646: make lifecycle binaries configurable for non-CI environments#9021
ironcladlou wants to merge 1 commit into
openshift:mainfrom
ironcladlou:e2e-v2-binary-config

Conversation

@ironcladlou

@ironcladlou ironcladlou commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Remove hard-coded assumptions from the v2 lifecycle binaries so they
can be driven by external tooling outside of CI step registry jobs.

  • Add variant filtering, namespace, base domain, binary path, and
    label filter override via environment variables
  • Pass --namespace to create/destroy CLI commands
  • Support deterministic infra IDs via HYPERSHIFT_INFRA_ID_FROM_NAME
  • Add FilterClusterSpecs and FilterTestMatrix helpers to lifecycle to enable filtering

Part of CNTRLPLANE-3646

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Added variant-based selection for end-to-end setup, cleanup, and execution by filtering cluster specs and the test matrix with HYPERSHIFT_VARIANTS.
    • Improved environment-driven hypershift behavior: hypershift calls now always set --namespace (from HYPERSHIFT_NAMESPACE, default clusters), and conditionally include --infra-id (via HYPERSHIFT_INFRA_ID_FROM_NAME) and --base-domain (via HYPERSHIFT_BASE_DOMAIN).
    • Enhanced e2e runtime configuration with HYPERSHIFT_BINARY, E2EV2_BIN_DIR, and GINKGO_LABEL_FILTER overrides.
  • Tests

    • Added unit-style coverage for lifecycle selection and filtering helpers behind the e2ev2 build tag.

@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 the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jul 16, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@ironcladlou: This pull request explicitly references no jira issue.

Details

In response to this:

Remove hard-coded assumptions from the v2 lifecycle binaries so they can be driven by external tooling outside of CI step registry jobs.

  • Add variant filtering, namespace, base domain, binary path, and label filter override via environment variables
  • Pass --infra-id and --namespace to create/destroy CLI commands
  • Add FilterClusterSpecs and FilterTestMatrix helpers to lifecycle pkg to enable filtering generally

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 commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The v2 E2E lifecycle helpers now filter cluster specifications and test matrices by configured variants. Guest commands derive namespace, infrastructure ID, base-domain, and binary settings from environment variables. The test runner supports binary path, label filter, and namespace overrides for parallel and sequential executions. Lifecycle tests cover name derivation, variant filtering, and matrix filtering.

Suggested reviewers: muraee, 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 Full hypershift command logs print env-derived values like --base-domain and --external-dns-domain, which can expose hostnames. Redact or omit sensitive flags from the "Running:" logs, especially base-domain, external-dns-domain, and any secret-related paths.
✅ Passed checks (10 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: making lifecycle binaries configurable via environment variables for non-CI environments.
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 new tests use static t.Run names only; no Ginkgo titles or dynamic values appear in any changed test code.
Test Structure And Quality ✅ Passed These are pure table-driven unit tests, not Ginkgo lifecycle tests; they create no cluster resources, use no Eventually/BeforeEach, and assertions are focused and clear.
Topology-Aware Scheduling Compatibility ✅ Passed Only e2e lifecycle CLI/test harness code changed; no manifests, operators, or controllers, and no pod scheduling constraints were introduced.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed The added tests are plain Go unit tests, and the changed files show no IPv4-only literals, host/IP parsing, or external internet dependencies.
No-Weak-Crypto ✅ Passed Changed files only add SHA-256 for cluster naming; no MD5/SHA1/DES/RC4/3DES/Blowfish/ECB, custom crypto, or secret comparisons were introduced.
Container-Privileges ✅ Passed The PR only changes Go lifecycle binaries/helpers; the diff shows no K8s/container manifests or privilege-related fields like privileged, hostNetwork, or allowPrivilegeEscalation.
✨ 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 bryan-cox and muraee July 16, 2026 17:04
@openshift-ci openshift-ci Bot added area/testing Indicates the PR includes changes for e2e testing and removed do-not-merge/needs-area labels Jul 16, 2026

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

🧹 Nitpick comments (2)
test/e2e/v2/lifecycle/platform.go (2)

124-128: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Preallocate slice capacity and check map existence explicitly.

As per coding guidelines, preallocate slice capacity when the maximum size is known ahead of time to avoid runtime reallocations. Additionally, check map existence with the two-value assignment (val, ok := m[key]) rather than relying on implicit zero-value evaluation.

♻️ Proposed refactor
-	var filtered []ClusterSpec
+	filtered := make([]ClusterSpec, 0, len(specs))
	for _, s := range specs {
-		if allowed[s.Variant] {
+		if _, ok := allowed[s.Variant]; ok {
			filtered = append(filtered, s)
		}
🤖 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/platform.go` around lines 124 - 128, Update the
filtering loop over specs to preallocate filtered with capacity len(specs), and
use an explicit two-value lookup for allowed[s.Variant], appending only when the
key exists and its value is true.

Source: Coding guidelines


140-154: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Preallocate slice capacity and check map existence explicitly.

As per coding guidelines, preallocate slice capacity when the maximum size is known ahead of time, and check map existence with the two-value assignment (val, ok := m[key]).

♻️ Proposed refactor
-	var parallel []TestGroup
+	parallel := make([]TestGroup, 0, len(matrix.Parallel))
	for _, g := range matrix.Parallel {
-		if clusterFiles[g.ClusterFile] {
+		if _, ok := clusterFiles[g.ClusterFile]; ok {
			parallel = append(parallel, g)
		}
	}
-	var sequential []SequentialGroup
+	sequential := make([]SequentialGroup, 0, len(matrix.Sequential))
	for _, sg := range matrix.Sequential {
-		var steps []TestGroup
+		steps := make([]TestGroup, 0, len(sg.Steps))
		for _, step := range sg.Steps {
-			if clusterFiles[step.ClusterFile] {
+			if _, ok := clusterFiles[step.ClusterFile]; ok {
				steps = append(steps, step)
			}
		}
		if len(steps) > 0 {
🤖 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/platform.go` around lines 140 - 154, Update the
filtering logic around the parallel and sequential group construction to
preallocate parallel and steps slice capacities from their source lengths, and
replace direct clusterFiles map lookups with two-value assignments that
explicitly verify key existence and value. Preserve the existing filtering and
non-empty sequential-group behavior.

Source: Coding guidelines

🤖 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.

Nitpick comments:
In `@test/e2e/v2/lifecycle/platform.go`:
- Around line 124-128: Update the filtering loop over specs to preallocate
filtered with capacity len(specs), and use an explicit two-value lookup for
allowed[s.Variant], appending only when the key exists and its value is true.
- Around line 140-154: Update the filtering logic around the parallel and
sequential group construction to preallocate parallel and steps slice capacities
from their source lengths, and replace direct clusterFiles map lookups with
two-value assignments that explicitly verify key existence and value. Preserve
the existing filtering and non-empty sequential-group behavior.

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Enterprise

Run ID: 63ee991d-fc9f-486a-be35-5b2818a07d01

📥 Commits

Reviewing files that changed from the base of the PR and between 0121785 and abcf392.

📒 Files selected for processing (5)
  • 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/platform.go

@codecov

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 44.50%. Comparing base (d255fd6) to head (7143d3c).
⚠️ Report is 137 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9021      +/-   ##
==========================================
+ Coverage   44.44%   44.50%   +0.05%     
==========================================
  Files         774      774              
  Lines       96977    96980       +3     
==========================================
+ Hits        43105    43164      +59     
+ Misses      50897    50828      -69     
- Partials     2975     2988      +13     

see 1 file with indirect coverage changes

Flag Coverage Δ
cmd-support 38.39% <ø> (ø)
cpo-hostedcontrolplane 47.19% <ø> (ø)
cpo-other 45.25% <ø> (ø)
hypershift-operator 54.44% <ø> (+0.22%) ⬆️
other 32.64% <ø> (ø)

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
ironcladlou force-pushed the e2e-v2-binary-config branch 2 times, most recently from 5391c57 to f8f1a0e Compare July 16, 2026 18:17

@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

🤖 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/cmd/destroy-guests/main.go`:
- Around line 58-66: Replace the direct os.Getenv calls in the destroy-guests
configuration setup with GetEnvVarValue, and register HYPERSHIFT_NAMESPACE with
its default plus HYPERSHIFT_BASE_DOMAIN, HYPERSHIFT_INFRA_ID, and
HYPERSHIFT_VARIANTS through the centralized environment variable catalog using
RegisterEnvVar or RegisterEnvVarWithDefault. Preserve the existing
defaultNamespace fallback behavior and cluster-spec filtering.
🪄 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: Enterprise

Run ID: aa56a31b-e208-45c1-9aa4-04ed7d0b4591

📥 Commits

Reviewing files that changed from the base of the PR and between abcf392 and 5391c57.

📒 Files selected for processing (5)
  • 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/platform.go
🚧 Files skipped from review as they are similar to previous changes (4)
  • test/e2e/v2/cmd/dump-guests/main.go
  • test/e2e/v2/cmd/create-guests/main.go
  • test/e2e/v2/cmd/run-tests/main.go
  • test/e2e/v2/lifecycle/platform.go

Comment thread test/e2e/v2/cmd/destroy-guests/main.go
@ironcladlou
ironcladlou force-pushed the e2e-v2-binary-config branch from f8f1a0e to 7760d00 Compare July 16, 2026 18:18

@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

🤖 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/cmd/create-guests/main.go`:
- Around line 123-125: Register HYPERSHIFT_VARIANTS,
HYPERSHIFT_INFRA_ID_FROM_NAME, and HYPERSHIFT_BINARY in
test/e2e/v2/internal/env_vars.go, using hypershift as the HYPERSHIFT_BINARY
default. In create-guests/main.go and dump-guests/main.go, replace os.Getenv and
envOrDefault lookups for these variables with GetEnvVarValue, preserving the
existing boolean conversion for HYPERSHIFT_INFRA_ID_FROM_NAME; update all three
listed sites accordingly.
🪄 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: Enterprise

Run ID: 7952a1b4-3571-4733-b57e-f439a82548f2

📥 Commits

Reviewing files that changed from the base of the PR and between 5391c57 and 7760d00.

📒 Files selected for processing (5)
  • 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/platform.go
🚧 Files skipped from review as they are similar to previous changes (3)
  • test/e2e/v2/cmd/destroy-guests/main.go
  • test/e2e/v2/cmd/run-tests/main.go
  • test/e2e/v2/lifecycle/platform.go

Comment thread test/e2e/v2/cmd/create-guests/main.go
@ironcladlou ironcladlou changed the title NO-JIRA: make lifecycle binaries configurable for non-CI environments CNTRLPLANE-3646: make lifecycle binaries configurable for non-CI environments Jul 16, 2026
@openshift-ci-robot

openshift-ci-robot commented Jul 16, 2026

Copy link
Copy Markdown

@ironcladlou: This pull request references CNTRLPLANE-3646 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "5.0.0" version, but no target version was set.

Details

In response to this:

Remove hard-coded assumptions from the v2 lifecycle binaries so they
can be driven by external tooling outside of CI step registry jobs.

  • Add variant filtering, namespace, base domain, binary path, and
    label filter override via environment variables
  • Pass --namespace to create/destroy CLI commands
  • Support deterministic infra IDs via HYPERSHIFT_INFRA_ID_FROM_NAME
  • Add FilterClusterSpecs and FilterTestMatrix helpers to lifecycle to enable filtering

Summary by CodeRabbit

  • New Features
  • Added variant-based selection for end-to-end setup and cleanup, filtering both cluster specs and the generated test matrix using HYPERSHIFT_VARIANTS.
  • Enhanced environment-driven hypershift CLI behavior: added --namespace=<HYPERSHIFT_NAMESPACE> (defaulting to clusters), and conditional --infra-id (from cluster name when enabled) and --base-domain (from HYPERSHIFT_BASE_DOMAIN) during create/destroy.
  • Improved e2e runtime configuration with HYPERSHIFT_BINARY and E2EV2_BIN_DIR overrides.
  • Expanded test filtering controls by allowing GINKGO_LABEL_FILTER overrides across parallel and sequential runs.

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.

@ironcladlou
ironcladlou force-pushed the e2e-v2-binary-config branch from 7760d00 to b5e7582 Compare July 16, 2026 19:24

@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: 2

🤖 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/cmd/run-tests/main.go`:
- Line 89: Rename the goroutine-local error variable in runTestBinary calls to
avoid shadowing the outer err: update both sites in
test/e2e/v2/cmd/run-tests/main.go at lines 89-89 and 112-112, using a distinct
name such as runErr and updating all subsequent references within each closure.

In `@test/e2e/v2/lifecycle/platform_test.go`:
- Around line 44-85: Update test/e2e/v2/lifecycle/platform_test.go:44-85, 9-35,
and 104-155 to use “When … it should …” descriptions for every
FilterClusterSpecs-related case, wrapping the inline assertions at 9-35 in named
subtests. Prefer consolidating these cases into table-driven tests while
preserving all existing assertions and expected behavior.
🪄 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: Enterprise

Run ID: 3109e7f1-5f61-408d-bc17-903f483e3daf

📥 Commits

Reviewing files that changed from the base of the PR and between 7760d00 and b5e7582.

📒 Files selected for processing (6)
  • 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/platform.go
  • test/e2e/v2/lifecycle/platform_test.go
🚧 Files skipped from review as they are similar to previous changes (4)
  • test/e2e/v2/cmd/dump-guests/main.go
  • test/e2e/v2/lifecycle/platform.go
  • test/e2e/v2/cmd/create-guests/main.go
  • test/e2e/v2/cmd/destroy-guests/main.go

Comment thread test/e2e/v2/cmd/run-tests/main.go
Comment thread test/e2e/v2/lifecycle/platform_test.go Outdated
@ironcladlou
ironcladlou force-pushed the e2e-v2-binary-config branch from b5e7582 to c52bd64 Compare July 16, 2026 19:34
@ironcladlou

Copy link
Copy Markdown
Contributor Author

/retest

1 similar comment
@ironcladlou

Copy link
Copy Markdown
Contributor Author

/retest

@ironcladlou

Copy link
Copy Markdown
Contributor Author

/refresh

@devguyio

Copy link
Copy Markdown
Contributor

/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-azure-v2-self-managed
/test e2e-kubevirt-aws-ovn-reduced
/test e2e-v2-aws
/test e2e-v2-gke

@ironcladlou
ironcladlou force-pushed the e2e-v2-binary-config branch from c52bd64 to 5debabd Compare July 21, 2026 15:17
@cwbotbot

cwbotbot commented Jul 21, 2026

Copy link
Copy Markdown

Test Results

e2e-aws

e2e-aks

@ironcladlou

Copy link
Copy Markdown
Contributor Author

/retest

@openshift-ci

openshift-ci Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

@ironcladlou: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-aws-4-22 5debabd link true /test e2e-aws-4-22
ci/prow/e2e-aws 5debabd link true /test e2e-aws
ci/prow/e2e-aws-upgrade-hypershift-operator 5debabd link true /test e2e-aws-upgrade-hypershift-operator
ci/prow/e2e-v2-aws 5debabd link true /test e2e-v2-aws
ci/prow/e2e-azure-v2-self-managed 5debabd link true /test e2e-azure-v2-self-managed

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.

@bryan-cox bryan-cox left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Review from the hypershift-staff-engineer agent (Standards + Spec axes).

Spec: All four stated requirements are implemented correctly. No gaps, no concerning scope creep.

Standards: One actionable fix (test naming), plus several suggestions for reducing duplication across the four cmd/ binaries. Details inline.

Comment thread test/e2e/v2/lifecycle/platform_test.go Outdated
wantEmpty bool
}{
{
name: "When the same inputs are provided it should return the same name",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit (TESTING.md): Test case names need a comma after the condition clause. The documented format is "When <condition>, it should <expected behavior>".

Suggested change
name: "When the same inputs are provided it should return the same name",
name: "When the same inputs are provided, it should return the same name",

Same fix needed on all 12 test cases in this file.

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.

Fixed


func destroyCluster(hypershiftBin, name, variant string, platform lifecycle.PlatformConfig) error {
log.Printf("Destroying cluster %s (%s)", name, variant)
func destroyCluster(hypershiftBin, name, namespace, baseDomain string, infraIDFromName bool, platform lifecycle.PlatformConfig) error {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

suggestion: destroyCluster now takes 6 positional params. Three of them (namespace, baseDomain, infraIDFromName) are the same env-derived config that create-guests already bundles into its envConfig struct. A shared config type (or adding these to PlatformConfig) would reduce the parameter list and keep the two binaries in sync.

Not blocking — just noting the data-clump smell before it grows.

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.

Seems worth a followup refactor

Comment thread test/e2e/v2/cmd/destroy-guests/main.go Outdated
const clusterGracePeriod = "40m"
const (
clusterGracePeriod = "40m"
defaultNamespace = "clusters"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

suggestion: The default namespace "clusters" is now defined independently in three places with two different names:

  • defaultNamespace here in destroy-guests
  • defaultClusterNS in run-tests
  • implicitly via envConfig.namespace default in create-guests

Consider extracting a single DefaultNamespace constant in the lifecycle package — all four binaries already import it, and it lives next to the other helpers this PR adds (FilterClusterSpecs, FilterTestMatrix, DeriveClusterName).

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.

Fixed


matrix := platform.TestMatrix(releaseImage)
variants := os.Getenv("HYPERSHIFT_VARIANTS")
specs := lifecycle.FilterClusterSpecs(platform.ClusterSpecs(releaseImage, os.Getenv("OCP_IMAGE_N1")), variants)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

observation (not blocking): specs is reconstructed here via platform.ClusterSpecs() independently of what create-guests used at cluster creation time. If env state differs between the two invocations (e.g., OCP_IMAGE_N1 set during create but absent during test), FilterTestMatrix could silently drop valid test groups.

Might be worth a brief comment here noting the assumption that env vars must be consistent across all four binaries.

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.

Wouldn't this general consistency issue be applicable to every environment variable shared amongst the binaries? Not sure it's worth calling out this single instance. What may be lacking is a stable non-environment input passed through to all of the binaries if there's some concern of environment drift during the same workflow, or something. Seems like a systemic thing to follow up on?

}

specs := platform.ClusterSpecs("", "")
variants := os.Getenv("HYPERSHIFT_VARIANTS")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: The pattern os.Getenv("HYPERSHIFT_VARIANTS") + lifecycle.FilterClusterSpecs(platform.ClusterSpecs(...), variants) is repeated identically in all four cmd/ binaries. Similarly, os.Getenv("HYPERSHIFT_INFRA_ID_FROM_NAME") == "true" appears in both create-guests and destroy-guests.

Fine for now, but if more env vars get added across all four binaries, a shared config loader in lifecycle/ would help.

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.

Agree all this stuff needs cleaned up into a structure with uniform env handling applied and passed around

…ments

Remove hard-coded assumptions from the v2 lifecycle binaries so they
can be driven by external tooling outside of CI step registry jobs.

- Add variant filtering, namespace, base domain, binary path, and
  label filter override via environment variables
- Pass --namespace to create/destroy CLI commands
- Support deterministic infra IDs via HYPERSHIFT_INFRA_ID_FROM_NAME
- Add FilterClusterSpecs and FilterTestMatrix helpers to lifecycle pkg
@ironcladlou
ironcladlou force-pushed the e2e-v2-binary-config branch from 5debabd to 7143d3c Compare July 22, 2026 21:12
@bryan-cox

Copy link
Copy Markdown
Member

/approve

@openshift-ci

openshift-ci Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bryan-cox, 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

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 23, 2026
@ironcladlou

Copy link
Copy Markdown
Contributor Author

Superseded by #9174

/close

@openshift-ci openshift-ci Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 31, 2026
@openshift-ci

openshift-ci Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

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.

@openshift-ci openshift-ci Bot closed this Jul 31, 2026
@openshift-ci

openshift-ci Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

@ironcladlou: Closed this PR.

Details

In response to this:

Superseded by #9174

/close

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

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. area/testing Indicates the PR includes changes for e2e testing jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants