Skip to content

OCPNODE-4535: Automate OCP-44820 change container registry config#31182

Open
Chandan9112 wants to merge 1 commit into
openshift:mainfrom
Chandan9112:automate-ocp-44820
Open

OCPNODE-4535: Automate OCP-44820 change container registry config#31182
Chandan9112 wants to merge 1 commit into
openshift:mainfrom
Chandan9112:automate-ocp-44820

Conversation

@Chandan9112
Copy link
Copy Markdown
Contributor

@Chandan9112 Chandan9112 commented May 15, 2026

Summary

  • Automates OCP-44820: verifies that updating image.config.openshift.io/cluster with containerRuntimeSearchRegistries and allowedRegistries triggers an MCO rollout and the change is reflected in /etc/containers/registries.conf.d/01-image-searchRegistries.conf on worker nodes.

Here is the test case link: Polarian-44820

Test Results

It passed successfully while executing on a live OCP 4.22 cluster:

./openshift-tests run-test "[Suite:openshift/disruptive-longrunning][sig-node][Disruptive] Image registry config [OTP] change container registry config [OCP-44820] [Serial]"

  Running Suite:  - /Users/cmaurya/go/src/github.com/openshift/origin
  ===================================================================
  Random Seed: 1778749374 - will randomize all specs

  Will run 1 of 1 specs
  ------------------------------
  [Suite:openshift/disruptive-longrunning][sig-node][Disruptive] Image registry config [OTP] change container registry config [OCP-44820]
  github.com/openshift/origin/test/extended/node/node_e2e/node.go:289
    STEP: Creating a kubernetes client @ 05/14/26 14:32:59.323
  I0514 14:32:59.324618    9619 discovery.go:214] Invalidating discovery information
  I0514 14:32:59.325418 9619 framework.go:2330] [precondition-check] checking if cluster is MicroShift
  I0514 14:32:59.634319 9619 framework.go:2353] IsMicroShiftCluster: microshift-version configmap not found, not MicroShift
    STEP: Save the original image.config for later restore @ 05/14/26 14:32:59.634
    STEP: Update image.config to add search registry and allowed registries @ 05/14/26 14:33:00.652
    STEP: Wait for worker and master MCP rollout to complete @ 05/14/26 14:33:01.282
  I0514 14:33:01.282442 9619 imagepolicy.go:694] Waiting for pool worker to complete
  I0514 14:44:33.911003 9619 imagepolicy.go:694] Waiting for pool master to complete
    STEP: Verify search registries config on a worker node @ 05/14/26 14:54:32.895
  I0514 14:54:48.170782 9619 node.go:368] Registries config on ci-ln-dj6qsnt-72292-vqk8q-worker-a-v5hd4:
  unqualified-search-registries = ["registry.access.redhat.com", "docker.io", "quay.io", "qe.quay.io"]
  short-name-mode = ""
  additional-layer-store-auth-helper = ""
  I0514 14:54:48.179261 9619 node.go:301] Cleanup: restoring original image.config
  I0514 14:54:49.484899 9619 imagepolicy.go:694] Waiting for pool worker to complete
  I0514 15:03:15.423287 9619 imagepolicy.go:694] Waiting for pool master to complete
  I0514 15:11:03.589844 9619 node.go:321] Cleanup: waiting for all cluster operators to settle
  I0514 15:11:03.675772 9619 settle.go:38] Waiting for operators to settle
  • [1964.612 seconds]
  ------------------------------

  Ran 1 of 1 Specs in 1964.614 seconds
  SUCCESS! -- 1 Passed | 0 Failed | 0 Pending | 0 Skipped

Summary by CodeRabbit

  • Tests
    • Added a disruptive long-running e2e suite "Image registry config" to verify a configured search registry is applied on ready, schedulable worker nodes.
    • Skips MicroShift clusters and when cluster-type detection fails.
    • Applies and restores cluster image registry settings with conflict-aware retries, waits for machine-config pool rollouts, optionally waits for cluster operators to settle, and logs warnings if restore/convergence/settle steps fail.

@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-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label May 15, 2026
@openshift-ci-robot
Copy link
Copy Markdown

openshift-ci-robot commented May 15, 2026

@Chandan9112: This pull request references OCPNODE-4535 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 "5.0.0" version, but no target version was set.

Details

In response to this:

Summary

  • Migrates OCP-45351 (ContainerRuntimeConfig pidsLimit + conmon verification) from openshift-tests-private to Origin.
  • Automates OCP-44820 (change container registry config: add search registries and allowedRegistries via image.config.openshift.io/cluster, verify MCO rollout lands on nodes).
  • Uses existing helper functions (imagepolicy.WaitForMCPConfigSpecChangeAndUpdated, nodeutils.ExecOnNodeWithChroot, operator.WaitForOperatorsToSettle) and follows Ginkgo style guide conventions.

Test plan

  • Both tests pass on a local cluster ([OCP-45351] and [OCP-44820])
  • CI passes

/cc @openshift/sig-node

Made with Cursor

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 added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 15, 2026
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 15, 2026

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

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 15, 2026

@Chandan9112: GitHub didn't allow me to request PR reviews from the following users: openshift/sig-node.

Note that only openshift members and repo collaborators can review this PR, and authors cannot review their own PRs.

Details

In response to this:

Summary

  • Migrates OCP-45351 (ContainerRuntimeConfig pidsLimit + conmon verification) from openshift-tests-private to Origin.
  • Automates OCP-44820 (change container registry config: add search registries and allowedRegistries via image.config.openshift.io/cluster, verify MCO rollout lands on nodes).
  • Uses existing helper functions (imagepolicy.WaitForMCPConfigSpecChangeAndUpdated, nodeutils.ExecOnNodeWithChroot, operator.WaitForOperatorsToSettle) and follows Ginkgo style guide conventions.

Test plan

  • Both tests pass on a local cluster ([OCP-45351] and [OCP-44820])
  • CI passes

/cc @openshift/sig-node

Made with Cursor

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.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 15, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Adds imports for conflict-aware retries and an operator test helper, and a disruptive serial e2e that patches cluster ImageConfig (allowed/search registries) with RetryOnConflict, waits for MCP rollout, verifies node registry config, and restores the original ImageConfig.

Changes

Node e2e registry config

Layer / File(s) Summary
Imports update
test/extended/node/node_e2e/node.go
Adds Kubernetes retry utilities and the operator test helper to the node e2e imports.
Image registry config test suite
test/extended/node/node_e2e/node.go
Adds a [sig-node][Disruptive] Image registry config e2e: records current image.config.openshift.io/cluster, updates AllowedRegistries and ContainerRuntimeSearchRegistries (adds a search registry) using retry.RetryOnConflict, waits for MachineConfigPool rollout, verifies /etc/containers/registries.conf.d/01-image-searchRegistries.conf on a ready schedulable worker via Eventually, and defers cleanup that restores the original ImageConfig with conflict-aware retries and waits for MCP/cluster operator convergence.
sequenceDiagram
  participant Test as ImageRegistryConfigTest
  participant API as ImageConfig API
  participant MCP as MachineConfigPool
  participant Node as Worker node
  Test->>API: GET current image.config.openshift.io/cluster
  Test->>API: RetryOnConflict PATCH update registry sources
  API->>MCP: apply updated spec
  MCP->>Node: rollout MachineConfig
  Test->>Node: check /etc/containers/registries.conf.d/01-image-searchRegistries.conf
  Test->>API: RetryOnConflict PATCH restore original image.config
  MCP->>Node: converge to restored spec
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • openshift/origin#31142: Adds a similar disruptive e2e in test/extended/node/node_e2e/node.go that patches image/registry configuration and waits for MCP rollout before verifying node registry files.

Suggested reviewers

  • mrunalp
🚥 Pre-merge checks | ✅ 11 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Single Node Openshift (Sno) Test Compatibility ⚠️ Warning Test expects multiple worker nodes. GetReadySchedulableWorkerNodes filters out master-labeled nodes. SNO nodes have both labels, causing empty list and test failure. Add [Skipped:SingleReplicaTopology] label to test line 335, or add exutil.IsSingleNode() skip check. See custom check instructions for implementation details.
✅ 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 accurately describes the main change: automating a test (OCP-44820) for container registry config updates, which matches the file additions and test suite introduction.
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 Test names are static and deterministic with no dynamic information, timestamps, UUIDs, node names, or pod names. Dynamic values are appropriately placed in test bodies.
Test Structure And Quality ✅ Passed Single responsibility (one behavior tested), setup/cleanup properly used, timeouts on cluster operations, descriptive assertion messages, consistent with codebase patterns.
Microshift Test Compatibility ✅ Passed Test has BeforeEach hook in Describe block that checks exutil.IsMicroShiftCluster() and skips if MicroShift detected, protecting test from unavailable MachineConfig APIs.
Topology-Aware Scheduling Compatibility ✅ Passed PR modifies only test/extended/node/node_e2e/node.go—a test file, not a deployment manifest, operator, or controller. Check applies only to production resources.
Ote Binary Stdout Contract ✅ Passed No stdout contract violations detected. Module code limited to g.Describe. No init(), main(), problematic prints, or klog writes. Logging via e2e.Logf (framework-safe). Clean test structure.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed Test has no IPv4 assumptions or external connectivity requirements. It only updates Kubernetes config and verifies via local node file reads.

✏️ 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
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 15, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

@Chandan9112 Chandan9112 force-pushed the automate-ocp-44820 branch from ef40051 to 6e92bbc Compare May 15, 2026 09:01
@Chandan9112 Chandan9112 changed the title OCPNODE-4535: Automate OCP-44820 and OCP-45351 node tests OCPNODE-4535: Automate OCP-44820 change container registry config May 15, 2026
@openshift-merge-bot openshift-merge-bot Bot added the ready-for-human-review Indicates a PR has been reviewed by automated tools and is ready for human review label May 15, 2026
Copy link
Copy Markdown

@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.

Actionable comments posted: 1

🧹 Nitpick comments (1)
test/extended/node/node_e2e/node.go (1)

357-360: 💤 Low value

Early return on restore failure prevents MCP convergence wait.

If restoring the original image.config fails, the cleanup returns immediately without waiting for MCP rollout or operator stabilization. This may leave the cluster in an intermediate state. However, since the restore itself failed, there's little value in waiting for MCP convergence of a potentially incomplete update.

Consider adding a log message indicating that MCP waits are being skipped due to restore failure, to make the behavior more explicit.

📝 Proposed improvement for clarity
 		if restoreErr != nil {
-			e2e.Logf("WARNING: failed to restore original image.config: %v", restoreErr)
+			e2e.Logf("WARNING: failed to restore original image.config: %v; skipping MCP convergence wait", restoreErr)
 			return
 		}
🤖 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/extended/node/node_e2e/node.go` around lines 357 - 360, The cleanup path
currently returns immediately when restoreErr != nil in the block that attempts
to restore the original image.config; update that block (the if restoreErr !=
nil branch) to log an explicit message that MCP rollout/operator stabilization
waits are being skipped because the restore failed (mention restoreErr in the
log for context) before returning so readers know why MCP waits are omitted;
modify the code around the restore of image.config (the restoreErr check) to add
this log entry referencing restoreErr and then return as before.
🤖 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.

Inline comments:
In `@test/extended/node/node_e2e/node.go`:
- Around line 373-389: The code assigns to imageConfig.Spec.RegistrySources
fields without nil-checking; inside the retry.RetryOnConflict block (where you
call oc.AdminConfigClient().ConfigV1().Images().Get and later Update), check if
imageConfig.Spec.RegistrySources is nil and if so initialize it (e.g., set
imageConfig.Spec.RegistrySources = &configv1.RegistrySources{} ) before setting
AllowedRegistries and ContainerRuntimeSearchRegistries to avoid a runtime panic
when RegistrySources is nil.

---

Nitpick comments:
In `@test/extended/node/node_e2e/node.go`:
- Around line 357-360: The cleanup path currently returns immediately when
restoreErr != nil in the block that attempts to restore the original
image.config; update that block (the if restoreErr != nil branch) to log an
explicit message that MCP rollout/operator stabilization waits are being skipped
because the restore failed (mention restoreErr in the log for context) before
returning so readers know why MCP waits are omitted; modify the code around the
restore of image.config (the restoreErr check) to add this log entry referencing
restoreErr and then return as before.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Enterprise

Run ID: f2d72291-5f8c-48e4-9b6b-2790534d5327

📥 Commits

Reviewing files that changed from the base of the PR and between ef40051 and 6e92bbc.

📒 Files selected for processing (1)
  • test/extended/node/node_e2e/node.go

Comment on lines +373 to +389
g.By("Update image.config to add search registry and allowed registries")
err = retry.RetryOnConflict(retry.DefaultBackoff, func() error {
imageConfig, getErr := oc.AdminConfigClient().ConfigV1().Images().Get(ctx, "cluster", metav1.GetOptions{})
if getErr != nil {
return getErr
}
imageConfig.Spec.RegistrySources.AllowedRegistries = []string{
"registry.access.redhat.com", "docker.io", "quay.io", searchRegistry,
"image-registry.openshift-image-registry.svc:5000",
}
imageConfig.Spec.RegistrySources.ContainerRuntimeSearchRegistries = []string{
"registry.access.redhat.com", "docker.io", "quay.io", searchRegistry,
}
_, updateErr := oc.AdminConfigClient().ConfigV1().Images().Update(ctx, imageConfig, metav1.UpdateOptions{})
return updateErr
})
o.Expect(err).NotTo(o.HaveOccurred(), "failed to update image.config.openshift.io/cluster")
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Guard against nil RegistrySources to prevent panic.

Lines 379 and 383 set fields on imageConfig.Spec.RegistrySources without checking if it's nil. In the OpenShift configv1 API, ImageSpec.RegistrySources is a pointer and may be nil on a fresh cluster or after certain operations. Accessing fields on a nil pointer will cause a runtime panic.

🛡️ Proposed fix to initialize RegistrySources if nil
 		g.By("Update image.config to add search registry and allowed registries")
 		err = retry.RetryOnConflict(retry.DefaultBackoff, func() error {
 			imageConfig, getErr := oc.AdminConfigClient().ConfigV1().Images().Get(ctx, "cluster", metav1.GetOptions{})
 			if getErr != nil {
 				return getErr
 			}
+			if imageConfig.Spec.RegistrySources == nil {
+				imageConfig.Spec.RegistrySources = &configv1.RegistrySources{}
+			}
 			imageConfig.Spec.RegistrySources.AllowedRegistries = []string{
 				"registry.access.redhat.com", "docker.io", "quay.io", searchRegistry,
 				"image-registry.openshift-image-registry.svc:5000",
 			}
🤖 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/extended/node/node_e2e/node.go` around lines 373 - 389, The code assigns
to imageConfig.Spec.RegistrySources fields without nil-checking; inside the
retry.RetryOnConflict block (where you call
oc.AdminConfigClient().ConfigV1().Images().Get and later Update), check if
imageConfig.Spec.RegistrySources is nil and if so initialize it (e.g., set
imageConfig.Spec.RegistrySources = &configv1.RegistrySources{} ) before setting
AllowedRegistries and ContainerRuntimeSearchRegistries to avoid a runtime panic
when RegistrySources is nil.

@Chandan9112 Chandan9112 force-pushed the automate-ocp-44820 branch 2 times, most recently from a59ed7a to e7848ff Compare May 15, 2026 11:38
Adds e2e test that verifies updating image.config.openshift.io/cluster
with containerRuntimeSearchRegistries and allowedRegistries triggers
an MCO rollout and the change is reflected on worker nodes.

Co-authored-by: Cursor <cursoragent@cursor.com>
@Chandan9112 Chandan9112 force-pushed the automate-ocp-44820 branch from e7848ff to e37496d Compare May 15, 2026 12:02
@Chandan9112 Chandan9112 marked this pull request as ready for review May 15, 2026 12:05
@openshift-ci openshift-ci Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 15, 2026
@openshift-ci openshift-ci Bot requested review from asahay19 and cpmeadors May 15, 2026 12:05
@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

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 15, 2026

@Chandan9112: 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-serial-2of2 e37496d link true /test e2e-aws-ovn-serial-2of2
ci/prow/e2e-aws-ovn-serial-1of2 e37496d link true /test e2e-aws-ovn-serial-1of2
ci/prow/e2e-vsphere-ovn e37496d link true /test e2e-vsphere-ovn
ci/prow/e2e-aws-ovn-fips e37496d link true /test e2e-aws-ovn-fips
ci/prow/e2e-gcp-csi e37496d link true /test e2e-gcp-csi
ci/prow/e2e-metal-ipi-ovn-ipv6 e37496d link true /test e2e-metal-ipi-ovn-ipv6
ci/prow/e2e-gcp-ovn e37496d link true /test e2e-gcp-ovn
ci/prow/e2e-vsphere-ovn-upi e37496d link true /test e2e-vsphere-ovn-upi

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

jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. ready-for-human-review Indicates a PR has been reviewed by automated tools and is ready for human review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants