@@ -50,6 +50,7 @@ import (
5050 runtimeapi "k8s.io/cri-api/pkg/apis/runtime/v1"
5151 remote "k8s.io/cri-client/pkg"
5252 kubelettypes "k8s.io/kubelet/pkg/types"
53+ podutil "k8s.io/kubernetes/pkg/api/v1/pod"
5354 "k8s.io/kubernetes/pkg/features"
5455 kubecontainer "k8s.io/kubernetes/pkg/kubelet/container"
5556 "k8s.io/kubernetes/pkg/kubelet/events"
@@ -1070,13 +1071,13 @@ func (m *kubeGenericRuntimeManager) computeInitContainerActions(pod *v1.Pod, pod
10701071 // If the container is previously initialized but its status is not
10711072 // found, it means its last status is removed for some reason.
10721073 // Restart it if it is a restartable init container.
1073- if isPreviouslyInitialized && types .IsRestartableInitContainer (container ) {
1074+ if isPreviouslyInitialized && podutil .IsRestartableInitContainer (container ) {
10741075 changes .InitContainersToStart = append (changes .InitContainersToStart , i )
10751076 }
10761077 continue
10771078 }
10781079
1079- if isPreviouslyInitialized && ! types .IsRestartableInitContainer (container ) {
1080+ if isPreviouslyInitialized && ! podutil .IsRestartableInitContainer (container ) {
10801081 // after initialization, only restartable init containers need to be kept
10811082 // running
10821083 continue
@@ -1092,11 +1093,11 @@ func (m *kubeGenericRuntimeManager) computeInitContainerActions(pod *v1.Pod, pod
10921093 changes .InitContainersToStart = append (changes .InitContainersToStart , i )
10931094
10941095 case kubecontainer .ContainerStateRunning :
1095- if ! types .IsRestartableInitContainer (container ) {
1096+ if ! podutil .IsRestartableInitContainer (container ) {
10961097 break
10971098 }
10981099
1099- if types .IsRestartableInitContainer (container ) {
1100+ if podutil .IsRestartableInitContainer (container ) {
11001101 if container .StartupProbe != nil {
11011102 startup , found := m .startupManager .Get (status .ID )
11021103 if ! found {
@@ -1167,7 +1168,7 @@ func (m *kubeGenericRuntimeManager) computeInitContainerActions(pod *v1.Pod, pod
11671168 // If the init container failed and the restart policy is Never, the pod is terminal.
11681169 // Otherwise, restart the init container.
11691170 case kubecontainer .ContainerStateExited :
1170- if types .IsRestartableInitContainer (container ) {
1171+ if podutil .IsRestartableInitContainer (container ) {
11711172 changes .InitContainersToStart = append (changes .InitContainersToStart , i )
11721173 } else { // init container
11731174 if isInitContainerFailed (status ) {
@@ -1190,7 +1191,7 @@ func (m *kubeGenericRuntimeManager) computeInitContainerActions(pod *v1.Pod, pod
11901191 }
11911192
11921193 default : // kubecontainer.ContainerStatusUnknown or other unknown states
1193- if types .IsRestartableInitContainer (container ) {
1194+ if podutil .IsRestartableInitContainer (container ) {
11941195 // If the restartable init container is in unknown state, restart it.
11951196 changes .ContainersToKill [status .ID ] = containerToKillInfo {
11961197 name : container .Name ,
0 commit comments