WithInitContainerVolumeMount ensure that the passed the volume mount exist in the current status, overriding the present one when needed
( name string, volumeMount *corev1.VolumeMount, overwrite bool, )
| 323 | // WithInitContainerVolumeMount ensure that the passed the volume mount exist in |
| 324 | // the current status, overriding the present one when needed |
| 325 | func (builder *Builder) WithInitContainerVolumeMount( |
| 326 | name string, volumeMount *corev1.VolumeMount, overwrite bool, |
| 327 | ) *Builder { |
| 328 | builder.WithInitContainer(name) |
| 329 | |
| 330 | for idxContainer, container := range builder.status.Spec.InitContainers { |
| 331 | if container.Name == name { |
| 332 | for idxMount, mount := range container.VolumeMounts { |
| 333 | if mount.Name == volumeMount.Name { |
| 334 | if overwrite { |
| 335 | builder.status.Spec.InitContainers[idxContainer].VolumeMounts[idxMount] = *volumeMount |
| 336 | } |
| 337 | return builder |
| 338 | } |
| 339 | } |
| 340 | |
| 341 | builder.status.Spec.InitContainers[idxContainer].VolumeMounts = append( |
| 342 | builder.status.Spec.InitContainers[idxContainer].VolumeMounts, |
| 343 | *volumeMount) |
| 344 | } |
| 345 | } |
| 346 | |
| 347 | return builder |
| 348 | } |
| 349 | |
| 350 | // WithInitContainerCommand ensures that, if in the current status there is |
| 351 | // an init container with the passed name and the command is empty, the command will be |
no test coverage detected