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

Method WithInitContainerImage

pkg/podspec/builder.go:309–321  ·  view source on GitHub ↗

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

(name, image string, overwrite bool)

Source from the content-addressed store, hash-verified

307// set to the one passed.
308// If `overwrite` is true the image is overwritten even when it's not empty
309func (builder *Builder) WithInitContainerImage(name, image string, overwrite bool) *Builder {
310 builder.WithInitContainer(name)
311
312 for idx, value := range builder.status.Spec.InitContainers {
313 if value.Name == name {
314 if overwrite || value.Image == "" {
315 builder.status.Spec.InitContainers[idx].Image = image
316 }
317 }
318 }
319
320 return builder
321}
322
323// WithInitContainerVolumeMount ensure that the passed the volume mount exist in
324// the current status, overriding the present one when needed

Callers 2

builder_test.goFile · 0.80
DeploymentFunction · 0.80

Calls 1

WithInitContainerMethod · 0.95

Tested by

no test coverage detected