Skip to content

OCPNODE-4381: Migrate OCP-38271 from openshift-tests-private#30960

Open
BhargaviGudi wants to merge 1 commit intoopenshift:mainfrom
BhargaviGudi:migrate-38271
Open

OCPNODE-4381: Migrate OCP-38271 from openshift-tests-private#30960
BhargaviGudi wants to merge 1 commit intoopenshift:mainfrom
BhargaviGudi:migrate-38271

Conversation

@BhargaviGudi
Copy link
Copy Markdown
Contributor

@BhargaviGudi BhargaviGudi commented Apr 6, 2026

Summary Adds test to verify init containers do not restart when the exited init container is removed from the node.

Changes

  • Add test/extended/testdata/node/node_e2e/pod-initContainer.yaml - Pod template with init container
  • Add helper functions to test/extended/node/node_utils.go:
    • PodInitConDescription struct with methods: Create(), Delete(), ContainerExit(), DeleteInitContainer(), InitContainerNotRestart()
    • PodStatus() function to check pod readiness
  • Add test in test/extended/node/node_e2e/node.go:
  • [OTP] Init containers should not restart when the exited init container is removed from node [OCP-38271]

Original author: minmli@redhat.com
Migrated by: bgudi@redhat.com

tested manually on 4.22.0-0.nightly-2026-04-06-051707

  [sig-node] [Jira:Node/Kubelet] NODE initContainer policy,volume,readines,quota [OTP] Init containers should not restart when the exited init container is removed from node [OCP-38271]
  github.com/openshift/origin/test/extended/node/node_e2e/node.go:132
    STEP: Creating a kubernetes client @ 04/07/26 15:42:34.99
  I0407 15:42:34.991250 2683548 discovery.go:214] Invalidating discovery information
  I0407 15:42:39.243543 2683548 client.go:293] configPath is now "/tmp/configfile3855134934"
  I0407 15:42:39.243585 2683548 client.go:368] The user is now "e2e-test-node-initcontainer-vkd4d-user"
  I0407 15:42:39.243594 2683548 client.go:370] Creating project "e2e-test-node-initcontainer-vkd4d"
  I0407 15:42:40.691446 2683548 client.go:378] Waiting on permissions in project "e2e-test-node-initcontainer-vkd4d" ...
  I0407 15:42:41.830235 2683548 client.go:407] DeploymentConfig capability is enabled, adding 'deployer' SA to the list of default SAs
  I0407 15:42:42.111126 2683548 client.go:422] Waiting for ServiceAccount "default" to be provisioned...
  I0407 15:42:44.974897 2683548 client.go:422] Waiting for ServiceAccount "builder" to be provisioned...
  I0407 15:42:46.205469 2683548 client.go:422] Waiting for ServiceAccount "deployer" to be provisioned...
  I0407 15:42:46.806100 2683548 client.go:432] Waiting for RoleBinding "system:image-pullers" to be provisioned...
  I0407 15:42:47.226829 2683548 client.go:432] Waiting for RoleBinding "system:image-builders" to be provisioned...
  I0407 15:42:47.639404 2683548 client.go:432] Waiting for RoleBinding "system:deployers" to be provisioned...
  I0407 15:42:49.632918 2683548 client.go:469] Project "e2e-test-node-initcontainer-vkd4d" has been fully provisioned.
  I0407 15:42:49.634001 2683548 framework.go:2330] [precondition-check] checking if cluster is MicroShift
  I0407 15:42:49.858322 2683548 framework.go:2353] IsMicroShiftCluster: microshift-version configmap not found, not MicroShift
    STEP: Test for case OCP-38271 @ 04/07/26 15:42:49.858
  I0407 15:42:53.986416 2683548 client.go:293] configPath is now "/tmp/configfile57604844"
  I0407 15:42:53.986465 2683548 client.go:368] The user is now "e2e-test-node-initcontainer-7cc7f-user"
  I0407 15:42:53.986474 2683548 client.go:370] Creating project "e2e-test-node-initcontainer-7cc7f"
  I0407 15:42:54.364671 2683548 client.go:378] Waiting on permissions in project "e2e-test-node-initcontainer-7cc7f" ...
  I0407 15:42:55.812977 2683548 client.go:407] DeploymentConfig capability is enabled, adding 'deployer' SA to the list of default SAs
  I0407 15:42:56.074192 2683548 client.go:422] Waiting for ServiceAccount "default" to be provisioned...
  I0407 15:42:56.641302 2683548 client.go:422] Waiting for ServiceAccount "builder" to be provisioned...
  I0407 15:42:57.246370 2683548 client.go:422] Waiting for ServiceAccount "deployer" to be provisioned...
  I0407 15:42:58.181456 2683548 client.go:432] Waiting for RoleBinding "system:image-pullers" to be provisioned...
  I0407 15:42:58.453551 2683548 client.go:432] Waiting for RoleBinding "system:image-builders" to be provisioned...
  I0407 15:42:58.691910 2683548 client.go:432] Waiting for RoleBinding "system:deployers" to be provisioned...
  I0407 15:43:01.974026 2683548 client.go:469] Project "e2e-test-node-initcontainer-7cc7f" has been fully provisioned.
    STEP: Create a pod with init container @ 04/07/26 15:43:01.974
    STEP: Check pod status @ 04/07/26 15:43:02.383
    STEP: Check init container exit normally @ 04/07/26 15:43:07.269
  I0407 15:43:13.034515 2683548 node.go:204] Init container exited with code 0
    STEP: Get node where pod is running @ 04/07/26 15:43:13.034
    STEP: Get init container ID from pod status @ 04/07/26 15:43:13.408
    STEP: Delete init container from node @ 04/07/26 15:43:13.408
  I0407 15:43:16.964246 2683548 node.go:239] Container deletion output: 1edf2cf9948c161d69b57e0c6cba2858f53af2483c00212be69baebc8f391ca9
    STEP: Check init container not restart again @ 04/07/26 15:43:16.964
  I0407 15:43:22.275493 2683548 node.go:255] Init container has not restarted
  I0407 15:43:22.783492 2683548 client.go:689] Deleted {user.openshift.io/v1, Resource=users  e2e-test-node-initcontainer-vkd4d-user}, err: <nil>
  I0407 15:43:23.059018 2683548 client.go:689] Deleted {oauth.openshift.io/v1, Resource=oauthclients  e2e-client-e2e-test-node-initcontainer-vkd4d}, err: <nil>
  I0407 15:43:23.291689 2683548 client.go:689] Deleted {oauth.openshift.io/v1, Resource=oauthaccesstokens  sha256~4zwghso_ATUPoCGL0QbFnEj1L3Sl7dTbulxaUP5ikIs}, err: <nil>
  I0407 15:43:23.532241 2683548 client.go:689] Deleted {user.openshift.io/v1, Resource=users  e2e-test-node-initcontainer-7cc7f-user}, err: <nil>
  I0407 15:43:23.813310 2683548 client.go:689] Deleted {oauth.openshift.io/v1, Resource=oauthclients  e2e-client-e2e-test-node-initcontainer-7cc7f}, err: <nil>
  I0407 15:43:24.049653 2683548 client.go:689] Deleted {oauth.openshift.io/v1, Resource=oauthaccesstokens  sha256~fKDLHmwN96xMJxbYazWMJ2J0BxIPZcvitRIFX78xaKE}, err: <nil>
    STEP: Destroying namespace "e2e-test-node-initcontainer-vkd4d" for this suite. @ 04/07/26 15:43:24.049
    STEP: Destroying namespace "e2e-test-node-initcontainer-7cc7f" for this suite. @ 04/07/26 15:43:24.315
  • [50.042 seconds]
  ------------------------------

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

@openshift-ci-robot
Copy link
Copy Markdown

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/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 6, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 6, 2026

Walkthrough

A new Ginkgo test case (OCP-38271) was added to the node E2E test suite that verifies init container restart behavior when its process is forcibly removed from the host via crictl, ensuring the container does not restart after deletion.

Changes

Cohort / File(s) Summary
Node E2E Test Addition
test/extended/node/node_e2e/node.go
Added imports for pod management and host operations, then introduced a new test suite with BeforeEach skip for MicroShift. Implemented test case that creates a pod with init and main containers, waits for init completion, deletes the init container process on the host node, and verifies no restart occurs.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

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

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 bertinatto and cpmeadors April 6, 2026 09:48
@openshift-ci openshift-ci bot added the e2e-images-update Related to images used by e2e tests label Apr 6, 2026
@BhargaviGudi BhargaviGudi changed the title WIP Migrate OCP-38271 from openshift-tests-private WIP OCPNODE-4381: Migrate OCP-38271 from openshift-tests-private Apr 6, 2026
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Apr 6, 2026
@openshift-ci-robot
Copy link
Copy Markdown

openshift-ci-robot commented Apr 6, 2026

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

Details

In response to this:

Summary Adds test to verify init containers do not restart when the exited init container is removed from the node.

Changes

  • Add test/extended/testdata/node/node_e2e/pod-initContainer.yaml - Pod template with init container
  • Add helper functions to test/extended/node/node_utils.go:
    • PodInitConDescription struct with methods: Create(), Delete(), ContainerExit(), DeleteInitContainer(), InitContainerNotRestart()
    • PodStatus() function to check pod readiness
  • Add test in test/extended/node/node_e2e/node.go:
  • [OTP] Init containers should not restart when the exited init container is removed from node [OCP-38271]

Original author: minmli@redhat.com
Migrated by: bgudi@redhat.com

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.

@BhargaviGudi
Copy link
Copy Markdown
Contributor Author

/test verify

@BhargaviGudi BhargaviGudi force-pushed the migrate-38271 branch 2 times, most recently from f9f4ebe to 44944db Compare April 7, 2026 07:02
@openshift-ci-robot
Copy link
Copy Markdown

openshift-ci-robot commented Apr 7, 2026

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

Details

In response to this:

Summary Adds test to verify init containers do not restart when the exited init container is removed from the node.

Changes

  • Add test/extended/testdata/node/node_e2e/pod-initContainer.yaml - Pod template with init container
  • Add helper functions to test/extended/node/node_utils.go:
    • PodInitConDescription struct with methods: Create(), Delete(), ContainerExit(), DeleteInitContainer(), InitContainerNotRestart()
    • PodStatus() function to check pod readiness
  • Add test in test/extended/node/node_e2e/node.go:
  • [OTP] Init containers should not restart when the exited init container is removed from node [OCP-38271]

Original author: minmli@redhat.com
Migrated by: bgudi@redhat.com

tested manually on 4.22.0-0.nightly-2026-04-06-051707

 Will run 1 of 1 specs
 ------------------------------
 [sig-node] [Jira:Node/Kubelet] NODE initContainer policy,volume,readines,quota [OTP] Init containers should not restart when the exited init container is removed from node [OCP-38271]
 github.com/openshift/origin/test/extended/node/node_e2e/node.go:127
   STEP: Creating a kubernetes client @ 04/07/26 12:32:54.16
 I0407 12:32:54.160919 2511173 discovery.go:214] Invalidating discovery information
 I0407 12:32:58.969829 2511173 client.go:293] configPath is now "/tmp/configfile160890699"
 I0407 12:32:58.969848 2511173 client.go:368] The user is now "e2e-test-node-initcontainer-kfs2p-user"
 I0407 12:32:58.969853 2511173 client.go:370] Creating project "e2e-test-node-initcontainer-kfs2p"
 I0407 12:32:59.280133 2511173 client.go:378] Waiting on permissions in project "e2e-test-node-initcontainer-kfs2p" ...
 I0407 12:33:00.502528 2511173 client.go:407] DeploymentConfig capability is enabled, adding 'deployer' SA to the list of default SAs
 I0407 12:33:01.227008 2511173 client.go:422] Waiting for ServiceAccount "default" to be provisioned...
 I0407 12:33:01.931634 2511173 client.go:422] Waiting for ServiceAccount "builder" to be provisioned...
 I0407 12:33:02.494910 2511173 client.go:422] Waiting for ServiceAccount "deployer" to be provisioned...
 I0407 12:33:03.078842 2511173 client.go:432] Waiting for RoleBinding "system:image-pullers" to be provisioned...
 I0407 12:33:03.341313 2511173 client.go:432] Waiting for RoleBinding "system:image-builders" to be provisioned...
 I0407 12:33:03.580906 2511173 client.go:432] Waiting for RoleBinding "system:deployers" to be provisioned...
 I0407 12:33:05.992878 2511173 client.go:469] Project "e2e-test-node-initcontainer-kfs2p" has been fully provisioned.
 I0407 12:33:05.994313 2511173 framework.go:2330] [precondition-check] checking if cluster is MicroShift
 I0407 12:33:06.265290 2511173 framework.go:2353] IsMicroShiftCluster: microshift-version configmap not found, not MicroShift
   STEP: Test for case OCP-38271 @ 04/07/26 12:33:06.266
 I0407 12:33:10.518624 2511173 client.go:293] configPath is now "/tmp/configfile3905948318"
 I0407 12:33:10.518653 2511173 client.go:368] The user is now "e2e-test-node-initcontainer-xm2hp-user"
 I0407 12:33:10.518661 2511173 client.go:370] Creating project "e2e-test-node-initcontainer-xm2hp"
 I0407 12:33:11.847825 2511173 client.go:378] Waiting on permissions in project "e2e-test-node-initcontainer-xm2hp" ...
 I0407 12:33:13.600189 2511173 client.go:407] DeploymentConfig capability is enabled, adding 'deployer' SA to the list of default SAs
 I0407 12:33:13.870908 2511173 client.go:422] Waiting for ServiceAccount "default" to be provisioned...
 I0407 12:33:14.532749 2511173 client.go:422] Waiting for ServiceAccount "builder" to be provisioned...
 I0407 12:33:15.123094 2511173 client.go:422] Waiting for ServiceAccount "deployer" to be provisioned...
 I0407 12:33:15.833134 2511173 client.go:432] Waiting for RoleBinding "system:image-pullers" to be provisioned...
 I0407 12:33:16.249662 2511173 client.go:432] Waiting for RoleBinding "system:image-builders" to be provisioned...
 I0407 12:33:16.520866 2511173 client.go:432] Waiting for RoleBinding "system:deployers" to be provisioned...
 I0407 12:33:18.639586 2511173 client.go:469] Project "e2e-test-node-initcontainer-xm2hp" has been fully provisioned.
   STEP: Create a pod with init container @ 04/07/26 12:33:18.639
 I0407 12:33:23.467454 2511173 template.go:146] the file of resource is /tmp/e2e-test-node-initcontainer-xm2hp-9kwvufepconfig.json
 pod/initcon-pod created
   STEP: Check pod status @ 04/07/26 12:33:25.029
 I0407 12:33:25.029336 2511173 node_utils.go:746] check if pod is available
 I0407 12:33:31.493902 2511173 node_utils.go:751] Pod is running and container is Ready!
   STEP: Check init container exit normally @ 04/07/26 12:33:31.493
 I0407 12:33:34.889806 2511173 node_utils.go:702] The initContainer status is Completed
 I0407 12:33:34.889857 2511173 node_utils.go:705] The initContainer exit normally
   STEP: Delete init container @ 04/07/26 12:33:34.889
 I0407 12:33:37.142822 2511173 node_utils.go:718] The containerID is cri-o://b78a52f615505afce8333f2628f8d9210de1587cb2d869d4a6ff628972d42c2c
 I0407 12:33:37.142862 2511173 node_utils.go:720] The initContainerID is b78a52f615505afce8333f2628f8d9210de1587cb2d869d4a6ff628972d42c2c
 namespace/e2e-test-node-initcontainer-xm2hp labeled
 namespace/e2e-test-node-initcontainer-xm2hp unlabeled
   STEP: Check init container not restart again @ 04/07/26 12:33:45.91
 I0407 12:36:49.266671 2511173 node_utils.go:730] The /mnt/data/test: Defaulted container "my-container" out of: my-container, inittest (init)
 running
 I0407 12:36:49.266761 2511173 node_utils.go:737] initContainer not restart
 pod "initcon-pod" deleted
 I0407 12:37:22.201454 2511173 client.go:689] Deleted {user.openshift.io/v1, Resource=users  e2e-test-node-initcontainer-kfs2p-user}, err: <nil>
 I0407 12:37:22.437605 2511173 client.go:689] Deleted {oauth.openshift.io/v1, Resource=oauthclients  e2e-client-e2e-test-node-initcontainer-kfs2p}, err: <nil>
 I0407 12:37:23.655331 2511173 client.go:689] Deleted {oauth.openshift.io/v1, Resource=oauthaccesstokens  sha256~BIJzrGxVFeRxkJBZo0IE-0WN3hCn9mpuXijr7YTBVAs}, err: <nil>
 I0407 12:37:23.897875 2511173 client.go:689] Deleted {user.openshift.io/v1, Resource=users  e2e-test-node-initcontainer-xm2hp-user}, err: <nil>
 I0407 12:37:24.149044 2511173 client.go:689] Deleted {oauth.openshift.io/v1, Resource=oauthclients  e2e-client-e2e-test-node-initcontainer-xm2hp}, err: <nil>
 I0407 12:37:24.400300 2511173 client.go:689] Deleted {oauth.openshift.io/v1, Resource=oauthaccesstokens  sha256~3drhEENVw6hKI7pXXs0vQA3QVhLJmElPteMRfC2L3v8}, err: <nil>
   STEP: Destroying namespace "e2e-test-node-initcontainer-kfs2p" for this suite. @ 04/07/26 12:37:24.4
   STEP: Destroying namespace "e2e-test-node-initcontainer-xm2hp" for this suite. @ 04/07/26 12:37:24.649
 • [270.749 seconds]
 ------------------------------

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

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.

@BhargaviGudi
Copy link
Copy Markdown
Contributor Author

/verified by @BhargaviGudi

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Apr 7, 2026
@openshift-ci-robot
Copy link
Copy Markdown

@BhargaviGudi: This PR has been marked as verified by @BhargaviGudi.

Details

In response to this:

/verified by @BhargaviGudi

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.

@BhargaviGudi BhargaviGudi changed the title WIP OCPNODE-4381: Migrate OCP-38271 from openshift-tests-private OCPNODE-4381: Migrate OCP-38271 from openshift-tests-private Apr 7, 2026
@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 Apr 7, 2026
@openshift-ci-robot
Copy link
Copy Markdown

openshift-ci-robot commented Apr 7, 2026

@BhargaviGudi: This pull request references OCPNODE-4381 which is a valid jira issue.

Details

In response to this:

Summary Adds test to verify init containers do not restart when the exited init container is removed from the node.

Changes

  • Add test/extended/testdata/node/node_e2e/pod-initContainer.yaml - Pod template with init container
  • Add helper functions to test/extended/node/node_utils.go:
    • PodInitConDescription struct with methods: Create(), Delete(), ContainerExit(), DeleteInitContainer(), InitContainerNotRestart()
    • PodStatus() function to check pod readiness
  • Add test in test/extended/node/node_e2e/node.go:
  • [OTP] Init containers should not restart when the exited init container is removed from node [OCP-38271]

Original author: minmli@redhat.com
Migrated by: bgudi@redhat.com

tested manually on 4.22.0-0.nightly-2026-04-06-051707

 [sig-node] [Jira:Node/Kubelet] NODE initContainer policy,volume,readines,quota [OTP] Init containers should not restart when the exited init container is removed from node [OCP-38271]
 github.com/openshift/origin/test/extended/node/node_e2e/node.go:132
   STEP: Creating a kubernetes client @ 04/07/26 15:42:34.99
 I0407 15:42:34.991250 2683548 discovery.go:214] Invalidating discovery information
 I0407 15:42:39.243543 2683548 client.go:293] configPath is now "/tmp/configfile3855134934"
 I0407 15:42:39.243585 2683548 client.go:368] The user is now "e2e-test-node-initcontainer-vkd4d-user"
 I0407 15:42:39.243594 2683548 client.go:370] Creating project "e2e-test-node-initcontainer-vkd4d"
 I0407 15:42:40.691446 2683548 client.go:378] Waiting on permissions in project "e2e-test-node-initcontainer-vkd4d" ...
 I0407 15:42:41.830235 2683548 client.go:407] DeploymentConfig capability is enabled, adding 'deployer' SA to the list of default SAs
 I0407 15:42:42.111126 2683548 client.go:422] Waiting for ServiceAccount "default" to be provisioned...
 I0407 15:42:44.974897 2683548 client.go:422] Waiting for ServiceAccount "builder" to be provisioned...
 I0407 15:42:46.205469 2683548 client.go:422] Waiting for ServiceAccount "deployer" to be provisioned...
 I0407 15:42:46.806100 2683548 client.go:432] Waiting for RoleBinding "system:image-pullers" to be provisioned...
 I0407 15:42:47.226829 2683548 client.go:432] Waiting for RoleBinding "system:image-builders" to be provisioned...
 I0407 15:42:47.639404 2683548 client.go:432] Waiting for RoleBinding "system:deployers" to be provisioned...
 I0407 15:42:49.632918 2683548 client.go:469] Project "e2e-test-node-initcontainer-vkd4d" has been fully provisioned.
 I0407 15:42:49.634001 2683548 framework.go:2330] [precondition-check] checking if cluster is MicroShift
 I0407 15:42:49.858322 2683548 framework.go:2353] IsMicroShiftCluster: microshift-version configmap not found, not MicroShift
   STEP: Test for case OCP-38271 @ 04/07/26 15:42:49.858
 I0407 15:42:53.986416 2683548 client.go:293] configPath is now "/tmp/configfile57604844"
 I0407 15:42:53.986465 2683548 client.go:368] The user is now "e2e-test-node-initcontainer-7cc7f-user"
 I0407 15:42:53.986474 2683548 client.go:370] Creating project "e2e-test-node-initcontainer-7cc7f"
 I0407 15:42:54.364671 2683548 client.go:378] Waiting on permissions in project "e2e-test-node-initcontainer-7cc7f" ...
 I0407 15:42:55.812977 2683548 client.go:407] DeploymentConfig capability is enabled, adding 'deployer' SA to the list of default SAs
 I0407 15:42:56.074192 2683548 client.go:422] Waiting for ServiceAccount "default" to be provisioned...
 I0407 15:42:56.641302 2683548 client.go:422] Waiting for ServiceAccount "builder" to be provisioned...
 I0407 15:42:57.246370 2683548 client.go:422] Waiting for ServiceAccount "deployer" to be provisioned...
 I0407 15:42:58.181456 2683548 client.go:432] Waiting for RoleBinding "system:image-pullers" to be provisioned...
 I0407 15:42:58.453551 2683548 client.go:432] Waiting for RoleBinding "system:image-builders" to be provisioned...
 I0407 15:42:58.691910 2683548 client.go:432] Waiting for RoleBinding "system:deployers" to be provisioned...
 I0407 15:43:01.974026 2683548 client.go:469] Project "e2e-test-node-initcontainer-7cc7f" has been fully provisioned.
   STEP: Create a pod with init container @ 04/07/26 15:43:01.974
   STEP: Check pod status @ 04/07/26 15:43:02.383
   STEP: Check init container exit normally @ 04/07/26 15:43:07.269
 I0407 15:43:13.034515 2683548 node.go:204] Init container exited with code 0
   STEP: Get node where pod is running @ 04/07/26 15:43:13.034
   STEP: Get init container ID from pod status @ 04/07/26 15:43:13.408
   STEP: Delete init container from node @ 04/07/26 15:43:13.408
 I0407 15:43:16.964246 2683548 node.go:239] Container deletion output: 1edf2cf9948c161d69b57e0c6cba2858f53af2483c00212be69baebc8f391ca9
   STEP: Check init container not restart again @ 04/07/26 15:43:16.964
 I0407 15:43:22.275493 2683548 node.go:255] Init container has not restarted
 I0407 15:43:22.783492 2683548 client.go:689] Deleted {user.openshift.io/v1, Resource=users  e2e-test-node-initcontainer-vkd4d-user}, err: <nil>
 I0407 15:43:23.059018 2683548 client.go:689] Deleted {oauth.openshift.io/v1, Resource=oauthclients  e2e-client-e2e-test-node-initcontainer-vkd4d}, err: <nil>
 I0407 15:43:23.291689 2683548 client.go:689] Deleted {oauth.openshift.io/v1, Resource=oauthaccesstokens  sha256~4zwghso_ATUPoCGL0QbFnEj1L3Sl7dTbulxaUP5ikIs}, err: <nil>
 I0407 15:43:23.532241 2683548 client.go:689] Deleted {user.openshift.io/v1, Resource=users  e2e-test-node-initcontainer-7cc7f-user}, err: <nil>
 I0407 15:43:23.813310 2683548 client.go:689] Deleted {oauth.openshift.io/v1, Resource=oauthclients  e2e-client-e2e-test-node-initcontainer-7cc7f}, err: <nil>
 I0407 15:43:24.049653 2683548 client.go:689] Deleted {oauth.openshift.io/v1, Resource=oauthaccesstokens  sha256~fKDLHmwN96xMJxbYazWMJ2J0BxIPZcvitRIFX78xaKE}, err: <nil>
   STEP: Destroying namespace "e2e-test-node-initcontainer-vkd4d" for this suite. @ 04/07/26 15:43:24.049
   STEP: Destroying namespace "e2e-test-node-initcontainer-7cc7f" for this suite. @ 04/07/26 15:43:24.315
 • [50.042 seconds]
 ------------------------------

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

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.

Add test to verify init containers do not restart when removed from node.

- Add pod-initContainer.yaml template

- Add helper functions in node_utils.go

- Add OCP-38271 test in node_e2e/node.go

Author: minmli@redhat.com (original)

Migrated-by: bgudi@redhat.com

Move OCP-38271 test to separate Describe block

Refactor OCP-38271 to use standard origin patterns instead of compat_otp
@openshift-ci-robot openshift-ci-robot removed the verified Signifies that the PR passed pre-merge verification criteria label Apr 7, 2026
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci bot commented Apr 7, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: BhargaviGudi
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

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 (2)
test/extended/node/node_e2e/node.go (2)

151-151: Use absolute path /bin/sh instead of relative bin/sh.

The command uses a relative path bin/sh which only works because the container's default working directory is /. Using the absolute path /bin/sh is the standard convention and avoids potential issues if WorkingDir is ever specified.

♻️ Suggested fix
-						Command: []string{"bin/sh", "-ec", "echo running >> /mnt/data/test"},
+						Command: []string{"/bin/sh", "-ec", "echo running >> /mnt/data/test"},
-						Command: []string{"bin/sh", "-c", "sleep 3600"},
+						Command: []string{"/bin/sh", "-c", "sleep 3600"},

Also applies to: 164-164

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/extended/node/node_e2e/node.go` at line 151, Replace the relative shell
path in the container Command arrays with the absolute path; specifically update
the Command entry in the container spec(s) in node.go (the Command:
[]string{"bin/sh", "-ec", ...} occurrences) to use "/bin/sh" instead of "bin/sh"
(apply the same change to the other occurrence mentioned).

116-116: Remove unnecessary defer g.GinkgoRecover().

GinkgoRecover() is designed for recovering panics in goroutines spawned within tests. At the Describe level, this defer executes when the Describe function returns (before any tests run), serving no purpose. Ginkgo already has built-in panic recovery for test blocks.

♻️ Suggested fix
 var _ = g.Describe("[sig-node] [Jira:Node/Kubelet] NODE initContainer policy,volume,readines,quota", func() {
-	defer g.GinkgoRecover()
-
 	var (
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/extended/node/node_e2e/node.go` at line 116, Remove the unnecessary
defer g.GinkgoRecover() call from the Describe-level scope: the defer is only
useful for recovering panics in goroutines spawned inside test blocks, and at
the Describe level it runs too early and is redundant since Ginkgo already
handles test panic recovery. Locate the defer g.GinkgoRecover() invocation
(inside the Describe/registration setup in node.go) and delete that single line
so no external panic recovery is deferred at describe initialization.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@test/extended/node/node_e2e/node.go`:
- Around line 241-258: The test currently returns success as soon as
RestartCount==0, which allows a race; change the wait.Poll predicate so it does
NOT return success when RestartCount==0 but instead keeps polling for the full
duration: inside the func passed to wait.Poll iterate
pod.Status.InitContainerStatuses for the "inittest" entry and if RestartCount>0
immediately return true, fmt.Errorf("init container restarted"); otherwise
return false, nil so polling continues; after wait.Poll, assert that the error
is a timeout (wait.ErrWaitTimeout) and fail if err is nil or a different error
(i.e. a restart was detected) — update the expectation that currently uses
o.Expect(err).NotTo(o.HaveOccurred()) accordingly.

---

Nitpick comments:
In `@test/extended/node/node_e2e/node.go`:
- Line 151: Replace the relative shell path in the container Command arrays with
the absolute path; specifically update the Command entry in the container
spec(s) in node.go (the Command: []string{"bin/sh", "-ec", ...} occurrences) to
use "/bin/sh" instead of "bin/sh" (apply the same change to the other occurrence
mentioned).
- Line 116: Remove the unnecessary defer g.GinkgoRecover() call from the
Describe-level scope: the defer is only useful for recovering panics in
goroutines spawned inside test blocks, and at the Describe level it runs too
early and is redundant since Ginkgo already handles test panic recovery. Locate
the defer g.GinkgoRecover() invocation (inside the Describe/registration setup
in node.go) and delete that single line so no external panic recovery is
deferred at describe initialization.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9d5d9835-9727-4042-b00a-649da2b71dd8

📥 Commits

Reviewing files that changed from the base of the PR and between c77ff4a and 3c8a2c2.

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

Comment on lines +241 to +258
g.By("Check init container not restart again")
err = wait.Poll(5*time.Second, 1*time.Minute, func() (bool, error) {
pod, err := oc.KubeClient().CoreV1().Pods(namespace).Get(ctx, podName, metav1.GetOptions{})
if err != nil {
return false, err
}
for _, status := range pod.Status.InitContainerStatuses {
if status.Name == "inittest" {
if status.RestartCount > 0 {
e2e.Logf("Init container restarted, restart count: %d", status.RestartCount)
return false, fmt.Errorf("init container restarted")
}
}
}
e2e.Logf("Init container has not restarted")
return true, nil
})
o.Expect(err).NotTo(o.HaveOccurred(), "init container restart")
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 | 🟠 Major

Test logic doesn't properly verify that the container does not restart.

The current polling logic returns success immediately on the first check where RestartCount == 0. Since this check runs right after the crictl rm, the kubelet may not have had time to detect the container removal. The test could pass even if the container would restart a moment later.

To properly verify the container does NOT restart, observe for a minimum duration while checking that RestartCount remains 0 throughout:

🐛 Suggested fix: observe for full duration
 		g.By("Check init container not restart again")
-		err = wait.Poll(5*time.Second, 1*time.Minute, func() (bool, error) {
+		// Observe for 30 seconds to ensure no restart occurs
+		observationDuration := 30 * time.Second
+		pollInterval := 5 * time.Second
+		startTime := time.Now()
+		err = wait.Poll(pollInterval, observationDuration+pollInterval, func() (bool, error) {
 			pod, err := oc.KubeClient().CoreV1().Pods(namespace).Get(ctx, podName, metav1.GetOptions{})
 			if err != nil {
 				return false, err
 			}
 			for _, status := range pod.Status.InitContainerStatuses {
 				if status.Name == "inittest" {
 					if status.RestartCount > 0 {
 						e2e.Logf("Init container restarted, restart count: %d", status.RestartCount)
 						return false, fmt.Errorf("init container restarted")
 					}
 				}
 			}
 			e2e.Logf("Init container has not restarted")
-			return true, nil
+			// Continue observing until the duration has elapsed
+			if time.Since(startTime) >= observationDuration {
+				return true, nil
+			}
+			return false, nil
 		})
 		o.Expect(err).NotTo(o.HaveOccurred(), "init container restart")
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
g.By("Check init container not restart again")
err = wait.Poll(5*time.Second, 1*time.Minute, func() (bool, error) {
pod, err := oc.KubeClient().CoreV1().Pods(namespace).Get(ctx, podName, metav1.GetOptions{})
if err != nil {
return false, err
}
for _, status := range pod.Status.InitContainerStatuses {
if status.Name == "inittest" {
if status.RestartCount > 0 {
e2e.Logf("Init container restarted, restart count: %d", status.RestartCount)
return false, fmt.Errorf("init container restarted")
}
}
}
e2e.Logf("Init container has not restarted")
return true, nil
})
o.Expect(err).NotTo(o.HaveOccurred(), "init container restart")
g.By("Check init container not restart again")
// Observe for 30 seconds to ensure no restart occurs
observationDuration := 30 * time.Second
pollInterval := 5 * time.Second
startTime := time.Now()
err = wait.Poll(pollInterval, observationDuration+pollInterval, func() (bool, error) {
pod, err := oc.KubeClient().CoreV1().Pods(namespace).Get(ctx, podName, metav1.GetOptions{})
if err != nil {
return false, err
}
for _, status := range pod.Status.InitContainerStatuses {
if status.Name == "inittest" {
if status.RestartCount > 0 {
e2e.Logf("Init container restarted, restart count: %d", status.RestartCount)
return false, fmt.Errorf("init container restarted")
}
}
}
e2e.Logf("Init container has not restarted")
// Continue observing until the duration has elapsed
if time.Since(startTime) >= observationDuration {
return true, nil
}
return false, nil
})
o.Expect(err).NotTo(o.HaveOccurred(), "init container restart")
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/extended/node/node_e2e/node.go` around lines 241 - 258, The test
currently returns success as soon as RestartCount==0, which allows a race;
change the wait.Poll predicate so it does NOT return success when
RestartCount==0 but instead keeps polling for the full duration: inside the func
passed to wait.Poll iterate pod.Status.InitContainerStatuses for the "inittest"
entry and if RestartCount>0 immediately return true, fmt.Errorf("init container
restarted"); otherwise return false, nil so polling continues; after wait.Poll,
assert that the error is a timeout (wait.ErrWaitTimeout) and fail if err is nil
or a different error (i.e. a restart was detected) — update the expectation that
currently uses o.Expect(err).NotTo(o.HaveOccurred()) accordingly.

@openshift-ci-robot
Copy link
Copy Markdown

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

// Skip all tests on MicroShift clusters as MachineConfig resources are not available
g.BeforeEach(func() {
isMicroShift, err := exutil.IsMicroShiftCluster(oc.AdminKubeClient())
o.Expect(err).NotTo(o.HaveOccurred())
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.

Can you change this expect() to just log err if it exists?

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 just realized that if the check does fail, ginkgo wont stop. Maybe it needs an explicit Fail(). The goal is to make setup failures clearly different from test failures.

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.

A loop around the check might make it more robust. Openshift should eventually respond.

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci bot commented Apr 7, 2026

@BhargaviGudi: 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-fips 3c8a2c2 link true /test e2e-aws-ovn-fips
ci/prow/e2e-aws-ovn-serial-1of2 3c8a2c2 link true /test e2e-aws-ovn-serial-1of2
ci/prow/e2e-metal-ipi-ovn-ipv6 3c8a2c2 link true /test e2e-metal-ipi-ovn-ipv6
ci/prow/e2e-vsphere-ovn-upi 3c8a2c2 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.

@openshift-trt
Copy link
Copy Markdown

openshift-trt bot commented Apr 7, 2026

Risk analysis has seen new tests most likely introduced by this PR.
Please ensure that new tests meet guidelines for naming and stability.

New Test Risks for sha: 3c8a2c2

Job Name New Test Risk
pull-ci-openshift-origin-main-e2e-metal-ipi-ovn-ipv6 High - "[sig-node] [Jira:Node/Kubelet] NODE initContainer policy,volume,readines,quota [OTP] Init containers should not restart when the exited init container is removed from node [OCP-38271] [Suite:openshift/conformance/parallel]" is a new test that failed 1 time(s) against the current commit

New tests seen in this PR at sha: 3c8a2c2

  • "[sig-node] [Jira:Node/Kubelet] NODE initContainer policy,volume,readines,quota [OTP] Init containers should not restart when the exited init container is removed from node [OCP-38271] [Suite:openshift/conformance/parallel]" [Total: 5, Pass: 4, Fail: 1, Flake: 0]

@cpmeadors
Copy link
Copy Markdown
Contributor

/jira refresh

@openshift-ci-robot
Copy link
Copy Markdown

openshift-ci-robot commented Apr 7, 2026

@cpmeadors: This pull request references OCPNODE-4381 which is a valid jira issue.

Details

In response to this:

/jira refresh

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.

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

Labels

e2e-images-update Related to images used by e2e tests 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