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

Method WithVolume

pkg/podspec/builder.go:74–84  ·  view source on GitHub ↗

WithVolume adds a volume to the current podTemplate, replacing the current definition if present

(volume *corev1.Volume)

Source from the content-addressed store, hash-verified

72// WithVolume adds a volume to the current podTemplate, replacing the current
73// definition if present
74func (builder *Builder) WithVolume(volume *corev1.Volume) *Builder {
75 for idx, value := range builder.status.Spec.Volumes {
76 if value.Name == volume.Name {
77 builder.status.Spec.Volumes[idx] = *volume
78 return builder
79 }
80 }
81
82 builder.status.Spec.Volumes = append(builder.status.Spec.Volumes, *volume)
83 return builder
84}
85
86// WithSecurityContext adds a securityContext to the current podTemplate is nil.
87// If `overwrite` is true the securityContext is overwritten even when it's not empty

Callers 2

builder_test.goFile · 0.80
DeploymentFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected