File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -113,7 +113,7 @@ func GetConfigWithContext(context string) (*rest.Config, error) {
113
113
var loadInClusterConfig = rest .InClusterConfig
114
114
115
115
// loadConfig loads a REST Config as per the rules specified in GetConfig.
116
- func loadConfig (context string ) (* rest.Config , error ) {
116
+ func loadConfig (context string ) (config * rest.Config , configErr error ) {
117
117
// If a flag is specified with the config location, use that
118
118
if len (kubeconfig ) > 0 {
119
119
return loadConfigWithContext ("" , & clientcmd.ClientConfigLoadingRules {ExplicitPath : kubeconfig }, context )
@@ -123,9 +123,16 @@ func loadConfig(context string) (*rest.Config, error) {
123
123
// try the in-cluster config.
124
124
kubeconfigPath := os .Getenv (clientcmd .RecommendedConfigPathEnvVar )
125
125
if len (kubeconfigPath ) == 0 {
126
- if c , err := loadInClusterConfig (); err == nil {
126
+ c , err := loadInClusterConfig ()
127
+ if err == nil {
127
128
return c , nil
128
129
}
130
+
131
+ defer func () {
132
+ if configErr != nil {
133
+ log .Error (err , "unable to load in-cluster config" )
134
+ }
135
+ }()
129
136
}
130
137
131
138
// If the recommended kubeconfig env variable is set, or there
You can’t perform that action at this time.
0 commit comments