MCPcopy Index your code
hub / github.com/helm/helm / loadReleasesInMemory

Function loadReleasesInMemory

pkg/cmd/root.go:316–350  ·  view source on GitHub ↗

This function loads releases into the memory storage if the environment variable is properly set.

(actionConfig *action.Configuration)

Source from the content-addressed store, hash-verified

314// This function loads releases into the memory storage if the
315// environment variable is properly set.
316func loadReleasesInMemory(actionConfig *action.Configuration) {
317 filePaths := strings.Split(os.Getenv("HELM_MEMORY_DRIVER_DATA"), ":")
318 if len(filePaths) == 0 {
319 return
320 }
321
322 store := actionConfig.Releases
323 mem, ok := store.Driver.(*driver.Memory)
324 if !ok {
325 // For an unexpected reason we are not dealing with the memory storage driver.
326 return
327 }
328
329 actionConfig.KubeClient = &kubefake.PrintingKubeClient{Out: io.Discard}
330
331 for _, path := range filePaths {
332 b, err := os.ReadFile(path)
333 if err != nil {
334 log.Fatal("Unable to read memory driver data", err)
335 }
336
337 releases := []*release.Release{}
338 if err := yaml.Unmarshal(b, &releases); err != nil {
339 log.Fatal("Unable to unmarshal memory driver data: ", err)
340 }
341
342 for _, rel := range releases {
343 if err := store.Create(rel); err != nil {
344 log.Fatal(err)
345 }
346 }
347 }
348 // Must reset namespace to the proper one
349 mem.SetNamespace(settings.Namespace())
350}
351
352// hookOutputWriter provides the writer for writing hook logs.
353func hookOutputWriter(_, _, _ string) io.Writer {

Callers 1

NewRootCmdFunction · 0.85

Calls 4

FatalMethod · 0.80
CreateMethod · 0.65
NamespaceMethod · 0.65
SetNamespaceMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…