core: reference all containers in a spec by name instead of index
This changeset excludes converting _test.go code as there may be a
legitimate reasons (E.g. convenience) for unit test to be sensitive to
ordering.
Related to:
- https://github.com/rook/rook/issues/15291
- https://github.com/rook/rook/pull/16969
Signed-off-by: Joshua Hoblitt <josh@hoblitt.com>
(cherry picked from commit d059c351fc)
This commit is contained in:
1 parent
5a569f561b
commit
bba4beeae7
12 files changed
+96
-72
No files matched your search
@@ -275,7 +275,11 @@ func discoverAddressRanges(
|
||||
// set up net status vol from downward api, plus init container to wait for net status to be available
|
||||
netStatusVol, netStatusMount := networkStatusVolumeAndMount()
|
||||
job.Spec.Template.Spec.Volumes = append(job.Spec.Template.Spec.Volumes, netStatusVol)
|
||||
job.Spec.Template.Spec.Containers[0].VolumeMounts = append(job.Spec.Template.Spec.Containers[0].VolumeMounts, netStatusMount)
|
||||
canaryContainer, err := k8sutil.GetContainerByName(job.Spec.Template.Spec.Containers, cmdreporter.CmdReporterContainerName)
|
||||
if err != nil {
|
||||
return ranges, errors.Wrapf(err, "failed to find %q container in ceph %q network canary job", cmdreporter.CmdReporterContainerName, cephNetwork)
|
||||
}
|
||||
canaryContainer.VolumeMounts = append(canaryContainer.VolumeMounts, netStatusMount)
|
||||
job.Spec.Template.Spec.InitContainers = append(job.Spec.Template.Spec.InitContainers, containerWaitForNetworkStatus(clusterSpec, rookImage))
|
||||
|
||||
stdout, stderr, retcode, err := networkCanary.Run(ctx, detectNetworkCIDRTimeout)
|
||||
|
||||
Reference in new issue
Block a user