Revert "stop defaulting kubeconfig to http://localhost:8080"

This reverts commit b19ad9e7a7.
This commit is contained in:
Maciej Szulik
2020-04-17 16:37:15 +02:00
parent d24b928629
commit a871738c86
2 changed files with 10 additions and 2 deletions

View File

@@ -35,7 +35,7 @@ import (
var (
// ClusterDefaults has the same behavior as the old EnvVar and DefaultCluster fields
// DEPRECATED will be replaced
ClusterDefaults = clientcmdapi.Cluster{Server: os.Getenv("KUBERNETES_MASTER")}
ClusterDefaults = clientcmdapi.Cluster{Server: getDefaultServer()}
// DefaultClientConfig represents the legacy behavior of this package for defaulting
// DEPRECATED will be replace
DefaultClientConfig = DirectClientConfig{*clientcmdapi.NewConfig(), "", &ConfigOverrides{
@@ -43,6 +43,15 @@ var (
}, nil, NewDefaultClientConfigLoadingRules(), promptedCredentials{}}
)
// getDefaultServer returns a default setting for DefaultClientConfig
// DEPRECATED
func getDefaultServer() string {
if server := os.Getenv("KUBERNETES_MASTER"); len(server) > 0 {
return server
}
return "http://localhost:8080"
}
// ClientConfig is used to make it easy to get an api server client
type ClientConfig interface {
// RawConfig returns the merged result of all overrides

View File

@@ -324,7 +324,6 @@ runTests() {
exit 1
fi
kube::log::status "Checking kubectl version"
export KUBERNETES_MASTER=http://127.0.0.1:${API_PORT}
kubectl version
# Generate a random namespace name, based on the current time (to make