[release-4.22] OCPBUGS-92656: fix-forward dualstack backport with klog stderr redirect for 4.22 OTE#482
Conversation
…direct for 4.22 OTE The original dualstack backport (PR openshift#480) broke metal platform nightlies because Ginkgo's GinkgoWriter (and klog via the ginkgo text-logger) writes INFO lines to fd 1 (stdout), corrupting the JSON output that openshift-tests-extension expects during the "list" subcommand. Fix by redirecting file descriptor 1 to stderr at the start of main(), before any framework/klog/ginkgo initialization runs. Because Ginkgo's init() captures os.Stdout (which wraps fd 1) before main() executes, simply reassigning os.Stdout is not enough — we must redirect at the fd level using syscall.Dup/Dup2. The real stdout is preserved via Dup and assigned back to os.Stdout so that OTE's explicit os.Stdout writes (JSON list/info output) still reach the original stdout. Additionally: - klog.SetOutput(os.Stderr) as belt-and-suspenders - Updated openshift-tests-extension dependency to latest Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@redhat-chai-bot: This pull request references Jira Issue OCPBUGS-92656, which is invalid:
Comment The bug has been updated to refer to the pull request using the external bug tracker. DetailsIn response to this:
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. |
|
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)
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. Comment |
|
/payload-job periodic-ci-openshift-release-main-nightly-4.22-e2e-aws-ovn-installer-dualstack-ipv4-primary-techpreview |
|
/payload-job periodic-ci-openshift-release-main-nightly-4.22-e2e-aws-ovn-installer-dualstack-ipv6-primary-techpreview |
|
/payload-job periodic-ci-openshift-release-main-nightly-4.22-e2e-metal-ipi-ovn-ipv4 |
|
/payload-job periodic-ci-openshift-release-main-nightly-4.22-e2e-metal-ipi-ovn-ipv6 |
|
@redhat-chai-bot: trigger 1 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command
See details on https://pr-payload-tests.ci.openshift.org/runs/ci/ebbe8f60-73c2-11f1-9127-c81654de85d8-0 |
|
@redhat-chai-bot: trigger 1 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command
See details on https://pr-payload-tests.ci.openshift.org/runs/ci/ebed1970-73c2-11f1-9e48-d9c91d27c68c-0 |
|
@redhat-chai-bot: trigger 1 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command
See details on https://pr-payload-tests.ci.openshift.org/runs/ci/eb6a7bf0-73c2-11f1-802a-47efe717d618-0 |
|
@redhat-chai-bot: trigger 1 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command
See details on https://pr-payload-tests.ci.openshift.org/runs/ci/eb8508d0-73c2-11f1-8e71-39332e354215-0 |
|
/retitle [release-4.22] OCPBUGS-92656: fix-forward dualstack backport with klog stderr redirect for 4.22 OTE |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 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 |
|
Looks like the problem is in openshift-tests. Trying it in openshift/origin#31349 . |
|
@mtulio: This PR was included in a payload test run from openshift/origin#31349
See details on https://pr-payload-tests.ci.openshift.org/runs/ci/e18cf420-73fc-11f1-9177-1dfff53c3a1a-0 |
|
@redhat-chai-bot: This pull request references Jira Issue OCPBUGS-92656. The bug has been updated to no longer refer to the pull request using the external bug tracker. DetailsIn response to this:
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. |
Re-lands the dualstack test support from PR #480 (reverted by PR #481) with fixes for the klog stdout contamination that broke metal platform nightlies.
What changed
1. Dualstack changes (from PR #480)
e2e/helper.go—GetCloudConfig(),isConfigPresentCloudConfig(),IsDualStack()helpers for dualstack detection via cloud-config ConfigMape2e/loadbalancer.go—IPFamilyPolicy: RequireDualStackincreateServiceNLB()for dualstack clustersmain.go— dualstack IPv6-primary detection and conditional upstream test skip logic2. Klog stderr redirect fix (NEW)
redirectStdoutToStderr()inmain.gothat usessyscall.Dup/Dup2to redirect file descriptor 1 (stdout) to stderr at the OS levelGinkgoWriter(which capturesos.Stdoutin itsinit()beforemain()runs) and klogDupand assigned toos.Stdoutso OTE's explicitfmt.Fprintf(os.Stdout, ...)JSON output still reaches the actual stdoutklog.SetOutput(os.Stderr)as belt-and-suspenders3. Updated openshift-tests-extension dependency
v0.0.0-20250916161632-d81c09058835tov0.0.0-20260626105913-1f81f3df939a(latest, includes OTE PR Use upstream openshift images from quay.io #74 JSON scanning fix)Why PR #480 broke nightlies
The
GetCloudConfig()call invokesframework.LoadConfig()which initializes klog. On 4.22, klog writes INFO-level lines to stdout. Whenopenshift-testsruns the OTE binary'slistsubcommand on metal platforms, it expects pure JSON on stdout but gets klog noise, causinginvalid character 'I' looking for beginning of valueerrors.This worked on 5.0 because OTE PR #74 makes
openshift-tests-extensionscan for the first{or[line before unmarshalling. The 4.22 branch used an older version without this fix.Testing
Payload jobs to validate:
periodic-ci-...-dualstack-ipv6-primary-techpreview)periodic-ci-...-dualstack-ipv4-primary-techpreview)periodic-ci-...-metal-ipi-ovn-ipv4) — previously failingperiodic-ci-...-metal-ipi-ovn-ipv6) — previously failing/cc @mtulio