Skip to content

Commit b19ad9e

Browse files
deads2ksoltysh
authored andcommitted
stop defaulting kubeconfig to http://localhost:8080
1 parent 39ed64e commit b19ad9e

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
lines changed

staging/src/k8s.io/client-go/tools/clientcmd/client_config.go

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,23 +35,14 @@ import (
3535
var (
3636
// ClusterDefaults has the same behavior as the old EnvVar and DefaultCluster fields
3737
// DEPRECATED will be replaced
38-
ClusterDefaults = clientcmdapi.Cluster{Server: getDefaultServer()}
38+
ClusterDefaults = clientcmdapi.Cluster{Server: os.Getenv("KUBERNETES_MASTER")}
3939
// DefaultClientConfig represents the legacy behavior of this package for defaulting
4040
// DEPRECATED will be replace
4141
DefaultClientConfig = DirectClientConfig{*clientcmdapi.NewConfig(), "", &ConfigOverrides{
4242
ClusterDefaults: ClusterDefaults,
4343
}, nil, NewDefaultClientConfigLoadingRules(), promptedCredentials{}}
4444
)
4545

46-
// getDefaultServer returns a default setting for DefaultClientConfig
47-
// DEPRECATED
48-
func getDefaultServer() string {
49-
if server := os.Getenv("KUBERNETES_MASTER"); len(server) > 0 {
50-
return server
51-
}
52-
return "http://localhost:8080"
53-
}
54-
5546
// ClientConfig is used to make it easy to get an api server client
5647
type ClientConfig interface {
5748
// RawConfig returns the merged result of all overrides

test/cmd/legacy-script.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,7 @@ runTests() {
325325
exit 1
326326
fi
327327
kube::log::status "Checking kubectl version"
328+
export KUBERNETES_MASTER=http://127.0.0.1:${API_PORT}
328329
kubectl version
329330

330331
# Generate a random namespace name, based on the current time (to make

0 commit comments

Comments
 (0)