Skip to content

[release-4.21] Fix Pod.Create() to use --local flag for template proc…#31269

Open
LuboTerifaj wants to merge 1 commit into
openshift:release-4.21from
LuboTerifaj:local-template-processing-release-4.21
Open

[release-4.21] Fix Pod.Create() to use --local flag for template proc…#31269
LuboTerifaj wants to merge 1 commit into
openshift:release-4.21from
LuboTerifaj:local-template-processing-release-4.21

Conversation

@LuboTerifaj

@LuboTerifaj LuboTerifaj commented Jun 8, 2026

Copy link
Copy Markdown

…essing

Use --local flag when processing pod templates in compat_otp.Pod.Create() to avoid kubeconfig context namespace pollution from other tests.

Problem:
When multiple tests run in sequence (especially in Prow rehearsal jobs), a test may change the kubeconfig's current context to a different namespace. The 'oc process' command validates namespace existence using the kubeconfig context BEFORE processing template parameters, causing failures when:

  1. Previous test sets context to namespace N1
  2. Namespace N1 gets deleted after that test completes
  3. Current test calls Pod.Create() with namespace N2
  4. 'oc process' tries to validate N1 (from kubeconfig context)
  5. Validation fails because N1 no longer exists

Example error from OCP-10662 test:
Error running oc process ... -p NAMESPACE=e2e-test-default-bhtjm:
error: unable to process template
namespaces "e2e-test-olm-all-o9bvjlxg-7qwkb" not found

Solution:
The --local flag makes 'oc process' work client-side without contacting the API server, eliminating namespace validation and kubeconfig context dependency. This is safe for Pod.Create() since:

  • Only 5 tests use compat_otp.Pod (all simple pod templates)
  • Pod templates use basic parameter substitution (no server-side features)
  • Local processing produces identical output to server-side processing
  • Tested with the actual failing template - works correctly

Impact:

  • Fixes OCP-10662 test failure in rehearsal jobs
  • Prevents future kubeconfig pollution issues for pod creation
  • No functional changes to existing tests (output identical)
  • Low risk (only affects 5 tests using compat_otp.Pod)

(cherry picked from commit a309500)

--
https://redhat.atlassian.net/browse/OCPQE-32057 LEVEL0-High-10662 fails in CI: Missing --local flag causes template processing failure due to kubeconfig context pollution

…essing

Use --local flag when processing pod templates in compat_otp.Pod.Create()
to avoid kubeconfig context namespace pollution from other tests.

Problem:
When multiple tests run in sequence (especially in Prow rehearsal jobs),
a test may change the kubeconfig's current context to a different namespace.
The 'oc process' command validates namespace existence using the kubeconfig
context BEFORE processing template parameters, causing failures when:
1. Previous test sets context to namespace N1
2. Namespace N1 gets deleted after that test completes
3. Current test calls Pod.Create() with namespace N2
4. 'oc process' tries to validate N1 (from kubeconfig context)
5. Validation fails because N1 no longer exists

Example error from OCP-10662 test:
  Error running oc process ... -p NAMESPACE=e2e-test-default-bhtjm:
  error: unable to process template
    namespaces "e2e-test-olm-all-o9bvjlxg-7qwkb" not found

Solution:
The --local flag makes 'oc process' work client-side without contacting
the API server, eliminating namespace validation and kubeconfig context
dependency. This is safe for Pod.Create() since:
- Only 5 tests use compat_otp.Pod (all simple pod templates)
- Pod templates use basic parameter substitution (no server-side features)
- Local processing produces identical output to server-side processing
- Tested with the actual failing template - works correctly

Impact:
- Fixes OCP-10662 test failure in rehearsal jobs
- Prevents future kubeconfig pollution issues for pod creation
- No functional changes to existing tests (output identical)
- Low risk (only affects 5 tests using compat_otp.Pod)

(cherry picked from commit a309500)
@coderabbitai

coderabbitai Bot commented Jun 8, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

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: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: a75bb1c6-12f0-4088-aec5-1bd1873a43c6

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

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

@LuboTerifaj

Copy link
Copy Markdown
Author

/assign @jupierce

@openshift-ci

openshift-ci Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

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

@jhuttana

jhuttana commented Jun 9, 2026

Copy link
Copy Markdown

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Jun 9, 2026
@openshift-ci

openshift-ci Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

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

Labels

lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants