@@ -257,34 +257,50 @@ func (meta *Metadata) GetAnnotationsOrNil() map[string]string {
257257 return meta .Annotations
258258}
259259
260+ // ---
261+ // Only one applier should be managing each volume definition.
262+ // https://docs.k8s.io/reference/using-api/server-side-apply#merge-strategy
263+ // +structType=atomic
260264type AdditionalVolume struct {
261- // A reference to a preexisting PVC .
265+ // Name of an existing PersistentVolumeClaim .
262266 // ---
267+ // https://pkg.go.dev/k8s.io/kubernetes/pkg/apis/core/validation#ValidatePersistentVolumeClaim
268+ // https://pkg.go.dev/k8s.io/kubernetes/pkg/apis/core/validation#ValidatePersistentVolumeName
269+ //
263270 // +required
264271 ClaimName DNS1123Subdomain `json:"claimName"`
265272
266- // The containers to attach this volume to.
267- // An omitted `Containers` field matches all containers.
268- // An empty `Containers` field matches no containers.
273+ // The names of containers in which to mount this volume.
274+ // The default mounts the volume in *all* containers. An empty list does not mount the volume to any containers.
269275 // ---
270- // +optional
271- // +listType=atomic
276+ // These are matched against [corev1.Container.Name] in a PodSpec, which is a [DNS1123Label].
277+ // https://pkg.go.dev/k8s.io/kubernetes/pkg/apis/core/validation#ValidatePodSpec
278+ //
279+ // Container names are unique within a Pod, so this list can be, too.
280+ // +listType=set
281+ //
272282 // +kubebuilder:validation:MaxItems=10
273- Containers []string `json:"containers,omitempty"`
283+ // +optional
284+ Containers []DNS1123Label `json:"containers"`
274285
275- // The name of the volume used for mounting path.
276- // Volumes are mounted in the pods at `volumes/<NAME>`
277- // Must be unique.
286+ // The name of the directory in which to mount this volume.
287+ // Volumes are mounted in containers at `/volumes/{name}`.
278288 // ---
279- // The `Name` field is a `DNS1123Label` type to enforce
280- // the max length.
281- // +required
282- // Max length is less than max 63 to allow prepending `volumes-` to name
289+ // This also goes into the [corev1.Volume.Name] field, which is a [DNS1123Label].
290+ // https://pkg.go.dev/k8s.io/kubernetes/pkg/apis/core/validation#ValidatePodSpec
291+ // https://pkg.go.dev/k8s.io/kubernetes/pkg/apis/core/validation#ValidateVolumes
292+ //
293+ // We prepend "volumes-" to avoid collisions with other [corev1.PodSpec.Volumes],
294+ // so the maximum is 8 less than the inherited 63.
283295 // +kubebuilder:validation:MaxLength=55
296+ //
297+ // +required
284298 Name DNS1123Label `json:"name"`
285299
286- // Sets the write/ read mode of the volume
300+ // When true, mount the volume read-only, otherwise read-write. Defaults to false.
287301 // ---
302+ // [corev1.VolumeMount.ReadOnly]
303+ //
288304 // +optional
289305 ReadOnly bool `json:"readOnly,omitempty"`
290306}
0 commit comments