Skip to content

SPLAT-2813: Create VAP E2Es#1517

Merged
openshift-merge-bot[bot] merged 1 commit into
openshift:mainfrom
vr4manta:SPLAT-2813
Jul 18, 2026
Merged

SPLAT-2813: Create VAP E2Es#1517
openshift-merge-bot[bot] merged 1 commit into
openshift:mainfrom
vr4manta:SPLAT-2813

Conversation

@vr4manta

@vr4manta vr4manta commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

SPLAT-2813

Changes

  • Created E2Es for new vSphere VAP

Summary by CodeRabbit

  • Tests
    • Added end-to-end vSphere conformance coverage for validating admission policies that block removing vSphere failure domains from the Infrastructure resource while they’re still referenced by Machine API objects.
    • Verified required failure-domain VAPs and bindings exist for Machine, ControlPlaneMachineSet, and MachineSet.
    • Confirmed Infrastructure removal succeeds only for unused domains, and is denied with appropriate errors when referenced by Machine, MachineSet, or ControlPlaneMachineSet.
    • Verified cleanup flow: removal is re-attempted after deleting and waiting for the referencing MachineSet, and the original Infrastructure state is restored.

@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 14, 2026
@openshift-ci-robot

openshift-ci-robot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

@vr4manta: This pull request references SPLAT-2813 which is a valid jira issue.

Details

In response to this:

SPLAT-2813

Changes

  • Created E2Es for new vSphere VAP

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 the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 14, 2026
@openshift-ci

openshift-ci Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown

Walkthrough

Adds a vSphere end-to-end test suite for failure-domain ValidatingAdmissionPolicies. The tests verify policy deployment and Infrastructure failure-domain removal behavior when domains are referenced by Machines, MachineSets, or ControlPlaneMachineSets.

Changes

vSphere failure-domain VAP tests

Layer / File(s) Summary
Failure-domain selection and test resource helpers
test/e2e/vsphere/failure_domain_vap.go
Adds helpers to remove failure domains, identify domains referenced by existing resources, select ControlPlaneMachineSet domains, and create zero-replica MachineSets targeting specific domains.
VAP deployment verification
test/e2e/vsphere/failure_domain_vap.go
Verifies that three vSphere failure-domain ValidatingAdmissionPolicies and their corresponding bindings are deployed.
Failure-domain admission flows
test/e2e/vsphere/failure_domain_vap.go
Covers permitted removal of unused domains, rejection of domains referenced by Machines, MachineSets, or ControlPlaneMachineSets, and successful removal after deleting a referencing MachineSet.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant VAPSuite
  participant MachineAPI
  participant AdmissionPolicy
  participant Infrastructure
  VAPSuite->>MachineAPI: create or inspect Machine API references
  VAPSuite->>Infrastructure: submit failure-domain removal
  Infrastructure->>AdmissionPolicy: validate update
  AdmissionPolicy->>MachineAPI: check Machine, MachineSet, and CPMS references
  AdmissionPolicy-->>Infrastructure: allow unused or unreferenced domain removal
  AdmissionPolicy-->>Infrastructure: deny referenced domain removal
  VAPSuite->>MachineAPI: delete blocking MachineSet
  VAPSuite->>Infrastructure: retry failure-domain removal
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 14 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Test Structure And Quality ⚠️ Warning The unused-FD test restores cluster-scoped Infrastructure inline, so a mid-test failure can leak shared state; several bare Expect(err) calls also lack context. Wrap Infrastructure restoration in DeferCleanup/AfterEach so it always runs, and add context messages to the bare setup assertions.
✅ Passed checks (14 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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 All Ginkgo titles are static strings; none include generated names, dates, IPs, or other run-specific values.
Microshift Test Compatibility ✅ Passed All added Ginkgo tests are tagged [apigroup:machine.openshift.io], which MicroShift CI auto-skips; no untagged test needs a guard.
Single Node Openshift (Sno) Test Compatibility ✅ Passed The new Ginkgo tests only manipulate API objects and labels; they don’t require multiple nodes or HA scheduling, and MachineSet-dependent cases self-skip when absent.
Topology-Aware Scheduling Compatibility ✅ Passed Only adds conformance e2e tests; no deployment/controller manifests or pod scheduling constraints were introduced, and no affinity/nodeSelector/toleration logic appears in the file.
Ote Binary Stdout Contract ✅ Passed No process-level stdout writes appear in the new suite file; only test-case-local fmt/e2e.Logf calls inside It/DeferCleanup blocks.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed PASS: The new Ginkgo tests only use cluster APIs and vSphere labels; no IPv4 literals, IP parsing, host URL building, or public internet access.
No-Weak-Crypto ✅ Passed The added e2e test file contains no MD5/SHA1/DES/RC4/3DES/Blowfish/ECB or custom crypto, and no secret/token comparisons.
Container-Privileges ✅ Passed The only changed file is a Go e2e test, and it contains no privileged pod/container settings or K8s manifests.
No-Sensitive-Data-In-Logs ✅ Passed The new test file only logs test-step messages and resource names/FD labels; no passwords, tokens, PII, session IDs, or hostnames are logged.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding VAP end-to-end tests.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@vr4manta

Copy link
Copy Markdown
Contributor Author

/payload-job periodic-ci-openshift-release-main-nightly-5.0-e2e-vsphere-ovn-zones

@openshift-ci

openshift-ci Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

@vr4manta: trigger 1 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command

  • periodic-ci-openshift-release-main-nightly-5.0-e2e-vsphere-ovn-zones

See details on https://pr-payload-tests.ci.openshift.org/runs/ci/81721120-7f9f-11f1-941e-018542fca9e5-0

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (3)
test/e2e/vsphere/failure_domain_vap.go (3)

34-48: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Local variable shadows builtin copy.

Naming the DeepCopy() result copy shadows the built-in copy() function within this scope. Harmless here since the builtin isn't otherwise needed, but worth avoiding for clarity.

♻️ Rename to avoid shadowing
-	copy := infra.DeepCopy()
-	fds := copy.Spec.PlatformSpec.VSphere.FailureDomains
+	infraCopy := infra.DeepCopy()
+	fds := infraCopy.Spec.PlatformSpec.VSphere.FailureDomains
 	filtered := fds[:0]
 	for _, fd := range fds {
 		if fd.Name != fdName {
 			filtered = append(filtered, fd)
 		}
 	}
-	copy.Spec.PlatformSpec.VSphere.FailureDomains = filtered
-	return copy
+	infraCopy.Spec.PlatformSpec.VSphere.FailureDomains = filtered
+	return infraCopy
🤖 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/vsphere/failure_domain_vap.go` around lines 34 - 48, Rename the
DeepCopy() result local variable in infraWithFDRemoved from copy to a
non-shadowing name, and update its subsequent references when accessing and
assigning Spec.PlatformSpec.VSphere.FailureDomains. Preserve the existing
filtering behavior.

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

defer GinkgoRecover() at the top of the Describe closure has no effect.

This closure runs once during spec-tree construction, not during spec execution, so the deferred recover doesn't protect the It/BeforeEach bodies where assertions actually run. GinkgoRecover() is only needed inside goroutines spawned from spec code; none are spawned in this file, so this line is effectively dead code.

♻️ Remove the ineffective defer
 	func() {
-		defer GinkgoRecover()
-
 		ctx := context.Background()
🤖 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/vsphere/failure_domain_vap.go` at line 234, Remove the ineffective
defer GinkgoRecover() from the Describe closure in failure_domain_vap.go; no
replacement is needed because this file does not spawn goroutines requiring
recovery.

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

Region/zone label keys hardcoded and duplicated across the file.

The literal strings "machine.openshift.io/region" and "machine.openshift.io/zone" are repeated at least seven times (lines 77-78, 120-121, 127-128, 214-215, 323-324, 334-335, 462-463). These same labels are read by the CEL-based VAPs in pkg/webhooks/vap.go via machineRegionLabel/machineZoneLabel constants. Duplicating the literals here risks silent drift (a typo just causes a Skip or a false pass instead of a compile error), and any future rename in the webhooks package would require finding every copy in this test file.

Extract local package-level constants for these two labels and reference them everywhere in this file, mirroring the naming used in pkg/webhooks/vap.go to make the coupling explicit.

const (
	machineRegionLabel = "machine.openshift.io/region"
	machineZoneLabel   = "machine.openshift.io/zone"
)

Also applies to: 120-121, 127-128, 214-215, 323-324, 334-335, 462-463

🤖 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/vsphere/failure_domain_vap.go` around lines 77 - 78, Define
package-level machineRegionLabel and machineZoneLabel constants in
test/e2e/vsphere/failure_domain_vap.go, matching the values and names used by
the VAP implementation, then replace every repeated region and zone label
literal throughout the file with these constants.
🤖 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/vsphere/failure_domain_vap.go`:
- Around line 379-380: Update the error assertions in the Machine and MachineSet
VAP tests to use their exact MessageExpression phrasing, such as “in use by
Machine '” and “in use by MachineSet '”, instead of the ambiguous “Machine” and
“MachineSet” substrings; leave the ControlPlaneMachineSet assertion unchanged.
- Around line 91-160: Update findFDUsedByCPMS to identify when its returned
failure domain comes from the worker-shared fallback rather than being
CPMS-only, and propagate that ambiguity to the callers around the CPMS admission
assertion. When no CPMS-only FD exists, skip or relax the expected
“ControlPlaneMachineSet” substring check while preserving the strict assertion
for an exclusive FD.

---

Nitpick comments:
In `@test/e2e/vsphere/failure_domain_vap.go`:
- Around line 34-48: Rename the DeepCopy() result local variable in
infraWithFDRemoved from copy to a non-shadowing name, and update its subsequent
references when accessing and assigning
Spec.PlatformSpec.VSphere.FailureDomains. Preserve the existing filtering
behavior.
- Line 234: Remove the ineffective defer GinkgoRecover() from the Describe
closure in failure_domain_vap.go; no replacement is needed because this file
does not spawn goroutines requiring recovery.
- Around line 77-78: Define package-level machineRegionLabel and
machineZoneLabel constants in test/e2e/vsphere/failure_domain_vap.go, matching
the values and names used by the VAP implementation, then replace every repeated
region and zone label literal throughout the file with these constants.
🪄 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: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 692848d5-6190-4e89-856f-4cf264817a6a

📥 Commits

Reviewing files that changed from the base of the PR and between c0b2d2c and f89a6ba.

📒 Files selected for processing (1)
  • test/e2e/vsphere/failure_domain_vap.go

Comment thread test/e2e/vsphere/failure_domain_vap.go
Comment thread test/e2e/vsphere/failure_domain_vap.go Outdated
@vr4manta

Copy link
Copy Markdown
Contributor Author

/payload-job periodic-ci-openshift-release-main-nightly-5.0-e2e-vsphere-ovn-techpreview

@openshift-ci

openshift-ci Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

@vr4manta: trigger 1 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command

  • periodic-ci-openshift-release-main-nightly-5.0-e2e-vsphere-ovn-techpreview

See details on https://pr-payload-tests.ci.openshift.org/runs/ci/452dd3d0-7fb7-11f1-8e5e-bc54849f548e-0

@vr4manta

Copy link
Copy Markdown
Contributor Author

/payload-job periodic-ci-openshift-release-main-nightly-5.0-e2e-vsphere-ovn-techpreview-serial

@openshift-ci

openshift-ci Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

@vr4manta: trigger 1 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command

  • periodic-ci-openshift-release-main-nightly-5.0-e2e-vsphere-ovn-techpreview-serial

See details on https://pr-payload-tests.ci.openshift.org/runs/ci/4ed1bfe0-803f-11f1-8167-56a23068f085-0

@vr4manta

Copy link
Copy Markdown
Contributor Author

/payload-job periodic-ci-openshift-release-main-nightly-5.0-e2e-vsphere-ovn-techpreview-serial

@openshift-ci

openshift-ci Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

@vr4manta: trigger 1 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command

  • periodic-ci-openshift-release-main-nightly-5.0-e2e-vsphere-ovn-techpreview-serial

See details on https://pr-payload-tests.ci.openshift.org/runs/ci/dc2a5e60-8071-11f1-9a77-28dff85f92fa-0

@vr4manta

Copy link
Copy Markdown
Contributor Author

/payload-job periodic-ci-openshift-release-main-nightly-5.0-e2e-vsphere-ovn-zones-techpreview-serial

@openshift-ci

openshift-ci Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

@vr4manta: trigger 1 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command

  • periodic-ci-openshift-release-main-nightly-5.0-e2e-vsphere-ovn-zones-techpreview-serial

See details on https://pr-payload-tests.ci.openshift.org/runs/ci/24aff3c0-8086-11f1-893c-057285f1f1ba-0

@vr4manta

Copy link
Copy Markdown
Contributor Author

/payload-job periodic-ci-openshift-release-main-nightly-5.0-e2e-vsphere-ovn-zones-techpreview-serial

@openshift-ci

openshift-ci Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

@vr4manta: trigger 1 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command

  • periodic-ci-openshift-release-main-nightly-5.0-e2e-vsphere-ovn-zones-techpreview-serial

See details on https://pr-payload-tests.ci.openshift.org/runs/ci/109449d0-8087-11f1-8dff-4e14e5580fac-0

@vr4manta

Copy link
Copy Markdown
Contributor Author

/payload-job periodic-ci-openshift-release-main-nightly-5.0-e2e-vsphere-ovn-zones-techpreview-serial

@openshift-ci

openshift-ci Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

@vr4manta: trigger 1 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command

  • periodic-ci-openshift-release-main-nightly-5.0-e2e-vsphere-ovn-zones-techpreview-serial

See details on https://pr-payload-tests.ci.openshift.org/runs/ci/784bddd0-810a-11f1-848a-fed249f82b6b-0

@vr4manta

Copy link
Copy Markdown
Contributor Author

/unhold
Preliminary E2E testing is looking good. Ready for review.

@vr4manta
vr4manta marked this pull request as ready for review July 16, 2026 16:51
@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 Jul 16, 2026
@openshift-ci
openshift-ci Bot requested review from damdo and theobarberbany July 16, 2026 16:53
@nrb

nrb commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

/lgtm
/approved
/verified by tests present in CI
/label acknowledge-critical-fixes-only

@openshift-ci openshift-ci Bot added the acknowledge-critical-fixes-only Indicates if the issuer of the label is OK with the policy. label Jul 16, 2026
@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Jul 16, 2026
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@nrb: This PR has been marked as verified by tests present in CI.

Details

In response to this:

/lgtm
/approved
/verified by tests present in CI
/label acknowledge-critical-fixes-only

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 the lgtm Indicates that a PR is ready to be merged. label Jul 16, 2026
@nrb

nrb commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

/approve

@openshift-ci

openshift-ci Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: nrb

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 17, 2026
@vr4manta

Copy link
Copy Markdown
Contributor Author

/retest

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

/retest-required

Remaining retests: 0 against base HEAD c0b2d2c and 2 for PR HEAD 832ed27 in total

@openshift-ci

openshift-ci Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

@vr4manta: 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 417ad2f into openshift:main Jul 18, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

acknowledge-critical-fixes-only Indicates if the issuer of the label is OK with the policy. approved Indicates a PR has been approved by an approver from all required OWNERS files. 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.

3 participants