// loadKubernetesConfig loads kubernetes configuration based on flags.
loadKubernetesConfig loads kubernetes configuration based on flags.
// loadKubernetesConfig loads kubernetes configuration based on flags .
func (k kubeControllerCommand) loadKubernetesConfig() (*rest.Config, error) {
	var cfg *rest.Config
	if k.kubeLocal {
		config, err := clientcmd.NewNonInteractiveDeferredLoadingClientConfig(
			&clientcmd.ClientConfigLoadingRules{
				ExplicitPath: k.kubeConfig,
			},
			&clientcmd.ConfigOverrides{
				CurrentContext: k.kubeContext,
			}).ClientConfig()
		if err != nil {
			return nil, fmt.Errorf("could not load configuration: %w", err)
		}
		cfg = config
	} else {
		config, err := rest.InClusterConfig()
		if err != nil {
			return nil, fmt.Errorf("error loading kubernetes configuration inside cluster, check app is running outside kubernetes cluster or run in development mode: %w", err)
		}
		cfg = config
	}
	cfg.QPS = 100
	cfg.Burst = 100
	return cfg, nil
}
func ( k kubeControllerCommand ) loadKubernetesConfig ( ) ( * rest . Config , error ) { var cfg * rest . Config if k . kubeLocal { config , err := clientcmd . NewNonInteractiveDeferredLoadingClientConfig ( & clientcmd . ClientConfigLoadingRules { ExplicitPath : k . kubeConfig , } , & clientcmd . ConfigOverrides { CurrentContext : k . kubeContext , } ) . ClientConfig ( ) if err != nil { return nil , fmt . Errorf ( " " , err ) } cfg = config } else { config , err := rest . InClusterConfig ( ) if err != nil { return nil , fmt . Errorf ( " " , err ) } cfg = config } cfg . QPS = 100 cfg . Burst = 100 return cfg , nil }
loadKubernetesConfig loads kubernetes configuration based on flags.
loadKubernetesConfig loads kubernetes configuration based on flags .
// If kube local mode then use configuration flag path. // Set better cli rate limiter.