Skip to content

USHIFT-6971: patch imagePullPolicy before clock fast-forward in cert rotation test#6666

Closed
copejon wants to merge 2 commits into
openshift:mainfrom
copejon:ushift-6971-cert-rotation-fix
Closed

USHIFT-6971: patch imagePullPolicy before clock fast-forward in cert rotation test#6666
copejon wants to merge 2 commits into
openshift:mainfrom
copejon:ushift-6971-cert-rotation-fix

Conversation

@copejon
Copy link
Copy Markdown
Contributor

@copejon copejon commented May 13, 2026

Summary

  • Deployments with imagePullPolicy: Always fail image pulls when the cert rotation test fast-forwards the clock ~150 days past CDN TLS cert expiry, causing ImagePullBackOff and greenboot timeout.
  • Before stopping chronyd and advancing the clock, dynamically discover and patch all such deployments to IfNotPresent. Images are already cached from initial startup, so no pull is needed.
  • No revert is required — the VM is ephemeral and CDN certs are valid again after Restore System Date runs.

Test plan

  • make verify-rf passes clean (robocop check + format)
  • Manual Rotation Of Etcd Signer Certs — PASS (37.7s)
  • Certificate Rotation — PASS (98.8s)
  • Tested on local bootc VM (el98-src@standard-suite2 scenario, rhel98-bootc-source image)

Summary by CodeRabbit

  • Tests
    • Updated certificate rotation test suite: added steps to change container image pull policies to IfNotPresent with per-container patching and rollout waits, and introduced new test keywords to orchestrate these actions.

…rotation test

Deployments with imagePullPolicy: Always fail to pull images when the
fast-forwarded clock exceeds CDN TLS cert expiry, causing greenboot timeout.
Patch all such deployments to IfNotPresent before the time change since
images are already cached and the VM is ephemeral.
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label May 13, 2026
@openshift-ci-robot
Copy link
Copy Markdown

openshift-ci-robot commented May 13, 2026

@copejon: This pull request references USHIFT-6971 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 bug to target the "5.0.0" version, but no target version was set.

Details

In response to this:

Summary

  • Deployments with imagePullPolicy: Always fail image pulls when the cert rotation test fast-forwards the clock ~150 days past CDN TLS cert expiry, causing ImagePullBackOff and greenboot timeout.
  • Before stopping chronyd and advancing the clock, dynamically discover and patch all such deployments to IfNotPresent. Images are already cached from initial startup, so no pull is needed.
  • No revert is required — the VM is ephemeral and CDN certs are valid again after Restore System Date runs.

Test plan

  • make verify-rf passes clean (robocop check + format)
  • Manual Rotation Of Etcd Signer Certs — PASS (37.7s)
  • Certificate Rotation — PASS (98.8s)
  • Tested on local bootc VM (el98-src@standard-suite2 scenario, rhel98-bootc-source image)

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.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 13, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Enterprise

Run ID: 8e57efd6-31d8-48ba-85ef-373d0d625a47

📥 Commits

Reviewing files that changed from the base of the PR and between 88339fc and 81b9af9.

📒 Files selected for processing (1)
  • test/suites/standard2/validate-certificate-rotation.robot
🚧 Files skipped from review as they are similar to previous changes (1)
  • test/suites/standard2/validate-certificate-rotation.robot

Walkthrough

Adds Robot Framework keywords that find deployments with containers set to imagePullPolicy: Always, patch those containers to IfNotPresent, wait for rollouts, and invoke this step before stopping chronyd and advancing the system clock.

Changes

Certificate Rotation — ImagePullPolicy patching and orchestration

Layer / File(s) Summary
Patch single container and wait for rollout
test/suites/standard2/validate-certificate-rotation.robot (new keyword Patch Deploy ImagePullPolicy To IfNotPresent, lines ~185–192)
Implements a keyword that applies a JSON patch to a specified deployment container index to set imagePullPolicy: IfNotPresent via oc patch and then runs oc rollout status to wait for the deployment to complete.
Discover and patch all matching containers, integrated into date-change flow
test/suites/standard2/validate-certificate-rotation.robot (new keyword Patch ImagePullPolicy For Date Change, lines ~162–184; Change System Date To call at line ~100)
Adds a keyword that lists all deployments cluster-wide (oc get deploy -A -o json), uses jq to find containers where imagePullPolicy == "Always", and calls the single-container patch helper for each match. Change System Date To now calls this keyword before stopping chronyd and setting the future time.

Sequence Diagram

sequenceDiagram
    participant Test as Test Suite
    participant Kube as Kubernetes API (oc)
    participant Deploy as Deployment

    Test->>Kube: oc get deploy -A -o json (list deployments)
    Kube-->>Test: Deployment manifests
    Test->>Test: Filter containers where imagePullPolicy == "Always"
    Test->>Kube: oc patch (set container[index].imagePullPolicy = "IfNotPresent")
    Kube->>Deploy: Apply patch, trigger rollout
    Deploy-->>Kube: Rollout in progress
    Test->>Kube: oc rollout status (wait)
    Kube-->>Test: Rollout complete
    Test->>Test: Stop chronyd and change system date
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 11 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Test Structure And Quality ❓ Inconclusive Custom check requires Ginkgo patterns (It blocks, BeforeEach/AfterEach), but PR modifies Robot Framework test code which uses entirely different patterns (Test Cases, Suite Setup/Teardown). Check is not applicable to Robot Framework code. Evaluate against RF best practices instead: keyword organization, timeouts on cluster ops, error handling—all correctly implemented here.
✅ Passed checks (11 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly reflects the main change: adding a patch for imagePullPolicy before clock fast-forward in the certificate rotation test, matching the changeset's core objective.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed PR modifies Robot Framework tests only (.robot files), not Ginkgo tests. Ginkgo check not applicable. Existing test names are stable and contain no dynamic information.
Microshift Test Compatibility ✅ Passed The custom check targets Ginkgo e2e tests. This PR modifies only Robot Framework test files (.robot), not Ginkgo Go tests. The check is not applicable to Robot Framework tests.
Single Node Openshift (Sno) Test Compatibility ✅ Passed The PR modifies only a Robot Framework test file, not Ginkgo e2e tests. The custom check applies to "new Ginkgo e2e tests" with patterns like It(), Describe(), Context(). No Go e2e tests were added.
Topology-Aware Scheduling Compatibility ✅ Passed Test file only; check applies to deployment manifests, operator code, and controllers—not modified here.
Ote Binary Stdout Contract ✅ Passed PR modifies Robot Framework test file (.robot), not Go-based OTE binary. Check applies only to Go/Ginkgo binaries communicating via JSON stdout. Not applicable here.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed PR modifies Robot Framework test file (.robot), not Ginkgo e2e tests. Custom check applies only to Ginkgo tests. Not applicable here.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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.

@openshift-ci openshift-ci Bot requested review from eslutsky and vanhalenar May 13, 2026 22:13
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 13, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: copejon

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

The pull request process is described 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

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 13, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
test/suites/standard2/validate-certificate-rotation.robot (1)

176-177: ⚡ Quick win

Add defensive check for split parts count.

If the jq output is malformed or contains unexpected whitespace, indexing ${parts}[0], ${parts}[1], ${parts}[2] could fail with an index out of range error.

🛡️ Suggested defensive check
     FOR    ${line}    IN    @{lines}
         IF    '${line.strip()}' == '${EMPTY}'    CONTINUE
         @{parts}=    Split String    ${line}
+        ${parts_len}=    Get Length    ${parts}
+        IF    ${parts_len} != 3
+            Log    WARNING: Unexpected line format: ${line}
+            CONTINUE
+        END
         Patch Deploy ImagePullPolicy To IfNotPresent    ${parts}[0]    ${parts}[1]    ${parts}[2]
     END
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/suites/standard2/validate-certificate-rotation.robot` around lines 176 -
177, After splitting `${line}` into `${parts}` before calling `Patch Deploy
ImagePullPolicy To IfNotPresent`, add a defensive check using `Get Length` on
`${parts}` and if the length is less than 3 use `Run Keyword If` to log a
warning and `Continue For Loop` (or otherwise skip the current iteration) to
avoid indexing `${parts}[0]`, `${parts}[1]`, `${parts}[2]`; ensure the check
sits between the `Split String    ${line}` and `Patch Deploy ImagePullPolicy To
IfNotPresent` steps so malformed or whitespace-only output won't cause an index
out of range.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@test/suites/standard2/validate-certificate-rotation.robot`:
- Around line 176-177: After splitting `${line}` into `${parts}` before calling
`Patch Deploy ImagePullPolicy To IfNotPresent`, add a defensive check using `Get
Length` on `${parts}` and if the length is less than 3 use `Run Keyword If` to
log a warning and `Continue For Loop` (or otherwise skip the current iteration)
to avoid indexing `${parts}[0]`, `${parts}[1]`, `${parts}[2]`; ensure the check
sits between the `Split String    ${line}` and `Patch Deploy ImagePullPolicy To
IfNotPresent` steps so malformed or whitespace-only output won't cause an index
out of range.

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Enterprise

Run ID: e5261f99-a148-4e36-920d-9a99c17c331c

📥 Commits

Reviewing files that changed from the base of the PR and between 7e80ce3 and 88339fc.

📒 Files selected for processing (1)
  • test/suites/standard2/validate-certificate-rotation.robot

@copejon
Copy link
Copy Markdown
Contributor Author

copejon commented May 14, 2026

CI failure in e2e-aws-tests-bootc-el9 is unrelated to this PR. The el98-src@standard-suite2 scenario (cert rotation tests) passed. Two pre-existing failures caused the job-level failure:

  • el98-src@storage: "Rebooting Healthy System Should Keep Functional PVC" — PVC/reboot test
  • el98-src@optional: SR-IOV and Multus/bridge CNI plugin tests

Retriggering.

@copejon
Copy link
Copy Markdown
Contributor Author

copejon commented May 14, 2026

/retest-required

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 14, 2026

@copejon: all tests passed!

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.

... Prevents image pull failures when the system clock is fast-forwarded past CDN
... TLS certificate expiry dates.
VAR ${jq_filter}=
... .items[] | .metadata.namespace as $ns | .metadata.name as $d | .spec.template.spec.containers | to_entries[] | select(.value.imagePullPolicy == "Always") | "\\($ns) \\($d) \\(.key)"
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.

Do we need this check? What will happen if we patch ALL image policies?

Run With Kubeconfig
... oc patch deploy -n ${ns} ${deploy} --type=json -p '[{"op":"replace","path":"/spec/template/spec/containers/${idx}/imagePullPolicy","value":"IfNotPresent"}]'
Run With Kubeconfig
... oc rollout status deploy/${deploy} -n ${ns} --timeout=120s
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.

How much time is this taking? Standard suites are already close to the 30m runtime limit, so this may delay those significantly.

Change System Date To
[Documentation] Move the system to a future date.
[Arguments] ${future_date}
Patch ImagePullPolicy For Date Change
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.

I have a more high-level question. If we have certain images with pull policy of Always, this would break offline configurations, wouldn't it?

Because of that reason, should we not be patching those images as part of rebase?

@copejon
Copy link
Copy Markdown
Contributor Author

copejon commented May 18, 2026

Closing in favor of a more targeted solution #6667

/close

@openshift-ci openshift-ci Bot closed this May 18, 2026
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 18, 2026

@copejon: Closed this PR.

Details

In response to this:

Closing in favor of a more targeted solution #6667

/close

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.

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

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. 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.

3 participants