Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions cmd/cloud-controller-manager-aws-tests-ext/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ require (
github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2 v1.45.2
github.com/onsi/ginkgo/v2 v2.27.2
github.com/onsi/gomega v1.38.2
github.com/openshift-eng/openshift-tests-extension v0.0.0-20250916161632-d81c09058835
github.com/openshift-eng/openshift-tests-extension v0.0.0-20260626105913-1f81f3df939a
github.com/openshift/client-go v0.0.0-20260108185524-48f4ccfc4e13
github.com/sirupsen/logrus v1.9.3
github.com/spf13/cobra v1.10.1
k8s.io/api v0.35.0
k8s.io/apimachinery v0.35.0
k8s.io/client-go v0.35.0
k8s.io/cloud-provider-aws/tests/e2e v0.0.0-20260227223131-ea961d6fafc4
k8s.io/klog/v2 v2.130.1
k8s.io/kubernetes v1.35.0
k8s.io/pod-security-admission v0.35.0
)
Expand Down Expand Up @@ -88,7 +89,6 @@ require (
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/openshift/api v0.0.0-20260209232644-126cbbe24427 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/client_golang v1.23.2 // indirect
github.com/prometheus/client_model v0.6.2 // indirect
Expand Down Expand Up @@ -133,7 +133,6 @@ require (
k8s.io/component-base v0.35.0 // indirect
k8s.io/component-helpers v0.35.0 // indirect
k8s.io/controller-manager v0.35.0 // indirect
k8s.io/klog/v2 v2.130.1 // indirect
k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912 // indirect
k8s.io/kubectl v0.33.0 // indirect
k8s.io/kubelet v0.35.0 // indirect
Expand Down
6 changes: 2 additions & 4 deletions cmd/cloud-controller-manager-aws-tests-ext/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -141,16 +141,14 @@ github.com/onsi/gomega v1.38.2 h1:eZCjf2xjZAqe+LeWvKb5weQ+NcPwX84kqJ0cZNxok2A=
github.com/onsi/gomega v1.38.2/go.mod h1:W2MJcYxRGV63b418Ai34Ud0hEdTVXq9NW9+Sx6uXf3k=
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
github.com/openshift-eng/openshift-tests-extension v0.0.0-20250916161632-d81c09058835 h1:rkqIIfdYYkasXbF2XKVgh/3f1mhjSQK9By8WtVMgYo8=
github.com/openshift-eng/openshift-tests-extension v0.0.0-20250916161632-d81c09058835/go.mod h1:6gkP5f2HL0meusT0Aim8icAspcD1cG055xxBZ9yC68M=
github.com/openshift-eng/openshift-tests-extension v0.0.0-20260626105913-1f81f3df939a h1:9kpy75Nbn/TZV8N7mLh1euQNrX5DFASwjTWzKzIPUnI=
github.com/openshift-eng/openshift-tests-extension v0.0.0-20260626105913-1f81f3df939a/go.mod h1:pHOS9c6BjZv91OkkHyIHAOWnYhxwcxWQkyYGEvPyUCE=
github.com/openshift/api v0.0.0-20260209232644-126cbbe24427 h1:MExw+yvWGmbwlTpsO8sk16n3YQeeE2QxLmLpQouIGeE=
github.com/openshift/api v0.0.0-20260209232644-126cbbe24427/go.mod h1:d5uzF0YN2nQQFA0jIEWzzOZ+edmo6wzlGLvx5Fhz4uY=
github.com/openshift/client-go v0.0.0-20260108185524-48f4ccfc4e13 h1:6rd4zSo2UaWQcAPZfHK9yzKVqH0BnMv1hqMzqXZyTds=
github.com/openshift/client-go v0.0.0-20260108185524-48f4ccfc4e13/go.mod h1:YvOmPmV7wcJxpfhTDuFqqs2Xpb3M3ovsM6Qs/i2ptq4=
github.com/openshift/onsi-ginkgo/v2 v2.6.1-0.20260303184444-1cc650aa0565 h1:3/q8qM4HbFa+Een8wgzpwO8W6mO7Po+MwY6uxiXi/ac=
github.com/openshift/onsi-ginkgo/v2 v2.6.1-0.20260303184444-1cc650aa0565/go.mod h1:ArE1D/XhNXBXCBkKOLkbsb2c81dQHCRcF5zwn/ykDRo=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
Expand Down
44 changes: 44 additions & 0 deletions cmd/cloud-controller-manager-aws-tests-ext/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"os"
"path/filepath"
"strings"
"syscall"

"github.com/openshift-eng/openshift-tests-extension/pkg/cmd"
e "github.com/openshift-eng/openshift-tests-extension/pkg/extension"
Expand All @@ -15,6 +16,7 @@ import (
corev1 "k8s.io/api/core/v1"
kclientset "k8s.io/client-go/kubernetes"
"k8s.io/client-go/tools/clientcmd"
klog "k8s.io/klog/v2"
"k8s.io/kubernetes/test/e2e/framework"

log "github.com/sirupsen/logrus"
Expand All @@ -32,7 +34,49 @@ var (
isDualStackPrimaryIpv6 bool
)

// redirectStdoutToStderr moves file descriptor 1 (stdout) so that it
// points to stderr, keeping stdout clean for JSON output expected by
// openshift-tests-extension during "list".
//
// The Ginkgo init() (core_dsl.go) captures os.Stdout and wires it into
// GinkgoWriter *before* main() runs. Any code that writes through
// GinkgoWriter (framework.Logf, klog via the ginkgo text-logger, etc.)
// therefore writes to fd 1. Simply reassigning os.Stdout does not help
// because GinkgoWriter already holds the original *os.File.
//
// To solve this we:
// 1. Dup fd 1 → savedFd (preserve the real stdout)
// 2. Dup2 fd 2 → fd 1 (fd 1 now points to stderr)
// 3. os.Stdout = NewFile(savedFd) (so OTE's explicit os.Stdout writes
// still reach the real stdout)
//
// After this, anything that writes to the *original* os.Stdout (fd 1)
// — including GinkgoWriter — actually goes to stderr, while code that
// references the os.Stdout variable (OTE list/info commands) goes to
// the real stdout via savedFd.
func redirectStdoutToStderr() {
savedFd, err := syscall.Dup(int(os.Stdout.Fd()))
if err != nil {
// If we can't dup, fall through — best-effort.
fmt.Fprintf(os.Stderr, "warning: failed to dup stdout: %v\n", err)
return
}
if err := syscall.Dup2(int(os.Stderr.Fd()), int(os.Stdout.Fd())); err != nil {
fmt.Fprintf(os.Stderr, "warning: failed to redirect stdout to stderr: %v\n", err)
syscall.Close(savedFd)
return
}
os.Stdout = os.NewFile(uintptr(savedFd), "/dev/stdout")
}

func main() {
// Redirect fd 1 to stderr so that framework/klog/ginkgo log output
// does not corrupt the JSON stream expected by OTE on stdout.
redirectStdoutToStderr()

// Belt-and-suspenders: explicitly send klog output to stderr.
klog.SetOutput(os.Stderr)

registry := e.NewRegistry()
ext := e.NewExtension("openshift", "payload", "aws-cloud-controller-manager")

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading