Skip to content

OCPBUGS-83412: monitortests: skip PodSecurityViolation invariant when OpenShiftPodSecurityAdmission is disabled - #31561

Open
ibihim wants to merge 1 commit into
openshift:release-5.0from
ibihim:OCPBUGS-83412-psa-audit-invariant
Open

OCPBUGS-83412: monitortests: skip PodSecurityViolation invariant when OpenShiftPodSecurityAdmission is disabled#31561
ibihim wants to merge 1 commit into
openshift:release-5.0from
ibihim:OCPBUGS-83412-psa-audit-invariant

Conversation

@ibihim

@ibihim ibihim commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

The e2e-aws-ovn, e2e-azure and e2e-gcp presubmits on openshift/api#3002 fail on a single monitor test, [bz-apiserver-auth][invariant] audit analysis PodSecurityViolation (example junit). Everything else in those runs is fail-then-pass flakes.

What happens. With OpenShiftPodSecurityAdmission disabled, the PSA label syncer runs in advising mode and no longer sets the pod-security.kubernetes.io/enforce label on namespaces (psalabelsyncer.go#L19). OLM's catalog-operator defaults the registry pod security context by reading exactly that label, no label means legacy pod (reconciler.go#L412). The global PodSecurity audit: restricted:latest configuration is not feature-gated, so every such pod stamps a pod-security.kubernetes.io/audit-violations annotation into the audit log, and this invariant fails on any violation. The violations are by design, the invariant asserts a property that a gate-off cluster intentionally gives up.

What this PR does. Skip the invariant when the gate is explicitly disabled for the cluster's current version. Reading the FeatureGate status follows the existing pattern in cluster.go#L152. Fail closed: any error or ambiguity keeps the invariant enforcing. Clusters with the gate enabled, which is every current payload including TechPreview, are unaffected.

Test plan.

The same patch applies to main, the package is identical on both branches. Main PR follows, this one is the verification target for openshift/api#3002.

/hold until the verification on openshift/api#3002 is done

…curityAdmission is disabled

With the OpenShiftPodSecurityAdmission feature gate disabled, the PSA
label syncer runs in advising mode and no longer sets the
pod-security.kubernetes.io/enforce label on namespaces. Workloads that
key their security context off that label, such as OLM catalog registry
pods via getDefaultPodContextConfig, then run with a legacy security
context. The global PodSecurity audit configuration is not feature-gated
and stays at restricted:latest, so creating those pods stamps
pod-security.kubernetes.io/audit-violations annotations into the audit
log by design, and this zero-tolerance invariant fails every run.

Skip the invariant when the gate is explicitly disabled for the current
cluster version. Any error or ambiguity while reading the FeatureGate
keeps the invariant enforcing, and clusters with the gate enabled are
unaffected.
@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: automatic mode

@openshift-ci openshift-ci Bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 26, 2026
@openshift-ci-robot openshift-ci-robot added jira/severity-critical Referenced Jira bug's severity is critical for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. labels Aug 26, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@ibihim: This pull request references Jira Issue OCPBUGS-83412, which is valid.

7 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)
  • release note type set to "Release Note Not Required"
  • dependent bug Jira Issue OCPBUGS-112332 is in the state Verified, which is one of the valid states (MODIFIED, ON_QA, VERIFIED)
  • dependent Jira Issue OCPBUGS-112332 targets the "5.1.0" version, which is one of the valid target versions: 5.1.0
  • bug has dependents

No GitHub users were found matching the public email listed for the QA contact in Jira (xxia@redhat.com), skipping review request.

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

Details

In response to this:

The e2e-aws-ovn, e2e-azure and e2e-gcp presubmits on openshift/api#3002 fail on a single monitor test, [bz-apiserver-auth][invariant] audit analysis PodSecurityViolation (example junit). Everything else in those runs is fail-then-pass flakes.

What happens. With OpenShiftPodSecurityAdmission disabled, the PSA label syncer runs in advising mode and no longer sets the pod-security.kubernetes.io/enforce label on namespaces (psalabelsyncer.go#L19). OLM's catalog-operator defaults the registry pod security context by reading exactly that label, no label means legacy pod (reconciler.go#L412). The global PodSecurity audit: restricted:latest configuration is not feature-gated, so every such pod stamps a pod-security.kubernetes.io/audit-violations annotation into the audit log, and this invariant fails on any violation. The violations are by design, the invariant asserts a property that a gate-off cluster intentionally gives up.

What this PR does. Skip the invariant when the gate is explicitly disabled for the cluster's current version. Reading the FeatureGate status follows the existing pattern in cluster.go#L152. Fail closed: any error or ambiguity keeps the invariant enforcing. Clusters with the gate enabled, which is every current payload including TechPreview, are unaffected.

Test plan.

The same patch applies to main, the package is identical on both branches. Main PR follows, this one is the verification target for openshift/api#3002.

/hold until the verification on openshift/api#3002 is done

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 requested review from p0lyn0mial and sjenning August 26, 2026 10:43
@openshift-ci

openshift-ci Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: ibihim
Once this PR has been reviewed and has the lgtm label, please assign petr-muller for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

@coderabbitai

coderabbitai Bot commented Aug 26, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

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

Review profile: CHILL

Plan: Enterprise

Run ID: 209f6a0a-dc0a-4ba9-8268-74b9e470b49c

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Scheduling required tests:
/test e2e-aws-csi
/test e2e-aws-ovn-fips
/test e2e-aws-ovn-microshift
/test e2e-aws-ovn-microshift-serial
/test e2e-aws-ovn-serial-1of2
/test e2e-aws-ovn-serial-2of2
/test e2e-gcp-csi
/test e2e-gcp-ovn
/test e2e-gcp-ovn-upgrade
/test e2e-metal-ipi-ovn-ipv6
/test e2e-vsphere-ovn
/test e2e-vsphere-ovn-upi

@redhat-chai-bot

Copy link
Copy Markdown
Contributor

/override ci/prow/e2e-aws-ovn-microshift-serial

Automated triage: This failure appears unrelated to the PR changes.

Rationale: The job failed in the pre-test openshift-microshift-infra-rpm-install-aws step while installing the MicroShift RPM, before the origin e2e tests ran. The resolver could not satisfy MicroShift's cri-o >= 1.36.0, < 1.37.0 requirement from the available OCP 5.0/4.22 repositories; the same dependency-resolution failure occurred in the parallel ci/prow/e2e-aws-ovn-microshift job.

Evidence:

  • The PR changes only pkg/monitortests/kubeapiserver/auditloganalyzer/handle_audit_violation.go, its unit test, and monitortest.go; it does not change MicroShift packaging, RPM repositories, or CI setup.
  • ci/prow/go-verify-deps, images, lint, unit, verify, and verify-deps passed.
  • The failed step is an infrastructure/pre-test MicroShift RPM installation step, not the PodSecurityViolation monitor test targeted by this PR.

If you disagree with this assessment, /retest ci/prow/e2e-aws-ovn-microshift-serial to re-run the job.


AI-generated. Review for accuracy.

@openshift-ci

openshift-ci Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

@redhat-chai-bot: Overrode contexts on behalf of redhat-chai-bot: ci/prow/e2e-aws-ovn-microshift-serial

Details

In response to this:

/override ci/prow/e2e-aws-ovn-microshift-serial

Automated triage: This failure appears unrelated to the PR changes.

Rationale: The job failed in the pre-test openshift-microshift-infra-rpm-install-aws step while installing the MicroShift RPM, before the origin e2e tests ran. The resolver could not satisfy MicroShift's cri-o >= 1.36.0, < 1.37.0 requirement from the available OCP 5.0/4.22 repositories; the same dependency-resolution failure occurred in the parallel ci/prow/e2e-aws-ovn-microshift job.

Evidence:

  • The PR changes only pkg/monitortests/kubeapiserver/auditloganalyzer/handle_audit_violation.go, its unit test, and monitortest.go; it does not change MicroShift packaging, RPM repositories, or CI setup.
  • ci/prow/go-verify-deps, images, lint, unit, verify, and verify-deps passed.
  • The failed step is an infrastructure/pre-test MicroShift RPM installation step, not the PodSecurityViolation monitor test targeted by this PR.

If you disagree with this assessment, /retest ci/prow/e2e-aws-ovn-microshift-serial to re-run the job.


AI-generated. Review for accuracy.

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.

@grokspawn

Copy link
Copy Markdown
Contributor

/test e2e-aws-ovn

@openshift-ci

openshift-ci Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

@ibihim: 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-ovn-microshift-serial f7fd932 link true /test e2e-aws-ovn-microshift-serial
ci/prow/e2e-gcp-ovn f7fd932 link true /test e2e-gcp-ovn
ci/prow/e2e-aws-ovn-microshift f7fd932 link true /test e2e-aws-ovn-microshift

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.

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

Labels

do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. jira/severity-critical Referenced Jira bug's severity is critical for the branch this PR is targeting. 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants