Skip to content

Commit

Permalink
Merge pull request #2180 from yanggangtony/clean-envtest-server
Browse files Browse the repository at this point in the history
🌱 code clean for pkg/envtest/server.go
  • Loading branch information
k8s-ci-robot committed Feb 8, 2023
2 parents f9d8abc + 65f861d commit 2271827
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions pkg/envtest/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,17 +230,19 @@ func (te *Environment) Start() (*rest.Config, error) {
if os.Getenv(envAttachOutput) == "true" {
te.AttachControlPlaneOutput = true
}
if apiServer.Out == nil && te.AttachControlPlaneOutput {
apiServer.Out = os.Stdout
}
if apiServer.Err == nil && te.AttachControlPlaneOutput {
apiServer.Err = os.Stderr
}
if te.ControlPlane.Etcd.Out == nil && te.AttachControlPlaneOutput {
te.ControlPlane.Etcd.Out = os.Stdout
}
if te.ControlPlane.Etcd.Err == nil && te.AttachControlPlaneOutput {
te.ControlPlane.Etcd.Err = os.Stderr
if te.AttachControlPlaneOutput {
if apiServer.Out == nil {
apiServer.Out = os.Stdout
}
if apiServer.Err == nil {
apiServer.Err = os.Stderr
}
if te.ControlPlane.Etcd.Out == nil {
te.ControlPlane.Etcd.Out = os.Stdout
}
if te.ControlPlane.Etcd.Err == nil {
te.ControlPlane.Etcd.Err = os.Stderr
}
}

apiServer.Path = process.BinPathFinder("kube-apiserver", te.BinaryAssetsDirectory)
Expand Down

0 comments on commit 2271827

Please sign in to comment.