[release-4.21] Fix Pod.Create() to use --local flag for template proc…#31269
[release-4.21] Fix Pod.Create() to use --local flag for template proc…#31269LuboTerifaj wants to merge 1 commit into
Conversation
…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)
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository: openshift/coderabbit/.coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
/assign @jupierce |
|
@LuboTerifaj: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions 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. |
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: jhuttana, LuboTerifaj The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
…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:
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:
Impact:
(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