MCPcopy Create free account
hub / github.com/operator-framework/operator-sdk / NewChart

Function NewChart

internal/plugins/helm/v1/chartutil/chart.go:54–72  ·  view source on GitHub ↗

NewChart creates a new helm chart for the project from helm's default template. It returns a chart.Chart that references the newly created chart or an error.

(name string)

Source from the content-addressed store, hash-verified

52// NewChart creates a new helm chart for the project from helm's default template.
53// It returns a chart.Chart that references the newly created chart or an error.
54func NewChart(name string) (*chart.Chart, error) {
55 tmpDir, err := os.MkdirTemp("", "osdk-helm-chart")
56 if err != nil {
57 return nil, err
58 }
59 defer func() {
60 if err := os.RemoveAll(tmpDir); err != nil {
61 log.Errorf("Failed to remove temporary directory %s: %v", tmpDir, err)
62 }
63 }()
64
65 // Create a new chart
66 chartPath, err := chartutil.Create(name, tmpDir)
67 if err != nil {
68 return nil, err
69 }
70
71 return loader.Load(chartPath)
72}
73
74// LoadChart creates a new helm chart for the project based on the passed opts.
75// It returns a chart.Chart that references the newly created chart or an error.

Callers 2

InjectResourceMethod · 0.92
runTestCaseFunction · 0.92

Calls 2

LoadMethod · 0.80
CreateMethod · 0.45

Tested by 1

runTestCaseFunction · 0.74