Skip to content

Commit a871738

Browse files
committed
Revert "stop defaulting kubeconfig to http://localhost:8080"
This reverts commit b19ad9e.
1 parent d24b928 commit a871738

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,23 @@ 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: os.Getenv("KUBERNETES_MASTER")}
38+
ClusterDefaults = clientcmdapi.Cluster{Server: getDefaultServer()}
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+
4655
// ClientConfig is used to make it easy to get an api server client
4756
type ClientConfig interface {
4857
// RawConfig returns the merged result of all overrides

test/cmd/legacy-script.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,6 @@ runTests() {
324324
exit 1
325325
fi
326326
kube::log::status "Checking kubectl version"
327-
export KUBERNETES_MASTER=http://127.0.0.1:${API_PORT}
328327
kubectl version
329328

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

0 commit comments

Comments
 (0)