Skip to content
This repository was archived by the owner on Apr 17, 2025. It is now read-only.

Commit cd6811e

Browse files
committed
Work around kubectl bug in 1.22
By default, Kubectl does not exit properly after long-running commands like `kubectl run` starting in 1.22 (kubernetes/kubectl#1098). This change disables the new feature to work around the problem, as suggested in the issue itself. Tested: hierarchical network policy test hangs without this change, passes with it.
1 parent b9045e4 commit cd6811e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

pkg/testutils/testutils.go

+2
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,8 @@ func RunCommand(cmdln ...string) (string, error) {
235235
prefix := fmt.Sprintf("[%d] Running: ", time.Now().Unix())
236236
GinkgoT().Log(prefix, args)
237237
cmd := exec.Command(args[0], args[1:]...)
238+
// Work around https://github.com/kubernetes/kubectl/issues/1098#issuecomment-929743957:
239+
cmd.Env = append(os.Environ(), "KUBECTL_COMMAND_HEADERS=false")
238240
stdout, err := cmd.CombinedOutput()
239241
return string(stdout), err
240242
}

0 commit comments

Comments
 (0)