@@ -50,6 +50,7 @@ import (
50
50
runtimeapi "k8s.io/cri-api/pkg/apis/runtime/v1"
51
51
remote "k8s.io/cri-client/pkg"
52
52
kubelettypes "k8s.io/kubelet/pkg/types"
53
+ podutil "k8s.io/kubernetes/pkg/api/v1/pod"
53
54
"k8s.io/kubernetes/pkg/features"
54
55
kubecontainer "k8s.io/kubernetes/pkg/kubelet/container"
55
56
"k8s.io/kubernetes/pkg/kubelet/events"
@@ -1069,13 +1070,13 @@ func (m *kubeGenericRuntimeManager) computeInitContainerActions(pod *v1.Pod, pod
1069
1070
// If the container is previously initialized but its status is not
1070
1071
// found, it means its last status is removed for some reason.
1071
1072
// Restart it if it is a restartable init container.
1072
- if isPreviouslyInitialized && types .IsRestartableInitContainer (container ) {
1073
+ if isPreviouslyInitialized && podutil .IsRestartableInitContainer (container ) {
1073
1074
changes .InitContainersToStart = append (changes .InitContainersToStart , i )
1074
1075
}
1075
1076
continue
1076
1077
}
1077
1078
1078
- if isPreviouslyInitialized && ! types .IsRestartableInitContainer (container ) {
1079
+ if isPreviouslyInitialized && ! podutil .IsRestartableInitContainer (container ) {
1079
1080
// after initialization, only restartable init containers need to be kept
1080
1081
// running
1081
1082
continue
@@ -1091,11 +1092,11 @@ func (m *kubeGenericRuntimeManager) computeInitContainerActions(pod *v1.Pod, pod
1091
1092
changes .InitContainersToStart = append (changes .InitContainersToStart , i )
1092
1093
1093
1094
case kubecontainer .ContainerStateRunning :
1094
- if ! types .IsRestartableInitContainer (container ) {
1095
+ if ! podutil .IsRestartableInitContainer (container ) {
1095
1096
break
1096
1097
}
1097
1098
1098
- if types .IsRestartableInitContainer (container ) {
1099
+ if podutil .IsRestartableInitContainer (container ) {
1099
1100
if container .StartupProbe != nil {
1100
1101
startup , found := m .startupManager .Get (status .ID )
1101
1102
if ! found {
@@ -1166,7 +1167,7 @@ func (m *kubeGenericRuntimeManager) computeInitContainerActions(pod *v1.Pod, pod
1166
1167
// If the init container failed and the restart policy is Never, the pod is terminal.
1167
1168
// Otherwise, restart the init container.
1168
1169
case kubecontainer .ContainerStateExited :
1169
- if types .IsRestartableInitContainer (container ) {
1170
+ if podutil .IsRestartableInitContainer (container ) {
1170
1171
changes .InitContainersToStart = append (changes .InitContainersToStart , i )
1171
1172
} else { // init container
1172
1173
if isInitContainerFailed (status ) {
@@ -1189,7 +1190,7 @@ func (m *kubeGenericRuntimeManager) computeInitContainerActions(pod *v1.Pod, pod
1189
1190
}
1190
1191
1191
1192
default : // kubecontainer.ContainerStatusUnknown or other unknown states
1192
- if types .IsRestartableInitContainer (container ) {
1193
+ if podutil .IsRestartableInitContainer (container ) {
1193
1194
// If the restartable init container is in unknown state, restart it.
1194
1195
changes .ContainersToKill [status .ID ] = containerToKillInfo {
1195
1196
name : container .Name ,
0 commit comments