getConfigFromFile tries to read a kubeconfig file and if it can't, returns an error. One exception, missing files result in empty configs, not an error.
(filename string)
| 469 | |
| 470 | // getConfigFromFile tries to read a kubeconfig file and if it can't, returns an error. One exception, missing files result in empty configs, not an error. |
| 471 | func getConfigFromFile(filename string) (*clientcmdapi.Config, error) { |
| 472 | config, err := LoadFromFile(filename) |
| 473 | if err != nil && !os.IsNotExist(err) { |
| 474 | return nil, err |
| 475 | } |
| 476 | if config == nil { |
| 477 | config = clientcmdapi.NewConfig() |
| 478 | } |
| 479 | return config, nil |
| 480 | } |
| 481 | |
| 482 | // GetConfigFromFileOrDie tries to read a kubeconfig file and if it can't, it calls exit. One exception, missing files result in empty configs, not an exit |
| 483 | func GetConfigFromFileOrDie(filename string) *clientcmdapi.Config { |
no test coverage detected