Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch Windows default runtime endpoints to npipe #398

Merged
merged 2 commits into from
Nov 8, 2018
Merged
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
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
- stage: Test
os: windows
script:
- make
- make windows
- powershell -c "Set-ExecutionPolicy Bypass -Scope CURRENTUSER -Force"
- powershell hack/install-kubelet.ps1
# Skip hack/run-critest.sh temporarily.
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ clean:
find . -name \*~ -delete
find . -name \#\* -delete

cross: check-gopath
windows: check-gopath
GOOS=windows $(GO) test -c -o $(CURDIR)/_output/critest.exe \
-ldflags '$(GO_LDFLAGS)' \
$(PROJECT)/cmd/critest
Expand Down
5 changes: 3 additions & 2 deletions cmd/crictl/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
"google.golang.org/grpc"
"k8s.io/kubernetes/pkg/kubelet/apis/cri"
"k8s.io/kubernetes/pkg/kubelet/remote"
"k8s.io/kubernetes/pkg/kubelet/util"

"github.com/kubernetes-sigs/cri-tools/pkg/version"
)
Expand All @@ -52,7 +53,7 @@ func getRuntimeClientConnection(context *cli.Context) (*grpc.ClientConn, error)
return nil, fmt.Errorf("--runtime-endpoint is not set")
}

addr, dialer, err := GetAddressAndDialer(RuntimeEndpoint)
addr, dialer, err := util.GetAddressAndDialer(RuntimeEndpoint)
if err != nil {
return nil, err
}
Expand All @@ -72,7 +73,7 @@ func getImageClientConnection(context *cli.Context) (*grpc.ClientConn, error) {
ImageEndpoint = RuntimeEndpoint
}

addr, dialer, err := GetAddressAndDialer(ImageEndpoint)
addr, dialer, err := util.GetAddressAndDialer(ImageEndpoint)
if err != nil {
return nil, err
}
Expand Down
23 changes: 0 additions & 23 deletions cmd/crictl/main_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,30 +18,7 @@ limitations under the License.

package main

import (
"net"
"time"

"k8s.io/kubernetes/pkg/kubelet/util"
)

const (
defaultConfigPath = "/etc/crictl.yaml"
defaultRuntimeEndpoint = "unix:///var/run/dockershim.sock"
)

// GetAddressAndDialer returns the address and a dialer for the endpoint
// protocol.
//
// On Unix supported protocols are unix sockets.
//
// Examples:
//
// An endpoint of "unix:///var/run/dockershim.sock" returns address
// "/var/run/dockershim.sock" and a unix socket dialer for this address.
//
// An endpoint of "/var/run/dockershim.sock" returns address
// "/var/run/dockershim.sock" and a unix socket dialer for this address.
func GetAddressAndDialer(endpoint string) (string, func(addr string, timeout time.Duration) (net.Conn, error), error) {
return util.GetAddressAndDialer(endpoint)
}
31 changes: 1 addition & 30 deletions cmd/crictl/main_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,45 +19,16 @@ limitations under the License.
package main

import (
"net"
"os"
"path/filepath"
"strings"
"time"

"github.com/Microsoft/go-winio"
"k8s.io/kubernetes/pkg/kubelet/util"
)

const (
defaultRuntimeEndpoint = "tcp://localhost:3735"
defaultRuntimeEndpoint = "npipe:////./pipe/dockershim"
)

var defaultConfigPath string

func init() {
defaultConfigPath = filepath.Join(os.Getenv("USERPROFILE"), ".crictl", "crictl.yaml")
}

// GetAddressAndDialer returns the address and a dialer for the endpoint
// protocol.
//
// On Windows supported protocols are Windows named pipes and tcp.
//
// Examples:
//
// An endpoint of "tcp://localhost:3735" returns address "localhost:3735" and a
// tcp socket dialer for this address.
//
// An endpoint of "\\.\pipe\name" returns an address of "\\.\pipe\name" and a
// Windows named pipe dialer for this address.
func GetAddressAndDialer(endpoint string) (string, func(addr string, timeout time.Duration) (net.Conn, error), error) {
if strings.HasPrefix(endpoint, "\\\\.\\pipe") {
return endpoint, dial, nil
}
return util.GetAddressAndDialer(endpoint)
}

func dial(addr string, timeout time.Duration) (net.Conn, error) {
return winio.DialPipe(addr, &timeout)
}
3 changes: 2 additions & 1 deletion pkg/benchmark/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ var _ = framework.KubeDescribe("PodSandbox", func() {
Linux: &runtimeapi.LinuxPodSandboxConfig{},
}

// TODO: add support of runtime
operation := b.Time("create PodSandbox", func() {
podID, err = c.RunPodSandbox(config)
podID, err = c.RunPodSandbox(config, "")
})

framework.ExpectNoError(err, "failed to create PodSandbox: %v", err)
Expand Down
2 changes: 1 addition & 1 deletion pkg/framework/test_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func RegisterFlags() {

svcaddr := "unix:///var/run/dockershim.sock"
if runtime.GOOS == "windows" {
svcaddr = "tcp://localhost:3735"
svcaddr = "npipe:////./pipe/dockershim"
}
flag.StringVar(&TestContext.RuntimeServiceAddr, "runtime-endpoint", svcaddr, "Runtime service socket for client to connect..")
flag.DurationVar(&TestContext.RuntimeServiceTimeout, "runtime-service-timeout", 300*time.Second, "Timeout when trying to connect to a runtime service.")
Expand Down
3 changes: 2 additions & 1 deletion pkg/framework/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ func BuildPodSandboxMetadata(podSandboxName, uid, namespace string, attempt uint

// RunPodSandbox runs a PodSandbox.
func RunPodSandbox(c internalapi.RuntimeService, config *runtimeapi.PodSandboxConfig) string {
podID, err := c.RunPodSandbox(config)
// TODO: add support of runtime handler.
podID, err := c.RunPodSandbox(config, "")
ExpectNoError(err, "failed to create PodSandbox: %v", err)
return podID
}
Expand Down
12 changes: 6 additions & 6 deletions vendor.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ github.com/docker/go-units 9e638d38cf6977a37a8ea0078f3ee75a7cdb2dd1
github.com/docker/spdystream 449fdfce4d962303d702fec724ef0ad181c92528
github.com/fsnotify/fsnotify f12c6236fe7b5cf6bcf30e5935d08cb079d78334
github.com/ghodss/yaml 73d445a93680fa1a78ae23a5839bad48f32ba1ee
github.com/gogo/protobuf c0656edd0d9eab7c66d1eb0c568f9039345796f7
github.com/gogo/protobuf 342cbe0a04158f6dcb03ca0079991a51a4248c02
github.com/golang/glog 44145f04b68cf362d9c4df2182967c2275eaefed
github.com/golang/protobuf b4deda0973fb4c70b50d226b1af49f3da59f5265
github.com/google/gofuzz 44d81051d367757e1c7c6a5a86423ece9afcf63c
Expand All @@ -31,8 +31,8 @@ google.golang.org/genproto 09f6ed296fc66555a25fe4ce95173148778dfa85
google.golang.org/grpc v1.7.5
gopkg.in/inf.v0 v0.9.0
gopkg.in/yaml.v2 670d4cfef0544295bc27a114dbac37980d83185a
k8s.io/api 012f271b5d41baad56190c5f1ae19bff16df0fd8
k8s.io/apimachinery 6429050ef506887d121f3e7306e894f8900d8a63
k8s.io/client-go 37c3c02ec96533daec0dbda1f39a6b1d68505c79
k8s.io/kubernetes v1.12.0-beta.1
k8s.io/utils 982821ea41da7e7c15f3d3738921eb2e7e241ccd
k8s.io/api 9fcf73cc980bd64f38a4f721a7371b0ebb72e1ff
k8s.io/apimachinery 2e0dc82819fd32377f2ecdae51c98ef9b00378f2
k8s.io/client-go 585e98112a2f5f80d5b9d421f67028aa905b880e
k8s.io/kubernetes 5a8f831964e48b2c381b8a2ab61889085852b66c
k8s.io/utils 4c3feeb576b06ef8fea769809bd3db5e5e78dc23
3 changes: 1 addition & 2 deletions vendor/github.com/gogo/protobuf/README

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

17 changes: 11 additions & 6 deletions vendor/github.com/gogo/protobuf/Readme.md

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

3 changes: 1 addition & 2 deletions vendor/github.com/gogo/protobuf/gogoproto/gogo.pb.go

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

4 changes: 2 additions & 2 deletions vendor/github.com/gogo/protobuf/proto/encode.go

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

1 change: 0 additions & 1 deletion vendor/github.com/gogo/protobuf/proto/lib.go

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

3 changes: 3 additions & 0 deletions vendor/github.com/gogo/protobuf/proto/properties.go

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

23 changes: 17 additions & 6 deletions vendor/github.com/gogo/protobuf/proto/text.go

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

2 changes: 1 addition & 1 deletion vendor/github.com/gogo/protobuf/proto/text_parser.go

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