compliance-operator icon indicating copy to clipboard operation
compliance-operator copied to clipboard

CMP-3930: Include the required selectors to machineconfig to pass the ValidatingAdmissionPolicy

Open xiaojiey opened this issue 1 month ago • 6 comments

This PR means to include the required selectors to machineconfig to pass the ValidatingAdmissionPolicy. Without this PR, for the make e2e-serial, you will get the below error:

creating Machine Config Pool e2e-invalid: machineconfigpools.machineconfiguration.openshift.io "e2e-invalid" is forbidden: ValidatingAdmissionPolicy 
'custom-machine-config-pool-selector' with binding 'custom-machine-config-pool-selector-binding' denied request: expression '( has(object.spec.machineConfigSelector.matchLabels) && ( 
(object.spec.machineConfigSelector.matchLabels["machineconfiguration.openshift.io/role"] == "master") || (object.spec.machineConfigSelector.matchLabels["machineconfiguration.openshift.io/role"] == "worker") 
|| (object.spec.machineConfigSelector.matchLabels["machineconfiguration.openshift.io/role"] == "arbiter") ) ) || ( has(object.spec.machineConfigSelector.matchExpressions) && ( 
(object.spec.machineConfigSelector.matchExpressions.exists( e, e.key == "machineconfiguration.openshift.io/role" && e.operator == "In" && "worker" in e.values) ) || 
(object.spec.machineConfigSelector.matchExpressions.exists( e, e.key == "machineconfiguration.openshift.io/role" && e.operator == "NotIn" && !("worker" in e.values)) ) ) )' resulted in error: no such key: 
machineConfigSelector... retrying after 351.247769ms

xiaojiey avatar Nov 12 '25 04:11 xiaojiey

:robot: To deploy this PR, run the following command:

make catalog-deploy CATALOG_IMG=ghcr.io/complianceascode/compliance-operator-catalog:960-eb093931238b7aaf6d4a39deb2326c298eeef881

github-actions[bot] avatar Nov 12 '25 04:11 github-actions[bot]

/retest-required

xiaojiey avatar Nov 12 '25 07:11 xiaojiey

@xiaojiey: This pull request references CMP-3930 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 "4.21.0" version, but no target version was set.

In response to this:

This PR means to include the required selectors to machineconfig to pass the ValidatingAdmissionPolicy. Without this PR, for the make e2e-serial, you will get the below error:

creating Machine Config Pool e2e-invalid: machineconfigpools.machineconfiguration.openshift.io "e2e-invalid" is forbidden: ValidatingAdmissionPolicy 
'custom-machine-config-pool-selector' with binding 'custom-machine-config-pool-selector-binding' denied request: expression '( has(object.spec.machineConfigSelector.matchLabels) && ( 
(object.spec.machineConfigSelector.matchLabels["machineconfiguration.openshift.io/role"] == "master") || (object.spec.machineConfigSelector.matchLabels["machineconfiguration.openshift.io/role"] == "worker") 
|| (object.spec.machineConfigSelector.matchLabels["machineconfiguration.openshift.io/role"] == "arbiter") ) ) || ( has(object.spec.machineConfigSelector.matchExpressions) && ( 
(object.spec.machineConfigSelector.matchExpressions.exists( e, e.key == "machineconfiguration.openshift.io/role" && e.operator == "In" && "worker" in e.values) ) || 
(object.spec.machineConfigSelector.matchExpressions.exists( e, e.key == "machineconfiguration.openshift.io/role" && e.operator == "NotIn" && !("worker" in e.values)) ) ) )' resulted in error: no such key: 
machineConfigSelector... retrying after 351.247769ms

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-robot avatar Nov 12 '25 07:11 openshift-ci-robot

/test e2e-aws-serial

xiaojiey avatar Nov 24 '25 09:11 xiaojiey

:robot: To deploy this PR, run the following command:

make catalog-deploy CATALOG_IMG=ghcr.io/complianceascode/compliance-operator-catalog:960-5ad04b70337f58cfb96024b8fe35b949e60bc8e7

github-actions[bot] avatar Dec 03 '25 02:12 github-actions[bot]

/test e2e-aws-serial

xiaojiey avatar Dec 03 '25 08:12 xiaojiey

Cluster provisioning failed.

/test e2e-aws-serial

rhmdnd avatar Dec 04 '25 21:12 rhmdnd

Looks like this worked as expected on a 4.17 cluster in CI:

2025/12/03 03:18:36 e2e Machine Config Pool has not updated... retrying
2025/12/03 03:18:46 successfully created Machine Config Pool e2e
2025/12/03 03:18:46 ValidatingAdmissionPolicy 'custom-machine-config-pool-selector' not found, creating MachineConfigPool e2e-invalid without selectors (legacy mode)
=== RUN   TestProfileVersion
=== PAUSE TestProfileVersion
=== RUN   TestProfileModification

rhmdnd avatar Dec 04 '25 21:12 rhmdnd

The profile bundle problem is affecting these test results, but we're chasing that down in a separate PR.

https://github.com/ComplianceAsCode/compliance-operator/pull/1019

rhmdnd avatar Dec 08 '25 17:12 rhmdnd

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rhmdnd, xiaojiey

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

The pull request process is described here

Needs approval from an approver in each of these files:
  • ~~OWNERS~~ [rhmdnd,xiaojiey]

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

openshift-ci[bot] avatar Dec 08 '25 17:12 openshift-ci[bot]

/test e2e-aws-serial

xiaojiey avatar Dec 09 '25 01:12 xiaojiey

New changes are detected. LGTM label has been removed.

openshift-ci[bot] avatar Dec 09 '25 08:12 openshift-ci[bot]

/retest-required

xiaojiey avatar Dec 09 '25 08:12 xiaojiey

:robot: To deploy this PR, run the following command:

make catalog-deploy CATALOG_IMG=ghcr.io/complianceascode/compliance-operator-catalog:960-a1c0b1dd2e7c757df27fa1d5371a46f1b2c5b145

github-actions[bot] avatar Dec 09 '25 08:12 github-actions[bot]

@xiaojiey: 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-rosa a1c0b1dd2e7c757df27fa1d5371a46f1b2c5b145 link true /test e2e-rosa
ci/prow/e2e-aws-serial a1c0b1dd2e7c757df27fa1d5371a46f1b2c5b145 link true /test e2e-aws-serial

Full PR test history. Your PR dashboard.

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-ci[bot] avatar Dec 09 '25 11:12 openshift-ci[bot]