@@ -496,6 +496,8 @@ type podActions struct {
496
496
Attempt uint32
497
497
498
498
// The next init container to start.
499
+ // TODO: Either this or InitContainersToStart will be used. Remove this
500
+ // field once it is not needed.
499
501
NextInitContainerToStart * v1.Container
500
502
// InitContainersToStart keeps a list of indexes for the init containers to
501
503
// start, where the index is the index of the specific init container in the
@@ -934,6 +936,8 @@ func (m *kubeGenericRuntimeManager) computePodActions(ctx context.Context, pod *
934
936
// is done and there is no container to start.
935
937
if len (containersToStart ) == 0 {
936
938
hasInitialized := false
939
+ // TODO: Remove this code path as logically it is the subset of the next
940
+ // code path.
937
941
if ! handleRestartableInitContainers {
938
942
_ , _ , hasInitialized = findNextInitContainerToRun (pod , podStatus )
939
943
} else {
@@ -952,6 +956,8 @@ func (m *kubeGenericRuntimeManager) computePodActions(ctx context.Context, pod *
952
956
// state.
953
957
if len (pod .Spec .InitContainers ) != 0 {
954
958
// Pod has init containers, return the first one.
959
+ // TODO: Remove this code path as logically it is the subset of the next
960
+ // code path.
955
961
if ! handleRestartableInitContainers {
956
962
changes .NextInitContainerToStart = & pod .Spec .InitContainers [0 ]
957
963
} else {
@@ -975,6 +981,8 @@ func (m *kubeGenericRuntimeManager) computePodActions(ctx context.Context, pod *
975
981
}
976
982
977
983
// Check initialization progress.
984
+ // TODO: Remove this code path as logically it is the subset of the next
985
+ // code path.
978
986
if ! handleRestartableInitContainers {
979
987
initLastStatus , next , done := findNextInitContainerToRun (pod , podStatus )
980
988
if ! done {
@@ -1095,6 +1103,8 @@ func (m *kubeGenericRuntimeManager) computePodActions(ctx context.Context, pod *
1095
1103
1096
1104
if keepCount == 0 && len (changes .ContainersToStart ) == 0 {
1097
1105
changes .KillPod = true
1106
+ // TODO: Remove this code path as logically it is the subset of the next
1107
+ // code path.
1098
1108
if handleRestartableInitContainers {
1099
1109
// To prevent the restartable init containers to keep pod alive, we should
1100
1110
// not restart them.
@@ -1353,6 +1363,8 @@ func (m *kubeGenericRuntimeManager) SyncPod(ctx context.Context, pod *v1.Pod, po
1353
1363
start (ctx , "ephemeral container" , metrics .EphemeralContainer , ephemeralContainerStartSpec (& pod .Spec .EphemeralContainers [idx ]))
1354
1364
}
1355
1365
1366
+ // TODO: Remove this code path as logically it is the subset of the next
1367
+ // code path.
1356
1368
if ! types .HasRestartableInitContainer (pod ) {
1357
1369
// Step 6: start the init container.
1358
1370
if container := podContainerChanges .NextInitContainerToStart ; container != nil {
0 commit comments