Skip to content

Commit 61c408a

Browse files
authored
Merge pull request kubernetes#125917 from skitt/drop-auth-path-kubernetes-auth
Drop references to auth-path and kubernetes_auth
2 parents e542d9c + 8a8238b commit 61c408a

File tree

1 file changed

+9
-21
lines changed

1 file changed

+9
-21
lines changed

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

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -243,43 +243,31 @@ func (config *DirectClientConfig) ClientConfig() (*restclient.Config, error) {
243243
}
244244
mergo.Merge(clientConfig, userAuthPartialConfig, mergo.WithOverride)
245245

246-
serverAuthPartialConfig, err := getServerIdentificationPartialConfig(configAuthInfo, configClusterInfo)
247-
if err != nil {
248-
return nil, err
249-
}
246+
serverAuthPartialConfig := getServerIdentificationPartialConfig(configClusterInfo)
250247
mergo.Merge(clientConfig, serverAuthPartialConfig, mergo.WithOverride)
251248
}
252249

253250
return clientConfig, nil
254251
}
255252

256253
// clientauth.Info object contain both user identification and server identification. We want different precedence orders for
257-
// both, so we have to split the objects and merge them separately
258-
// we want this order of precedence for the server identification
259-
// 1. configClusterInfo (the final result of command line flags and merged .kubeconfig files)
260-
// 2. configAuthInfo.auth-path (this file can contain information that conflicts with #1, and we want #1 to win the priority)
261-
// 3. load the ~/.kubernetes_auth file as a default
262-
func getServerIdentificationPartialConfig(configAuthInfo clientcmdapi.AuthInfo, configClusterInfo clientcmdapi.Cluster) (*restclient.Config, error) {
263-
mergedConfig := &restclient.Config{}
254+
// both, so we have to split the objects and merge them separately.
264255

265-
// configClusterInfo holds the information identify the server provided by .kubeconfig
256+
// getServerIdentificationPartialConfig extracts server identification information from configClusterInfo
257+
// (the final result of command line flags and merged .kubeconfig files).
258+
func getServerIdentificationPartialConfig(configClusterInfo clientcmdapi.Cluster) *restclient.Config {
266259
configClientConfig := &restclient.Config{}
267260
configClientConfig.CAFile = configClusterInfo.CertificateAuthority
268261
configClientConfig.CAData = configClusterInfo.CertificateAuthorityData
269262
configClientConfig.Insecure = configClusterInfo.InsecureSkipTLSVerify
270263
configClientConfig.ServerName = configClusterInfo.TLSServerName
271-
mergo.Merge(mergedConfig, configClientConfig, mergo.WithOverride)
272264

273-
return mergedConfig, nil
265+
return configClientConfig
274266
}
275267

276-
// clientauth.Info object contain both user identification and server identification. We want different precedence orders for
277-
// both, so we have to split the objects and merge them separately
278-
// we want this order of precedence for user identification
279-
// 1. configAuthInfo minus auth-path (the final result of command line flags and merged .kubeconfig files)
280-
// 2. configAuthInfo.auth-path (this file can contain information that conflicts with #1, and we want #1 to win the priority)
281-
// 3. if there is not enough information to identify the user, load try the ~/.kubernetes_auth file
282-
// 4. if there is not enough information to identify the user, prompt if possible
268+
// getUserIdentificationPartialConfig extracts user identification information from configAuthInfo
269+
// (the final result of command line flags and merged .kubeconfig files);
270+
// if the information available there is insufficient, it prompts (if possible) for additional information.
283271
func (config *DirectClientConfig) getUserIdentificationPartialConfig(configAuthInfo clientcmdapi.AuthInfo, fallbackReader io.Reader, persistAuthConfig restclient.AuthProviderConfigPersister, configClusterInfo clientcmdapi.Cluster) (*restclient.Config, error) {
284272
mergedConfig := &restclient.Config{}
285273

0 commit comments

Comments
 (0)