Merge pull request #131642 from pohly/e2e-pod-exec-logging

client-go remotecommand: avoid "unexpected error" log when there is no error

Kubernetes-commit: 460a84a5daef3a8c0f67797aa475c9adfaf0722a
This commit is contained in:
Kubernetes Publisher
2025-05-26 03:24:15 -07:00

View File

@@ -52,7 +52,7 @@ func (f *FallbackExecutor) Stream(options StreamOptions) error {
// initial primary call to upgrade to a websocket connection fails.
func (f *FallbackExecutor) StreamWithContext(ctx context.Context, options StreamOptions) error {
err := f.primary.StreamWithContext(ctx, options)
if f.shouldFallback(err) {
if err != nil && f.shouldFallback(err) {
klog.V(4).Infof("RemoteCommand fallback: %v", err)
return f.secondary.StreamWithContext(ctx, options)
}