mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-13 13:55:41 +00:00
Update the kubelet to ignore syncing Pods until the container runtime is up.
This commit is contained in:
parent
0f3740501b
commit
bf9416c923
@ -1663,6 +1663,11 @@ func (kl *Kubelet) admitPods(allPods []*api.Pod, podSyncTypes map[types.UID]Sync
|
|||||||
func (kl *Kubelet) syncLoop(updates <-chan PodUpdate, handler SyncHandler) {
|
func (kl *Kubelet) syncLoop(updates <-chan PodUpdate, handler SyncHandler) {
|
||||||
glog.Info("Starting kubelet main sync loop.")
|
glog.Info("Starting kubelet main sync loop.")
|
||||||
for {
|
for {
|
||||||
|
if !kl.containerRuntimeUp() {
|
||||||
|
time.Sleep(5 * time.Second)
|
||||||
|
glog.Infof("Skipping pod synchronization, container runtime is not up.")
|
||||||
|
continue
|
||||||
|
}
|
||||||
unsyncedPod := false
|
unsyncedPod := false
|
||||||
podSyncTypes := make(map[types.UID]SyncPodType)
|
podSyncTypes := make(map[types.UID]SyncPodType)
|
||||||
select {
|
select {
|
||||||
@ -1923,11 +1928,7 @@ func (kl *Kubelet) setNodeStatus(node *api.Node) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check whether container runtime can be reported as up.
|
// Check whether container runtime can be reported as up.
|
||||||
containerRuntimeUp := func() bool {
|
containerRuntimeUp := kl.containerRuntimeUp()
|
||||||
kl.runtimeMutex.Lock()
|
|
||||||
defer kl.runtimeMutex.Unlock()
|
|
||||||
return kl.lastTimestampRuntimeUp.Add(kl.runtimeUpThreshold).After(time.Now())
|
|
||||||
}()
|
|
||||||
|
|
||||||
currentTime := util.Now()
|
currentTime := util.Now()
|
||||||
var newNodeReadyCondition api.NodeCondition
|
var newNodeReadyCondition api.NodeCondition
|
||||||
@ -1990,6 +1991,12 @@ func (kl *Kubelet) setNodeStatus(node *api.Node) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (kl *Kubelet) containerRuntimeUp() bool {
|
||||||
|
kl.runtimeMutex.Lock()
|
||||||
|
defer kl.runtimeMutex.Unlock()
|
||||||
|
return kl.lastTimestampRuntimeUp.Add(kl.runtimeUpThreshold).After(time.Now())
|
||||||
|
}
|
||||||
|
|
||||||
// tryUpdateNodeStatus tries to update node status to master. If ReconcileCBR0
|
// tryUpdateNodeStatus tries to update node status to master. If ReconcileCBR0
|
||||||
// is set, this function will also confirm that cbr0 is configured correctly.
|
// is set, this function will also confirm that cbr0 is configured correctly.
|
||||||
func (kl *Kubelet) tryUpdateNodeStatus() error {
|
func (kl *Kubelet) tryUpdateNodeStatus() error {
|
||||||
|
Loading…
Reference in New Issue
Block a user