Skip to content

fix(ci): use IfNotPresent pull policy for prefetched images on non-GKE#20993

Open
davdhacs wants to merge 2 commits into
masterfrom
worktree-fix-ocp-prefetch-never
Open

fix(ci): use IfNotPresent pull policy for prefetched images on non-GKE#20993
davdhacs wants to merge 2 commits into
masterfrom
worktree-fix-ocp-prefetch-never

Conversation

@davdhacs

@davdhacs davdhacs commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Description

Kubernetes 1.35 (OCP 4.22) enables the KubeletEnsureSecretPulledImages feature gate by default (KEP-2535). This changes the semantics of imagePullPolicy: Never: the kubelet now rejects pre-pulled images unless the pod's credentials match a recorded pull.

The image-prefetcher pulls images via CRI using its own credentials. On GKE, this is handled by kubelet credential plugin integration (image-prefetcher PR #184, stackrox PR #19287). On OCP/EKS/AKS, no credential plugin integration exists, so test pods get ErrImageNeverPull even though the image is present on the node.

This caused 6+ consecutive failures of the ImageScanningTest > Image metadata from registry test - quay-auto test on the OCP 4.22 periodic compat job.

The fix: use IfNotPresent instead of Never on non-GKE clusters. The image will still come from the prefetch cache when present, but won't fail the credential provenance check. The prefetch list hygiene goal (catching missing images) is still enforced on GKE which retains Never.

User-facing documentation

Testing and quality

  • the change is production ready: the change is GA, or otherwise the functionality is gated by a feature flag
  • CI results are inspected

Automated testing

  • modified existing tests

How I validated my change

Requesting targeted CI runs:

  • gke-qa-e2e-tests — verify GKE still uses Never and passes (no regression)
  • ocp-4-22-nongroovy-e2e-tests — verify OCP 4.22 (K8s 1.35) now uses IfNotPresent and passes
  • ocp-4-12-nongroovy-e2e-tests — verify older OCP still works with IfNotPresent

The periodic ocp-4.22-lpMainline-lp-ocp-compat-cr--acs--tests-aws job (which runs the groovy ImageScanningTest including quay-auto) will validate on master after merge.

…sters

Kubernetes 1.35 (OCP 4.22) enables the KubeletEnsureSecretPulledImages
feature gate by default (KEP-2535), which enforces credential provenance
checks for pre-pulled images. With imagePullPolicy: Never, the kubelet
now rejects images unless the pod's credentials match a recorded pull.

The image-prefetcher pulls images using CRI with its own credentials,
so test pods' credentials don't match — causing ErrImageNeverPull even
though the image is present on the node. This broke all OCP 4.22 compat
test runs (6+ consecutive failures on the quay-auto test).

On GKE, this was solved by integrating the kubelet credential plugin
into the prefetcher (image-prefetcher PR #184). On OCP/EKS/AKS where
no credential plugin integration exists, use IfNotPresent instead of
Never. The prefetch list hygiene goal (catching missing images) is
still enforced on GKE which retains the Never policy.

AI-assisted.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@openshift-ci

openshift-ci Bot commented Jun 5, 2026

Copy link
Copy Markdown

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

@davdhacs

davdhacs commented Jun 5, 2026

Copy link
Copy Markdown
Contributor Author

/test gke-qa-e2e-tests

@davdhacs

davdhacs commented Jun 5, 2026

Copy link
Copy Markdown
Contributor Author

/test ocp-4-22-nongroovy-e2e-tests

@davdhacs

davdhacs commented Jun 5, 2026

Copy link
Copy Markdown
Contributor Author

/test ocp-4-12-nongroovy-e2e-tests

@coderabbitai

coderabbitai Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. 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: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: fe2161be-bfa5-49aa-8e91-eed9e8d90890

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
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch worktree-fix-ocp-prefetch-never

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@davdhacs

davdhacs commented Jun 5, 2026

Copy link
Copy Markdown
Contributor Author

/test ocp-4-22-qa-e2e-tests

@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

🚀 Build Images Ready

Images are ready for commit a75068d. To use with deploy scripts:

export MAIN_IMAGE_TAG=4.12.x-102-ga75068dbf9

@davdhacs davdhacs marked this pull request as ready for review June 5, 2026 23:13
@davdhacs davdhacs requested review from mclasmeier and porridge June 8, 2026 13:52
@mclasmeier

Copy link
Copy Markdown
Contributor

For my understanding, does this mean we could also skip the kubelet credential plugin integration on GKE if we replace "Never" with "IfNotPresent"?

@davdhacs

davdhacs commented Jun 8, 2026

Copy link
Copy Markdown
Contributor Author

For my understanding, does this mean we could also skip the kubelet credential plugin integration on GKE if we replace "Never" with "IfNotPresent"?

Yes, I think so. But then we would not get a failure if someone adds an image to a test but does not add it to the image-prefetcher. -- I think @porridge had noted that part of the reason to use "Never" is to verify that the prefetch list covers all images used in tests. If we keep it as Never on at least one flavor, then we test that all images are prefetched still but avoid the registry credentials issue on OCP.

I think that by setting IfNotPresent, it sees it doesn't have the credential already verified but then, instead of failing like with Never, it uses the the valid credentials to pull from the registry, but gets the locally cached layers instead of a full new download.

@davdhacs

davdhacs commented Jun 8, 2026

Copy link
Copy Markdown
Contributor Author

re: image found but failure if Never and creds-avail check failed: https://github.com/kubernetes/kubernetes/blob/v1.35.5/pkg/kubelet/images/image_manager.go#L269

@porridge

porridge commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

@davdhacs

Copy link
Copy Markdown
Contributor Author

Let me try this instead:

@porridge Could we apply the IfNotPresent as a workaround for now until the image credential provider setup is merged?

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.

3 participants