Skip to content

Commit

Permalink
Test
Browse files Browse the repository at this point in the history
  • Loading branch information
wzshiming committed Aug 27, 2024
1 parent c5285d9 commit a878d0a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
3 changes: 3 additions & 0 deletions pkg/kwokctl/runtime/binary/cluster_expose_port.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ func (c *Cluster) ExposePort(ctx context.Context, name string, portName string,
if err != nil {
return err
}
defer func() {
_ = listener.Close()
}()

logger := log.FromContext(ctx)
for {
Expand Down
12 changes: 11 additions & 1 deletion pkg/kwokctl/runtime/compose/cluster_expose_port.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"fmt"
"net"
"strings"
"os"

"sigs.k8s.io/kwok/pkg/apis/internalversion"
"sigs.k8s.io/kwok/pkg/consts"
Expand Down Expand Up @@ -50,6 +51,9 @@ func (c *Cluster) ExposePort(ctx context.Context, name string, portName string,
if err != nil {
return err
}
defer func() {
_ = listener.Close()
}()

logger := log.FromContext(ctx)
for {
Expand All @@ -59,7 +63,13 @@ func (c *Cluster) ExposePort(ctx context.Context, name string, portName string,
}

go func() {
err = c.Exec(exec.WithReadWriter(ctx, conn),
ctx0 := exec.WithIOStreams(ctx,
exec.IOStreams{
In: conn,
Out: conn,
ErrOut: os.Stderr,
})
err := c.Exec(ctx0,
c.runtime, "exec", "-i", c.Name()+"-"+consts.ComponentKwokController,
"nc", c.Name()+"-"+name, format.String(port.Port))
if err != nil {
Expand Down

0 comments on commit a878d0a

Please sign in to comment.