mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-06 10:43:56 +00:00
add restart on definition change
This commit is contained in:
parent
3710d6f570
commit
43d527ad68
@ -1127,6 +1127,18 @@ func (m *kubeGenericRuntimeManager) computeInitContainerActions(pod *v1.Pod, pod
|
|||||||
changes.InitContainersToStart = append(changes.InitContainersToStart, i+1)
|
changes.InitContainersToStart = append(changes.InitContainersToStart, i+1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Restart running sidecar containers which have had their definition changed.
|
||||||
|
if _, _, changed := containerChanged(container, status); changed {
|
||||||
|
changes.ContainersToKill[status.ID] = containerToKillInfo{
|
||||||
|
name: container.Name,
|
||||||
|
container: container,
|
||||||
|
message: fmt.Sprintf("Init container %s definition changed", container.Name),
|
||||||
|
reason: "",
|
||||||
|
}
|
||||||
|
changes.InitContainersToStart = append(changes.InitContainersToStart, i)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
// A restartable init container does not have to take into account its
|
// A restartable init container does not have to take into account its
|
||||||
// liveness probe when it determines to start the next init container.
|
// liveness probe when it determines to start the next init container.
|
||||||
if container.LivenessProbe != nil {
|
if container.LivenessProbe != nil {
|
||||||
|
@ -3717,7 +3717,7 @@ var _ = SIGDescribe(nodefeature.SidecarContainers, "Containers Lifecycle", func(
|
|||||||
err = e2epod.WaitForPodCondition(ctx, f.ClientSet, pod.Namespace, pod.Name, "init container attempted to run with updated image",
|
err = e2epod.WaitForPodCondition(ctx, f.ClientSet, pod.Namespace, pod.Name, "init container attempted to run with updated image",
|
||||||
time.Duration(30)*time.Second, func(pod *v1.Pod) (bool, error) {
|
time.Duration(30)*time.Second, func(pod *v1.Pod) (bool, error) {
|
||||||
containerStatus := pod.Status.InitContainerStatuses[1]
|
containerStatus := pod.Status.InitContainerStatuses[1]
|
||||||
return containerStatus.Image == updatedImage, nil
|
return containerStatus.Image == updatedImage && containerStatus.RestartCount > 1, nil
|
||||||
})
|
})
|
||||||
framework.ExpectNoError(err)
|
framework.ExpectNoError(err)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user