CMP-4475: Install OpenShift Virtualization operator for OCP-Virt e2e#78
CMP-4475: Install OpenShift Virtualization operator for OCP-Virt e2e#78Vincent056 wants to merge 6 commits into
Conversation
Add an optional setup step that installs the OpenShift Virtualization (CNV) operator and creates the HyperConverged CR before the tests run, so the CIS OpenShift Virtualization profiles can be scanned on a cluster that does not already have CNV. Gated by the new -install-virt flag (default false) and idempotent if CNV is already present. Also adds an -install-virt and -cel-content-file config plumbing; wiring the CEL ProfileBundle (spec.celContentFile) is marked as a follow-up TODO pending a bump of the vendored compliance-operator API to >= v1.9.0. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Skipping CI for Draft Pull Request. |
Retry HyperConverged CR creation to tolerate the operator webhook not being ready right after the CRD appears. Add an opt-in TestInstallVirtLive (RUN_VIRT_LIVE=1) that exercises the installer against a real cluster. Validated on an OCP 4.21 cluster: CNV installs and HyperConverged reaches Available in ~4 minutes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…docs Expose INSTALL_VIRT and CEL_CONTENT_FILE make variables and pass the corresponding -install-virt / -cel-content-file flags from the e2e-profile and e2e-profile-remediations targets, so a CI lane can run the OCP-Virt CEL profiles (which need CNV installed and a CEL content file). Add docs/ocp-virt-e2e.md documenting the flags, local run, the CNV install step, a proposed CI lane, and the on-cluster validation results. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Keep the Makefile wiring; the OCP-Virt e2e usage notes live in the PR discussion instead of a checked-in doc. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
OpenShift Virtualization (CIS VM Extension) e2e — usage & validationThe OCP-Virt profiles (e.g.
Flags
Running locally# 1. Build the content image with the CEL content bundle (in the content checkout):
./build_product ocp4 --datastream --cel-content=ocp4
# -> build/ssg-ocp4-ds.xml and build/ocp4-cel-content.yaml
# Package both into an image and push to a registry the cluster can pull.
# 2. Run the OCP-Virt profile e2e (installs CNV itself):
export PROFILE=cis-vm-extension PRODUCT=ocp4
export INSTALL_VIRT=true CEL_CONTENT_FILE=ocp4-cel-content.yaml
make e2e-profile # go test also needs -content-image=<your image>What the CNV install step does
Opt-in live test for just this path: RUN_VIRT_LIVE=1 go test ./helpers -run TestInstallVirtLive -timeout 40m -vProposed CI lane (openshift/release, tracked separately)- as: e2e-aws-ocp4-cis-vm-extension
steps:
cluster_profile: quay-aws
test:
- as: test
commands: |
export PROFILE=cis-vm-extension PRODUCT=ocp4
export INSTALL_VIRT=true CEL_CONTENT_FILE=ocp4-cel-content.yaml
make e2e-profile
workflow: ipi-aws
Validation (OCP 4.21 + AWS)
|
…tFile Bump the vendored ComplianceAsCode/compliance-operator API from v1.7.0 to v1.9.0 (the release that adds ProfileBundle.spec.celContentFile), aligning the k8s stack to match: k8s.io/* v0.30 -> v0.35.3, controller-runtime v0.20.4 -> v0.23.3, plus the openshift/api and openshift/client-go replaces from v1.9.0. With the typed field available, set pb.Spec.CELContentFile directly in ensureTestProfileBundles for the ocp4 bundle (removing the earlier TODO / unstructured workaround), so the harness creates a CEL ProfileBundle for the OCP-Virt profiles. go build/vet/test-compile pass; the k8s/controller-runtime upgrade required no code changes in the harness. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…g dir - Add CONTENT_IMAGE and LOG_DIR make variables (passed as -content-image / -log-dir) so e2e-profile can test a custom content image (e.g. one built with CEL content) and write artifacts to a writable directory off-CI. - Create the log directory before writing assertion/mismatch/report artifacts (GenerateAssertionFileFromResults, SaveMismatchesAsYAML, GenerateMismatchReport) so runs don't fail when the dir does not already exist. - Add opt-in TestCELProfileBundleLive validating the typed CELContentFile path. Verified end to end on a fresh OCP 4.21 cluster: make e2e-profile installs CNV, creates the CEL ProfileBundle (VALID), scans the cis-vm-extension profile, and records results. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
/retest |
|
@Vincent056: The following tests failed, say
Full PR test history. Your PR dashboard. DetailsInstructions 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. |
|
Looks good! Only problem is the go version is mismatched with the CI so the tests are failing |
What
Adds the setup and plumbing to run the CIS OpenShift Virtualization (
cis-vm-extension) CEL profiles e2e on a cluster that doesn't ship CNV.helpers/virtualization.go, gated on-install-virt, default false): creates theopenshift-cnvnamespace, an OperatorGroup, a Subscription forkubevirt-hyperconverged(channelstable,redhat-operators), waits for theHyperConvergedAPI, creates theHyperConvergedCR (retrying to tolerate the operator webhook), and waits until it isAvailable. Idempotent; leaves existing CNV in place. Called fromhelpers/Setup.ComplianceAsCode/compliance-operatorAPI to v1.9.0 (addsProfileBundle.spec.celContentFile) and setspb.Spec.CELContentFilefor the ocp4 bundle when-cel-content-fileis provided, so CEL profiles are parsed. The k8s stack is aligned to match v1.9.0 (k8s.io/* v0.30 -> v0.35.3, controller-runtime v0.20.4 -> v0.23.3) — no harness code changes were needed for the upgrade.-install-virt,-cel-content-file, plusCONTENT_IMAGE/LOG_DIRmake variables passed tomake e2e-profileandmake e2e-profile-remediations.LOG_DIRis optional in CI (the openshift/release prow lane relies on the default/logs/artifacts, which is writable there); only local runs need to override it.TestInstallVirtLive(RUN_VIRT_LIVE=1) andTestCELProfileBundleLive(RUN_CEL_PB_LIVE=1).Usage, the proposed CI lane, and further details are in a PR comment.
Validation (OCP 4.21 + AWS + CNV)
make e2e-profilepassed end-to-end on a fresh cluster (247s): the target self-installs CNV (HyperConvergedAvailable), creates the ocp4 ProfileBundle with the typedcelContentFile(VALID), scans thecis-vm-extensionCEL profile to completion, records the 5 rule results, and cleans up the scan binding.TestInstallVirtLiveandTestCELProfileBundleLiveboth passed against the cluster (CNV install; typedCELContentFile-> ProfileBundle VALID -> CEL profile with 5 rules).go build/go vet/gofmtclean.Follow-ups (not in this PR)
e2e-aws-ocp4-cis-vm-extension) — see the PR comment.Jira: https://issues.redhat.com/browse/CMP-4475
🤖 Generated with Claude Code