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

Method WithContainerCommand

pkg/podspec/builder.go:229–241  ·  view source on GitHub ↗

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

227// set to the one passed.
228// If `overwrite` is true the command is overwritten even when it's not empty
229func (builder *Builder) WithContainerCommand(name string, command []string, overwrite bool) *Builder {
230 builder.WithContainer(name)
231
232 for idx, value := range builder.status.Spec.Containers {
233 if value.Name == name {
234 if overwrite || len(value.Command) == 0 {
235 builder.status.Spec.Containers[idx].Command = command
236 }
237 }
238 }
239
240 return builder
241}
242
243// WithContainerPort ensures that, if in the current status there is
244// a container with the passed name the passed container port will be

Callers 2

builder_test.goFile · 0.80
DeploymentFunction · 0.80

Calls 1

WithContainerMethod · 0.95

Tested by

no test coverage detected