WithContainerVolumeMount 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, )
| 132 | // WithContainerVolumeMount ensure that the passed the volume mount exist in |
| 133 | // the current status, overriding the present one when needed |
| 134 | func (builder *Builder) WithContainerVolumeMount( |
| 135 | name string, volumeMount *corev1.VolumeMount, overwrite bool, |
| 136 | ) *Builder { |
| 137 | builder.WithContainer(name) |
| 138 | |
| 139 | for idxContainer, container := range builder.status.Spec.Containers { |
| 140 | if container.Name == name { |
| 141 | for idxMount, mount := range container.VolumeMounts { |
| 142 | if mount.Name == volumeMount.Name { |
| 143 | if overwrite { |
| 144 | builder.status.Spec.Containers[idxContainer].VolumeMounts[idxMount] = *volumeMount |
| 145 | } |
| 146 | return builder |
| 147 | } |
| 148 | } |
| 149 | |
| 150 | builder.status.Spec.Containers[idxContainer].VolumeMounts = append( |
| 151 | builder.status.Spec.Containers[idxContainer].VolumeMounts, |
| 152 | *volumeMount) |
| 153 | } |
| 154 | } |
| 155 | |
| 156 | return builder |
| 157 | } |
| 158 | |
| 159 | // WithContainerEnv add the provided EnvVar to a container |
| 160 | func (builder *Builder) WithContainerEnv(name string, env corev1.EnvVar, overwrite bool) *Builder { |
no test coverage detected