Skip to content

Commit

Permalink
Merge pull request #134 from Random-Liu/switch-to-vndr
Browse files Browse the repository at this point in the history
Switch to vndr
  • Loading branch information
feiskyer authored Sep 13, 2017
2 parents df88790 + 34dac30 commit 3028b83
Show file tree
Hide file tree
Showing 954 changed files with 118,560 additions and 240,804 deletions.
796 changes: 0 additions & 796 deletions Godeps/Godeps.json

This file was deleted.

5 changes: 0 additions & 5 deletions Godeps/Readme

This file was deleted.

10 changes: 4 additions & 6 deletions cmd/crictl/attach.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
"github.com/Sirupsen/logrus"
"github.com/urfave/cli"
"golang.org/x/net/context"
remotecommandconsts "k8s.io/apimachinery/pkg/util/remotecommand"
restclient "k8s.io/client-go/rest"
remoteclient "k8s.io/client-go/tools/remotecommand"
pb "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime"
Expand Down Expand Up @@ -98,16 +97,15 @@ func Attach(client pb.RuntimeServiceClient, opts attachOptions) error {
return err
}
logrus.Debugf("Attach URL: %v", URL)
attach, err := remoteclient.NewExecutor(&restclient.Config{}, "POST", URL)
attach, err := remoteclient.NewSPDYExecutor(&restclient.Config{}, "POST", URL)
if err != nil {
return err
}

streamOptions := remoteclient.StreamOptions{
SupportedProtocols: remotecommandconsts.SupportedStreamingProtocols,
Stdout: os.Stdout,
Stderr: os.Stderr,
Tty: opts.tty,
Stdout: os.Stdout,
Stderr: os.Stderr,
Tty: opts.tty,
}
if opts.stdin {
streamOptions.Stdin = os.Stdin
Expand Down
10 changes: 4 additions & 6 deletions cmd/crictl/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
"github.com/Sirupsen/logrus"
"github.com/urfave/cli"
"golang.org/x/net/context"
remotecommandconsts "k8s.io/apimachinery/pkg/util/remotecommand"
restclient "k8s.io/client-go/rest"
remoteclient "k8s.io/client-go/tools/remotecommand"
pb "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime"
Expand Down Expand Up @@ -140,16 +139,15 @@ func Exec(client pb.RuntimeServiceClient, opts execOptions) error {
}

logrus.Debugf("Exec URL: %v", URL)
exec, err := remoteclient.NewExecutor(&restclient.Config{}, "POST", URL)
exec, err := remoteclient.NewSPDYExecutor(&restclient.Config{}, "POST", URL)
if err != nil {
return err
}

streamOptions := remoteclient.StreamOptions{
SupportedProtocols: remotecommandconsts.SupportedStreamingProtocols,
Stdout: os.Stdout,
Stderr: os.Stderr,
Tty: opts.tty,
Stdout: os.Stdout,
Stderr: os.Stderr,
Tty: opts.tty,
}
if opts.stdin {
streamOptions.Stdin = os.Stdin
Expand Down
2 changes: 1 addition & 1 deletion cmd/crictl/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import (
"github.com/golang/glog"
"github.com/urfave/cli"
"golang.org/x/net/context"
"k8s.io/kubernetes/pkg/api/v1"
"k8s.io/api/core/v1"
pb "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime"
"k8s.io/kubernetes/pkg/util/tail"
)
Expand Down
8 changes: 5 additions & 3 deletions cmd/crictl/portforward.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package main

import (
"fmt"
"net/http"
"net/url"
"os"
"os/signal"
Expand All @@ -28,7 +29,7 @@ import (
"golang.org/x/net/context"
restclient "k8s.io/client-go/rest"
portforward "k8s.io/client-go/tools/portforward"
remoteclient "k8s.io/client-go/tools/remotecommand"
"k8s.io/client-go/transport/spdy"
pb "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime"
)

Expand Down Expand Up @@ -86,10 +87,11 @@ func PortForward(client pb.RuntimeServiceClient, opts portforwardOptions) error
return err
}
logrus.Debugf("PortForward URL: %v", URL)
exec, err := remoteclient.NewExecutor(&restclient.Config{}, "POST", URL)
transport, upgrader, err := spdy.RoundTripperFor(&restclient.Config{})
if err != nil {
return err
}
dialer := spdy.NewDialer(upgrader, &http.Client{Transport: transport}, "POST", URL)

stopChan := make(chan struct{}, 1)
readyChan := make(chan struct{})
Expand All @@ -105,7 +107,7 @@ func PortForward(client pb.RuntimeServiceClient, opts portforwardOptions) error
}
}()
logrus.Debugf("Ports to forword: %v", opts.ports)
pf, err := portforward.New(exec, opts.ports, stopChan, readyChan, os.Stdout, os.Stderr)
pf, err := portforward.New(dialer, opts.ports, stopChan, readyChan, os.Stdout, os.Stderr)
if err != nil {
return err
}
Expand Down
30 changes: 30 additions & 0 deletions hack/update-vendor.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

# Copyright 2017 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -o errexit
set -o nounset
set -o pipefail

ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"/..
cd ${ROOT}

echo "Run vndr to update vendor"
vndr -whitelist github.com/onsi/ginkgo/*

echo "Sort vendor.conf..."
sort vendor.conf -o vendor.conf

echo "Please commit the change made by this file..."
31 changes: 15 additions & 16 deletions pkg/validate/streaming.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,16 @@ package validate
import (
"bytes"
"io"
"net/http"
"net/url"
"os"
"time"

"github.com/kubernetes-incubator/cri-tools/pkg/framework"
remotecommandconsts "k8s.io/apimachinery/pkg/util/remotecommand"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/portforward"
remoteclient "k8s.io/client-go/tools/remotecommand"
"k8s.io/client-go/transport/spdy"
internalapi "k8s.io/kubernetes/pkg/kubelet/apis/cri"
runtimeapi "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime"

Expand Down Expand Up @@ -136,14 +137,13 @@ func checkExec(c internalapi.RuntimeService, execServerURL string) {
// Only http is supported now.
// TODO: support streaming APIs via tls.
url := parseURL(c, execServerURL)
e, err := remoteclient.NewExecutor(&rest.Config{}, "POST", url)
e, err := remoteclient.NewSPDYExecutor(&rest.Config{}, "POST", url)
framework.ExpectNoError(err, "failed to create executor for %q", execServerURL)

err = e.Stream(remoteclient.StreamOptions{
SupportedProtocols: remotecommandconsts.SupportedStreamingProtocols,
Stdout: localOut,
Stderr: localErr,
Tty: false,
Stdout: localOut,
Stderr: localErr,
Tty: false,
})
framework.ExpectNoError(err, "failed to open streamer for %q", execServerURL)

Expand Down Expand Up @@ -204,15 +204,14 @@ func checkAttach(c internalapi.RuntimeService, attachServerURL string) {
// Only http is supported now.
// TODO: support streaming APIs via tls.
url := parseURL(c, attachServerURL)
e, err := remoteclient.NewExecutor(&rest.Config{}, "POST", url)
e, err := remoteclient.NewSPDYExecutor(&rest.Config{}, "POST", url)
framework.ExpectNoError(err, "failed to create executor for %q", attachServerURL)

err = e.Stream(remoteclient.StreamOptions{
SupportedProtocols: remotecommandconsts.SupportedStreamingProtocols,
Stdin: reader,
Stdout: localOut,
Stderr: localErr,
Tty: false,
Stdin: reader,
Stdout: localOut,
Stderr: localErr,
Tty: false,
})
framework.ExpectNoError(err, "failed to open streamer for %q", attachServerURL)

Expand All @@ -238,11 +237,11 @@ func checkPortForward(c internalapi.RuntimeService, portForwardSeverURL string)
readyChan := make(chan struct{})
defer close(stopChan)

transport, upgrader, err := spdy.RoundTripperFor(&rest.Config{})
framework.ExpectNoError(err, "failed to create spdy round tripper")
url := parseURL(c, portForwardSeverURL)
e, err := remoteclient.NewExecutor(&rest.Config{}, "POST", url)
framework.ExpectNoError(err, "failed to create executor for %q", portForwardSeverURL)

pf, err := portforward.New(e, []string{"8000:80"}, stopChan, readyChan, os.Stdout, os.Stderr)
dialer := spdy.NewDialer(upgrader, &http.Client{Transport: transport}, "POST", url)
pf, err := portforward.New(dialer, []string{"8000:80"}, stopChan, readyChan, os.Stdout, os.Stderr)
framework.ExpectNoError(err, "failed to create port forward for %q", portForwardSeverURL)

go func() {
Expand Down
39 changes: 39 additions & 0 deletions vendor.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
github.com/docker/distribution edc3ab29cdff8694dd6feb85cfeb4b5f1b38ed9c
github.com/docker/docker 4f3616fb1c112e206b88cb7a9922bf49067a7756
github.com/docker/go-units 9e638d38cf6977a37a8ea0078f3ee75a7cdb2dd1
github.com/docker/spdystream 449fdfce4d962303d702fec724ef0ad181c92528
github.com/emicklei/go-restful ff4f55a206334ef123e4f79bbf348980da81ca46
github.com/fsnotify/fsnotify f12c6236fe7b5cf6bcf30e5935d08cb079d78334
github.com/ghodss/yaml 73d445a93680fa1a78ae23a5839bad48f32ba1ee
github.com/gogo/protobuf c0656edd0d9eab7c66d1eb0c568f9039345796f7
github.com/golang/glog 44145f04b68cf362d9c4df2182967c2275eaefed
github.com/golang/protobuf 4bd1920723d7b7c925de087aa32e2187708897f7
github.com/google/gofuzz 44d81051d367757e1c7c6a5a86423ece9afcf63c
github.com/go-openapi/jsonpointer 46af16f9f7b149af66e5d1bd010e3574dc06de98
github.com/go-openapi/jsonreference 13c6e3589ad90f49bd3e3bbe2c2cb3d7a4142272
github.com/go-openapi/spec 6aced65f8501fe1217321abf0749d354824ba2ff
github.com/go-openapi/swag 1d0bd113de87027671077d3c71eb3ac5d7dbba72
github.com/juju/ratelimit 5b9ff866471762aa2ab2dced63c9fb6f53921342
github.com/mailru/easyjson d5b7844b561a7bc640052f1b935f7b800330d7e0
github.com/onsi/ginkgo 67b9df7f55fe1165fd9ad49aca7754cce01a42b8
github.com/onsi/gomega d59fa0ac68bb5dd932ee8d24eed631cdd519efc3
github.com/pborman/uuid ca53cad383cad2479bbba7f7a1a05797ec1386e4
github.com/PuerkitoBio/purell v1.0.0
github.com/PuerkitoBio/urlesc 5bd2802263f21d8788851d5305584c82a5c75d7e
github.com/spf13/pflag 9ff6c6923cfffbcd502984b8e0c80539a94968b7
github.com/ugorji/go ded73eae5db7e7a0ef6f55aace87a2873c5d2b74
github.com/urfave/cli 7fb9c86b14e6a702a4157ccb5a863f07d844a207
golang.org/x/crypto 81e90905daefcd6fd217b62423c0908922eadb30
golang.org/x/net 1c05540f6879653db88113bc4a2b70aec4bd491f
golang.org/x/sys 7ddbeae9ae08c6a06a59597f0c9edbc5ff2444ce
golang.org/x/text b19bf474d317b857955b12035d2c5acb57ce8b01
google.golang.org/genproto 09f6ed296fc66555a25fe4ce95173148778dfa85
google.golang.org/grpc v1.3.0
gopkg.in/inf.v0 v0.9.0
gopkg.in/yaml.v2 53feefa2559fb8dfa8d81baad31be332c97d6c77
k8s.io/api f30e293246921de7f4ee46bb65b8762b2f890fc4
k8s.io/apimachinery b166f81f5c4c88402ae23a0d0944c6ad08bffd3b
k8s.io/client-go db8228460e2de17f5d3a9a453f61dde0ba86545a
k8s.io/kube-openapi abfc5fbe1cf87ee697db107fdfd24c32fe4397a8
k8s.io/kubernetes 5030391c0750eaa3fa7ccdef609ae7b22f29e477
k8s.io/utils 4fe312863be2155a7b68acd2aff1c9221b24e68c
5 changes: 0 additions & 5 deletions vendor/github.com/PuerkitoBio/purell/.gitignore

This file was deleted.

7 changes: 0 additions & 7 deletions vendor/github.com/PuerkitoBio/purell/.travis.yml

This file was deleted.

11 changes: 0 additions & 11 deletions vendor/github.com/PuerkitoBio/urlesc/.travis.yml

This file was deleted.

1 change: 0 additions & 1 deletion vendor/github.com/Sirupsen/logrus/.gitignore

This file was deleted.

10 changes: 0 additions & 10 deletions vendor/github.com/Sirupsen/logrus/.travis.yml

This file was deleted.

Loading

0 comments on commit 3028b83

Please sign in to comment.