Skip to content

[FSI] Image registry policy — clean baseline (no registry exceptions) - #5126

Closed
Anthony Vollmer (avollmer-redhat) wants to merge 14 commits into
mainfrom
fsi-image-registry-policy-clean
Closed

[FSI] Image registry policy — clean baseline (no registry exceptions)#5126
Anthony Vollmer (avollmer-redhat) wants to merge 14 commits into
mainfrom
fsi-image-registry-policy-clean

Conversation

@avollmer-redhat

Copy link
Copy Markdown
Collaborator

Purpose

Clean baseline clone of #4690 without Rael's d858c0be commit that added quay.io, registry.k8s.io, and registry.redhat.io as registry exceptions.

This PR exists to run e2e-parallel against the original VAP implementation and prove the policy does not block any legitimate workloads. The management cluster infrastructure saturation that caused 77 consecutive failures has resolved (see AROSLSRE-768).

What this proves

PR Registry exceptions Expected result
#4690 (with Rael's commit) quay.io, registry.k8s.io, registry.redhat.io added All tests pass except Image Registry Policy test (broken by the exceptions)
This PR (clean) None (original design) All tests pass including Image Registry Policy test

Context

  • All external images (quay.io, registry.k8s.io, registry.redhat.io) are ORAS-mirrored to ACR before deployment
  • Zero VAP denials found in Kusto kubeAudit logs across all 77 previous runs
  • The 77 consecutive failures were caused by management cluster triple saturation (DB pool exhaustion, compute scheduling saturation, Azure platform node disruptions), not by the VAP

Do not merge

This PR is for CI validation only. The canonical PR is #4690 (after reverting the registry exceptions commit).

Copilot AI review requested due to automatic review settings May 5, 2026 13:19
@openshift-ci

openshift-ci Bot commented May 5, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: avollmer-redhat
Once this PR has been reviewed and has the lgtm label, please assign janboll 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

Deploy a Kubernetes-native ValidatingAdmissionPolicy with CEL rules to
both service and management clusters that restricts pod image pulls to
Microsoft-controlled registries only (SVC ACR, OCP ACR, MCR, and
kubernetesshared.azurecr.io). External public registries (quay.io,
registry.k8s.io, registry.redhat.io) are excluded since all images from
those sources are mirrored to ACR via ImageMirror pipeline steps or
pull-through cache rules.

The policy uses fail-closed semantics (failurePolicy: Fail,
parameterNotFoundAction: Deny) with system namespace exclusions.
Includes E2E tests verifying policy presence and enforcement.

JIRA: ARO-22152
- Remove unused excludedNamespaces from values.yaml — the system
  namespace exclusions are hardcoded in the CEL matchConditions
  expression and cannot be driven from the ConfigMap
- Change deny test label from Positive to Negative to match repo
  convention for expected-rejection tests
- Reorder imports in image_registry_policy.go to match gci sections
  (Azure SDK imports after k8s.io imports, not between dot and k8s groups)
- Add new Image Registry Policy E2E test names to suite fixture files
  (integration_parallel, stage_parallel, prod_parallel)
- Update nonlocal-e2e-specs.txt with new test specs
Apply yamlfmt-required formatting to CEL expressions in the
ValidatingAdmissionPolicy template. Use GenerateName instead of
hardcoded namespace names in E2E tests to prevent race conditions
when tests run in parallel.
Convert multi-line >- folded scalar blocks to single-line quoted
strings in the ValidatingAdmissionPolicy. yamlfmt adds an extra
blank line after >- blocks on each run, making verify-yamlfmt fail.
Single-line quoted strings are stable across yamlfmt passes.
Match the retry configuration used by all other Helm steps in both
svc-pipeline.yaml and mgmt-pipeline.yaml.
Dev environments use containerized databases and observability tools
(postgres, jaeger, grafana, otel) that pull from docker.io and related
registries. These are not used in int/stg/prod which use Azure managed
services.

Add imageRegistryPolicy.extraAllowedRegistries config field with
dev-only overrides so the ValidatingAdmissionPolicy allows these images
in dev while keeping int/stg/prod locked down to ACR+MCR only.

Move the templatize values template to image-registry-policy/values.yaml
(outside the Helm chart directory) to use Go template range syntax for
dynamic registry list expansion without conflicting with Helm's chart
loader which requires valid YAML in deploy/values.yaml.
docker.io is now in the dev environment allowlist for dev tooling,
so the negative E2E test must use a registry that is disallowed in
all environments.
Default to Audit in all environments so the policy can be safely
deployed everywhere. Override to Deny in dev where image exceptions
are already in place.

This enables a phased approach: deploy with Audit in int/stg/prod,
review audit logs for violations, then switch to Deny once all
images are verified.

E2E deny test marked DevelopmentOnly since higher envs start in
Audit mode. Policy-exists test relaxed to accept any validationAction.
- Remove namespace.yaml template; rely on releaseNamespace in pipeline
  step for namespace creation (matching acrpull pattern)
- Use .Release.Namespace instead of .Values.namespace in templates
- Remove redundant E2E tests: VAP-exists test (tests installation not
  effect) and allowed-registries test (implicitly tested by env
  provisioning)
- Add image-registry-policy as dependsOn for all helm steps on both
  mgmt and svc pipelines so policy is active before other deployments
Add image-registry-policy template files to yamllint ignore list
since they use Go template range blocks that break YAML parsing.
Regenerate test suite fixtures to correctly place DevelopmentOnly
test in the rp-api-compat-all/parallel (development) suite only.
Previous e2e-parallel failure was caused by systemic Prow dev environment
issues (cluster creation timeouts across all tests), not by this PR's
changes. Rebasing to pick up 69 new commits from main and proactively
prevent post-merge conflicts.
- Add pods/ephemeralcontainers subresource to resourceRules so the
  policy also covers ephemeral container additions via the subresource
  API path
- Remove unused namespace field from values.yaml template
- Add upgrade-aks-cluster dependency to image-registry-policy Helm
  steps in both svc-pipeline and mgmt-pipeline to avoid applying the
  policy against an older API surface during AKS upgrades

Copilot AI 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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@avollmer-redhat

Copy link
Copy Markdown
Collaborator Author

/test e2e-parallel

@openshift-ci

openshift-ci Bot commented May 5, 2026

Copy link
Copy Markdown

Anthony Vollmer (@avollmer-redhat): The following test 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-parallel 44611eb link true /test e2e-parallel

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-ci

openshift-ci Bot commented May 24, 2026

Copy link
Copy Markdown

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.

@avollmer-redhat

Copy link
Copy Markdown
Collaborator Author

Closing — this clean-baseline PR is now obsolete.

Context: PR #4690 was merged, reverted, and then re-landed with fixes via #5367 (May 24). The image-registry-policy VAP is now live on main with pipeline integration, e2e tests, and CPO registry exceptions.

This PR's original purpose was to prove the VAP works without registry exceptions. That goal is now better served by a small, fresh PR against current main once the FSI compliance chain completes:

A new PR will be ~50 lines vs rebasing 14 commits across 3,127 diverged commits with 23+ conflict blocks.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants