From 792d1f3dc0bd45ab63c59cfee298bfc4b898a914 Mon Sep 17 00:00:00 2001 From: "Dr. Stefan Schimanski" Date: Fri, 3 Mar 2017 08:52:44 +0100 Subject: [PATCH] hack/verify-staging-imports.sh: check that plugins are not imported by default --- hack/verify-staging-imports.sh | 8 ++++++++ .../src/k8s.io/client-go/examples/out-of-cluster/main.go | 2 ++ .../client-go/examples/third-party-resources/main.go | 5 ++--- vendor/BUILD | 1 - 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/hack/verify-staging-imports.sh b/hack/verify-staging-imports.sh index 8a4671e307bf..036ba821f0ab 100755 --- a/hack/verify-staging-imports.sh +++ b/hack/verify-staging-imports.sh @@ -77,4 +77,12 @@ if grep -rq '// import "k8s.io/kubernetes/' 'staging/'; then exit 1 fi +for EXAMPLE in vendor/k8s.io/client-go/examples/{in-cluster,out-of-cluster,third-party-resources}; do + test -d "${EXAMPLE}" # make sure example is still there + if go list -f '{{ join .Deps "\n" }}' "./${EXAMPLE}/..." | sort | uniq | grep -q k8s.io/client-go/plugin; then + echo "${EXAMPLE} imports client-go plugins by default, but shouldn't." + exit 1 + fi +done + exit 0 \ No newline at end of file diff --git a/staging/src/k8s.io/client-go/examples/out-of-cluster/main.go b/staging/src/k8s.io/client-go/examples/out-of-cluster/main.go index 07d0d2855c4f..a76fd2cb64a6 100644 --- a/staging/src/k8s.io/client-go/examples/out-of-cluster/main.go +++ b/staging/src/k8s.io/client-go/examples/out-of-cluster/main.go @@ -25,6 +25,8 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes" "k8s.io/client-go/tools/clientcmd" + // Uncomment the following line to load the gcp plugin (only required to authenticate against GKE clusters). + // _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" ) func main() { diff --git a/staging/src/k8s.io/client-go/examples/third-party-resources/main.go b/staging/src/k8s.io/client-go/examples/third-party-resources/main.go index f7bbb270fa4b..d720a4aab847 100644 --- a/staging/src/k8s.io/client-go/examples/third-party-resources/main.go +++ b/staging/src/k8s.io/client-go/examples/third-party-resources/main.go @@ -31,9 +31,8 @@ import ( "k8s.io/client-go/pkg/apis/extensions/v1beta1" "k8s.io/client-go/rest" "k8s.io/client-go/tools/clientcmd" - - // Only required to authenticate against GKE clusters - _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" + // Uncomment the following line to load the gcp plugin (only required to authenticate against GKE clusters). + // _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" ) func main() { diff --git a/vendor/BUILD b/vendor/BUILD index 4490f77b7b9a..352847dc09fc 100644 --- a/vendor/BUILD +++ b/vendor/BUILD @@ -11766,7 +11766,6 @@ go_library( "//vendor:k8s.io/client-go/kubernetes", "//vendor:k8s.io/client-go/pkg/api", "//vendor:k8s.io/client-go/pkg/apis/extensions/v1beta1", - "//vendor:k8s.io/client-go/plugin/pkg/client/auth/gcp", "//vendor:k8s.io/client-go/rest", "//vendor:k8s.io/client-go/tools/clientcmd", ],