MCPcopy Index your code
hub / github.com/1Panel-dev/KubePi / NewClient

Function NewClient

pkg/util/helm/helm.go:81–106  ·  view source on GitHub ↗
(config *Config)

Source from the content-addressed store, hash-verified

79}
80
81func NewClient(config *Config) (*Client, error) {
82 client := Client{
83 Architectures: config.Architectures,
84 }
85 client.settings = GetSettings(config.ClusterName)
86 cf := genericclioptions.NewConfigFlags(true)
87 apiServer := config.Host
88 cf.APIServer = &apiServer
89 kubeConfig := config.KubeConfig
90 cf.WrapConfigFn = func(config *rest.Config) *rest.Config {
91 return kubeConfig
92 }
93 cf.CacheDir = nil
94 if config.Namespace != "" {
95 client.Namespace = config.Namespace
96 cf.Namespace = &client.Namespace
97 }
98 client.ClusterName = config.ClusterName
99 actionConfig := new(action.Configuration)
100 if err := actionConfig.Init(cf, config.Namespace, helmDriver, nolog); err != nil {
101 return nil, err
102 }
103 client.actionConfig = actionConfig
104
105 return &client, nil
106}
107
108func (c Client) List(limit, offset int, pattern string) ([]*release.Release, int, error) {
109 client := action.NewList(c.actionConfig)

Callers 1

NewHelmClientFunction · 0.92

Calls 1

GetSettingsFunction · 0.85

Tested by

no test coverage detected