github.com/pachyderm/pachyderm@v1.13.4/src/client/pkg/helm/config.go (about)

     1  package helm
     2  
     3  import (
     4  	"github.com/pachyderm/pachyderm/src/client/pkg/config"
     5  	"github.com/pachyderm/pachyderm/src/client/pkg/errors"
     6  
     7  	log "github.com/sirupsen/logrus"
     8  	"helm.sh/helm/v3/pkg/action"
     9  	"helm.sh/helm/v3/pkg/cli"
    10  	"k8s.io/cli-runtime/pkg/genericclioptions"
    11  )
    12  
    13  func configureHelm(context *config.Context, overrideNamespace string) (*cli.EnvSettings, *action.Configuration, error) {
    14  	envSettings := cli.New()
    15  
    16  	actionConfig := new(action.Configuration)
    17  
    18  	if overrideNamespace == "" {
    19  		overrideNamespace = context.Namespace
    20  	}
    21  
    22  	configFlags := &genericclioptions.ConfigFlags{
    23  		ClusterName:  &context.ClusterName,
    24  		AuthInfoName: &context.AuthInfo,
    25  		Namespace:    &overrideNamespace,
    26  	}
    27  
    28  	if err := actionConfig.Init(configFlags, overrideNamespace, "", func(format string, v ...interface{}) {
    29  		log.Debugf(format, v...)
    30  	}); err != nil {
    31  		return nil, nil, errors.Wrapf(err, "could not init helm config")
    32  	}
    33  
    34  	return envSettings, actionConfig, nil
    35  }