MCPcopy Create free account
hub / github.com/cloudnative-pg/cloudnative-pg / WithInitContainerCommand

Method WithInitContainerCommand

pkg/podspec/builder.go:354–366  ·  view source on GitHub ↗

WithInitContainerCommand ensures that, if in the current status there is an init container with the passed name and the command is empty, the command will be set to the one passed. If `overwrite` is true the command is overwritten even when it's not empty

(name string, command []string, overwrite bool)

Source from the content-addressed store, hash-verified

352// set to the one passed.
353// If `overwrite` is true the command is overwritten even when it's not empty
354func (builder *Builder) WithInitContainerCommand(name string, command []string, overwrite bool) *Builder {
355 builder.WithInitContainer(name)
356
357 for idx, value := range builder.status.Spec.InitContainers {
358 if value.Name == name {
359 if overwrite || len(value.Command) == 0 {
360 builder.status.Spec.InitContainers[idx].Command = command
361 }
362 }
363 }
364
365 return builder
366}
367
368// WithInitContainerSecurityContext ensures that, if in the current status there is
369// an init container with the passed name and the securityContext is empty, the securityContext will be

Callers 2

builder_test.goFile · 0.80
DeploymentFunction · 0.80

Calls 1

WithInitContainerMethod · 0.95

Tested by

no test coverage detected