mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-26 21:17:23 +00:00
Switch to incremental pod config notification
This fixes https://github.com/mesosphere/kubernetes-mesos/issues/463, i.e. https://github.com/kubernetes/kubernetes/pull/13003 which broke contrib/mesos.
This commit is contained in:
parent
b6f2f396ba
commit
216865b80a
@ -533,11 +533,10 @@ func (k *KubernetesExecutor) launchTask(driver bindings.ExecutorDriver, taskId s
|
|||||||
task.podName = podFullName
|
task.podName = podFullName
|
||||||
k.pods[podFullName] = pod
|
k.pods[podFullName] = pod
|
||||||
|
|
||||||
// send the latest snapshot of the set of pods to the kubelet via the pod update channel.
|
// send the new pod to the kubelet which will spin it up
|
||||||
// this results in the kubelet spinning up the new pod.
|
update := kubelet.PodUpdate{
|
||||||
update := kubelet.PodUpdate{Op: kubelet.SET}
|
Op: kubelet.ADD,
|
||||||
for _, p := range k.pods {
|
Pods: []*api.Pod{pod},
|
||||||
update.Pods = append(update.Pods, p)
|
|
||||||
}
|
}
|
||||||
k.updateChan <- update
|
k.updateChan <- update
|
||||||
|
|
||||||
@ -729,16 +728,17 @@ func (k *KubernetesExecutor) removePodTask(driver bindings.ExecutorDriver, tid,
|
|||||||
k.resetSuicideWatch(driver)
|
k.resetSuicideWatch(driver)
|
||||||
|
|
||||||
pid := task.podName
|
pid := task.podName
|
||||||
if _, found := k.pods[pid]; !found {
|
pod, found := k.pods[pid]
|
||||||
|
if !found {
|
||||||
log.Warningf("Cannot remove unknown pod %v for task %v", pid, tid)
|
log.Warningf("Cannot remove unknown pod %v for task %v", pid, tid)
|
||||||
} else {
|
} else {
|
||||||
log.V(2).Infof("deleting pod %v for task %v", pid, tid)
|
log.V(2).Infof("deleting pod %v for task %v", pid, tid)
|
||||||
delete(k.pods, pid)
|
delete(k.pods, pid)
|
||||||
|
|
||||||
// Send the pod updates to the channel.
|
// tell the kubelet to remove the pod
|
||||||
update := kubelet.PodUpdate{Op: kubelet.SET}
|
update := kubelet.PodUpdate{
|
||||||
for _, p := range k.pods {
|
Op: kubelet.REMOVE,
|
||||||
update.Pods = append(update.Pods, p)
|
Pods: []*api.Pod{pod},
|
||||||
}
|
}
|
||||||
k.updateChan <- update
|
k.updateChan <- update
|
||||||
}
|
}
|
||||||
|
@ -321,7 +321,7 @@ func (ks *KubeletExecutorServer) createAndInitKubelet(
|
|||||||
MaxContainers: kc.MaxContainerCount,
|
MaxContainers: kc.MaxContainerCount,
|
||||||
}
|
}
|
||||||
|
|
||||||
pc := kconfig.NewPodConfig(kconfig.PodConfigNotificationSnapshotAndUpdates, kc.Recorder)
|
pc := kconfig.NewPodConfig(kconfig.PodConfigNotificationIncremental, kc.Recorder)
|
||||||
updates := pc.Channel(MESOS_CFG_SOURCE)
|
updates := pc.Channel(MESOS_CFG_SOURCE)
|
||||||
|
|
||||||
klet, err := kubelet.NewMainKubelet(
|
klet, err := kubelet.NewMainKubelet(
|
||||||
|
Loading…
Reference in New Issue
Block a user