Simplify getting configuration.
This commit is contained in:
		
							parent
							
								
									021eedb226
								
							
						
					
					
						commit
						776ed3fa0f
					
				|  | @ -14,19 +14,11 @@ import ( | ||||||
| 	"github.bus.zalan.do/acid/postgres-operator/pkg/util/constants" | 	"github.bus.zalan.do/acid/postgres-operator/pkg/util/constants" | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| func RestConfig(kubeConfig string, outOfCluster bool) (config *rest.Config, err error) { | func RestConfig(kubeConfig string, outOfCluster bool) (*rest.Config, error) { | ||||||
| 	if outOfCluster { | 	if outOfCluster { | ||||||
| 		/* out-of-cluster process */ | 		return clientcmd.BuildConfigFromFlags("", kubeConfig) | ||||||
| 		rules := clientcmd.NewDefaultClientConfigLoadingRules() |  | ||||||
| 		overrides := &clientcmd.ConfigOverrides{} |  | ||||||
| 		rules.ExplicitPath = kubeConfig |  | ||||||
| 		config, err = clientcmd.NewNonInteractiveDeferredLoadingClientConfig(rules, overrides).ClientConfig() |  | ||||||
| 	} else { |  | ||||||
| 		/* in-cluster pod */ |  | ||||||
| 		config, err = rest.InClusterConfig() |  | ||||||
| 	} | 	} | ||||||
| 
 | 	return rest.InClusterConfig() | ||||||
| 	return |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func KubernetesClient(config *rest.Config) (client *kubernetes.Clientset, err error) { | func KubernetesClient(config *rest.Config) (client *kubernetes.Clientset, err error) { | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue