getContext returns the clientcmdapi.Context, or an error if a required context is not found.
()
| 406 | |
| 407 | // getContext returns the clientcmdapi.Context, or an error if a required context is not found. |
| 408 | func (config *DirectClientConfig) getContext() (clientcmdapi.Context, error) { |
| 409 | contexts := config.config.Contexts |
| 410 | contextName, required := config.getContextName() |
| 411 | |
| 412 | mergedContext := clientcmdapi.NewContext() |
| 413 | if configContext, exists := contexts[contextName]; exists { |
| 414 | mergo.MergeWithOverwrite(mergedContext, configContext) |
| 415 | } else if required { |
| 416 | return clientcmdapi.Context{}, fmt.Errorf("context %q does not exist", contextName) |
| 417 | } |
| 418 | mergo.MergeWithOverwrite(mergedContext, config.overrides.Context) |
| 419 | |
| 420 | return *mergedContext, nil |
| 421 | } |
| 422 | |
| 423 | // getAuthInfo returns the clientcmdapi.AuthInfo, or an error if a required auth info is not found. |
| 424 | func (config *DirectClientConfig) getAuthInfo() (clientcmdapi.AuthInfo, error) { |
no test coverage detected