@@ -243,43 +243,31 @@ func (config *DirectClientConfig) ClientConfig() (*restclient.Config, error) {
243
243
}
244
244
mergo .Merge (clientConfig , userAuthPartialConfig , mergo .WithOverride )
245
245
246
- serverAuthPartialConfig , err := getServerIdentificationPartialConfig (configAuthInfo , configClusterInfo )
247
- if err != nil {
248
- return nil , err
249
- }
246
+ serverAuthPartialConfig := getServerIdentificationPartialConfig (configClusterInfo )
250
247
mergo .Merge (clientConfig , serverAuthPartialConfig , mergo .WithOverride )
251
248
}
252
249
253
250
return clientConfig , nil
254
251
}
255
252
256
253
// 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.
264
255
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 {
266
259
configClientConfig := & restclient.Config {}
267
260
configClientConfig .CAFile = configClusterInfo .CertificateAuthority
268
261
configClientConfig .CAData = configClusterInfo .CertificateAuthorityData
269
262
configClientConfig .Insecure = configClusterInfo .InsecureSkipTLSVerify
270
263
configClientConfig .ServerName = configClusterInfo .TLSServerName
271
- mergo .Merge (mergedConfig , configClientConfig , mergo .WithOverride )
272
264
273
- return mergedConfig , nil
265
+ return configClientConfig
274
266
}
275
267
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.
283
271
func (config * DirectClientConfig ) getUserIdentificationPartialConfig (configAuthInfo clientcmdapi.AuthInfo , fallbackReader io.Reader , persistAuthConfig restclient.AuthProviderConfigPersister , configClusterInfo clientcmdapi.Cluster ) (* restclient.Config , error ) {
284
272
mergedConfig := & restclient.Config {}
285
273
0 commit comments