Skip to content

Commit 8a8238b

Browse files
committed
Drop references to auth-path and kubernetes_auth
These are long gone, removed in 2016: * AuthPath removal: kubernetes#29216 * Flag removal: kubernetes#40048 This removes the remnants from clientcmd, mostly in the comments describing how the configuration is loaded. Since getServerIdentificationPartialConfig can no longer fail (it copies fields from one struct to another), this drops the error return, along with the error handling in the caller. Signed-off-by: Stephen Kitt <[email protected]>
1 parent 95b3fe9 commit 8a8238b

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)