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

Method WithContainerImage

pkg/podspec/builder.go:118–130  ·  view source on GitHub ↗

WithContainerImage ensures that, if in the current status there is a 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

116// set to the one passed.
117// If `overwrite` is true the image is overwritten even when it's not empty
118func (builder *Builder) WithContainerImage(name, image string, overwrite bool) *Builder {
119 builder.WithContainer(name)
120
121 for idx, value := range builder.status.Spec.Containers {
122 if value.Name == name {
123 if overwrite || value.Image == "" {
124 builder.status.Spec.Containers[idx].Image = image
125 }
126 }
127 }
128
129 return builder
130}
131
132// WithContainerVolumeMount ensure that the passed the volume mount exist in
133// the current status, overriding the present one when needed

Callers 2

builder_test.goFile · 0.80
DeploymentFunction · 0.80

Calls 1

WithContainerMethod · 0.95

Tested by

no test coverage detected