MCPcopy Index your code
hub / github.com/devspace-sh/devspace / New

Function New

pkg/devspace/deploy/deployer/helm/client.go:38–74  ·  view source on GitHub ↗

New creates a new helm deployment client

(helmClient helmtypes.Client, deployConfig *latest.DeploymentConfig)

Source from the content-addressed store, hash-verified

36
37// New creates a new helm deployment client
38func New(helmClient helmtypes.Client, deployConfig *latest.DeploymentConfig) (deployer.Interface, error) {
39 // Exchange chart
40 if deployConfig.Helm.Chart == nil || (deployConfig.Helm.Chart.Name == DevSpaceChartConfig.Name && deployConfig.Helm.Chart.RepoURL == DevSpaceChartConfig.RepoURL) {
41 // extract component chart if possible
42 filename := "component-chart-" + DevSpaceChartConfig.Version + ".tgz"
43 componentChartBytes, err := assets.Asset(filename)
44 if err == nil {
45 homedir, _ := homedir.Dir()
46 completePath := filepath.Join(homedir, constants.DefaultHomeDevSpaceFolder, ComponentChartFolder, filename)
47 _, err := os.Stat(completePath)
48 if err != nil {
49 // make folder
50 err = os.MkdirAll(filepath.Dir(completePath), 0755)
51 if err != nil {
52 return nil, err
53 }
54
55 // write file
56 err = os.WriteFile(completePath, componentChartBytes, 0666)
57 if err != nil {
58 return nil, fmt.Errorf("error writing component chart to file: %v", err)
59 }
60 }
61
62 deployConfig.Helm.Chart = &latest.ChartConfig{
63 Name: completePath,
64 }
65 } else {
66 deployConfig.Helm.Chart = DevSpaceChartConfig
67 }
68 }
69
70 return &DeployConfig{
71 Helm: helmClient,
72 DeploymentConfig: deployConfig,
73 }, nil
74}
75
76// Delete deletes the deployment
77func Delete(ctx devspacecontext.Context, deploymentName string) error {

Callers

nothing calls this directly

Calls 2

AssetFunction · 0.92
ErrorfMethod · 0.45

Tested by

no test coverage detected