func makeErrorKubeconfig() (clientcmd.ClientConfigLoadingRules, clientcmd.ClientConfig) { // Set a non-empty CommandLinePath to trigger loading loadingRules := clientcmd.ClientConfigLoadingRules{} loadingRules.ExplicitPath = "missing-file" clientConfig := clientcmd.NewNonInteractiveDeferredLoadingClientConfig( &loadingRules, &clientcmd.ConfigOverrides{}, ) return loadingRules, clientConfig }
func makeEmptyKubeconfig() (clientcmd.ClientConfigLoadingRules, clientcmd.ClientConfig) { // Set a non-empty CommandLinePath to trigger loading loadingRules := clientcmd.ClientConfigLoadingRules{} loadingRules.ExplicitPath = "specified" clientConfig := clientcmd.NewNonInteractiveDeferredLoadingClientConfig( // Set empty loading rules to avoid missing file errors &clientcmd.ClientConfigLoadingRules{}, &clientcmd.ConfigOverrides{}, ) return loadingRules, clientConfig }
func makeKubeconfig(server, user string) (clientcmd.ClientConfigLoadingRules, clientcmd.ClientConfig) { // Set a non-empty CommandLinePath to trigger loading loadingRules := clientcmd.ClientConfigLoadingRules{} loadingRules.ExplicitPath = "specified" clientConfig := clientcmd.NewNonInteractiveDeferredLoadingClientConfig( // Set empty loading rules to avoid missing file errors &clientcmd.ClientConfigLoadingRules{}, // Override the server and user in client config to simulate loading from a file &clientcmd.ConfigOverrides{ ClusterInfo: clientcmdapi.Cluster{Server: server}, AuthInfo: clientcmdapi.AuthInfo{Username: user}, }, ) return loadingRules, clientConfig }