Merge pull request #91577 from knabben/kubelet-bootstrap
kubelet: remove the --bootstrap-checkpoint-path feature
This commit is contained in:
@@ -66,7 +66,6 @@ import (
|
||||
"k8s.io/kubernetes/pkg/kubelet/apis/podresources"
|
||||
"k8s.io/kubernetes/pkg/kubelet/cadvisor"
|
||||
kubeletcertificate "k8s.io/kubernetes/pkg/kubelet/certificate"
|
||||
"k8s.io/kubernetes/pkg/kubelet/checkpointmanager"
|
||||
"k8s.io/kubernetes/pkg/kubelet/cloudresource"
|
||||
"k8s.io/kubernetes/pkg/kubelet/cm"
|
||||
"k8s.io/kubernetes/pkg/kubelet/config"
|
||||
@@ -249,7 +248,7 @@ type DockerOptions struct {
|
||||
|
||||
// makePodSourceConfig creates a config.PodConfig from the given
|
||||
// KubeletConfiguration or returns an error.
|
||||
func makePodSourceConfig(kubeCfg *kubeletconfiginternal.KubeletConfiguration, kubeDeps *Dependencies, nodeName types.NodeName, bootstrapCheckpointPath string) (*config.PodConfig, error) {
|
||||
func makePodSourceConfig(kubeCfg *kubeletconfiginternal.KubeletConfiguration, kubeDeps *Dependencies, nodeName types.NodeName) (*config.PodConfig, error) {
|
||||
manifestURLHeader := make(http.Header)
|
||||
if len(kubeCfg.StaticPodURLHeader) > 0 {
|
||||
for k, v := range kubeCfg.StaticPodURLHeader {
|
||||
@@ -274,20 +273,7 @@ func makePodSourceConfig(kubeCfg *kubeletconfiginternal.KubeletConfiguration, ku
|
||||
config.NewSourceURL(kubeCfg.StaticPodURL, manifestURLHeader, nodeName, kubeCfg.HTTPCheckFrequency.Duration, cfg.Channel(kubetypes.HTTPSource))
|
||||
}
|
||||
|
||||
// Restore from the checkpoint path
|
||||
// NOTE: This MUST happen before creating the apiserver source
|
||||
// below, or the checkpoint would override the source of truth.
|
||||
|
||||
var updatechannel chan<- interface{}
|
||||
if bootstrapCheckpointPath != "" {
|
||||
klog.Infof("Adding checkpoint path: %v", bootstrapCheckpointPath)
|
||||
updatechannel = cfg.Channel(kubetypes.ApiserverSource)
|
||||
err := cfg.Restore(bootstrapCheckpointPath, updatechannel)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
if kubeDeps.KubeClient != nil {
|
||||
klog.Infof("Watching apiserver")
|
||||
if updatechannel == nil {
|
||||
@@ -376,7 +362,6 @@ func NewMainKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
|
||||
keepTerminatedPodVolumes bool,
|
||||
nodeLabels map[string]string,
|
||||
seccompProfileRoot string,
|
||||
bootstrapCheckpointPath string,
|
||||
nodeStatusMaxImages int32) (*Kubelet, error) {
|
||||
if rootDirectory == "" {
|
||||
return nil, fmt.Errorf("invalid root directory %q", rootDirectory)
|
||||
@@ -399,7 +384,7 @@ func NewMainKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
|
||||
|
||||
if kubeDeps.PodConfig == nil {
|
||||
var err error
|
||||
kubeDeps.PodConfig, err = makePodSourceConfig(kubeCfg, kubeDeps, nodeName, bootstrapCheckpointPath)
|
||||
kubeDeps.PodConfig, err = makePodSourceConfig(kubeCfg, kubeDeps, nodeName)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -586,18 +571,11 @@ func NewMainKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
|
||||
|
||||
klet.livenessManager = proberesults.NewManager()
|
||||
klet.startupManager = proberesults.NewManager()
|
||||
|
||||
klet.podCache = kubecontainer.NewCache()
|
||||
var checkpointManager checkpointmanager.CheckpointManager
|
||||
if bootstrapCheckpointPath != "" {
|
||||
checkpointManager, err = checkpointmanager.NewCheckpointManager(bootstrapCheckpointPath)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to initialize checkpoint manager: %+v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// podManager is also responsible for keeping secretManager and configMapManager contents up-to-date.
|
||||
mirrorPodClient := kubepod.NewBasicMirrorClient(klet.kubeClient, string(nodeName), nodeLister)
|
||||
klet.podManager = kubepod.NewBasicPodManager(mirrorPodClient, secretManager, configMapManager, checkpointManager)
|
||||
klet.podManager = kubepod.NewBasicPodManager(mirrorPodClient, secretManager, configMapManager)
|
||||
|
||||
klet.statusManager = status.NewManager(klet.kubeClient, klet.podManager, klet)
|
||||
|
||||
@@ -1855,28 +1833,15 @@ func (kl *Kubelet) syncLoopIteration(configCh <-chan kubetypes.PodUpdate, handle
|
||||
klog.V(2).Infof("SyncLoop (DELETE, %q): %q", u.Source, format.Pods(u.Pods))
|
||||
// DELETE is treated as a UPDATE because of graceful deletion.
|
||||
handler.HandlePodUpdates(u.Pods)
|
||||
case kubetypes.RESTORE:
|
||||
klog.V(2).Infof("SyncLoop (RESTORE, %q): %q", u.Source, format.Pods(u.Pods))
|
||||
// These are pods restored from the checkpoint. Treat them as new
|
||||
// pods.
|
||||
handler.HandlePodAdditions(u.Pods)
|
||||
case kubetypes.SET:
|
||||
// TODO: Do we want to support this?
|
||||
klog.Errorf("Kubelet does not support snapshot update")
|
||||
default:
|
||||
klog.Errorf("Invalid event type received: %d.", u.Op)
|
||||
}
|
||||
|
||||
if u.Op != kubetypes.RESTORE {
|
||||
// If the update type is RESTORE, it means that the update is from
|
||||
// the pod checkpoints and may be incomplete. Do not mark the
|
||||
// source as ready.
|
||||
kl.sourcesReady.AddSource(u.Source)
|
||||
|
||||
// Mark the source ready after receiving at least one update from the
|
||||
// source. Once all the sources are marked ready, various cleanup
|
||||
// routines will start reclaiming resources. It is important that this
|
||||
// takes place only after kubelet calls the update handler to process
|
||||
// the update to ensure the internal pod cache is up-to-date.
|
||||
kl.sourcesReady.AddSource(u.Source)
|
||||
}
|
||||
case e := <-plegCh:
|
||||
if isSyncPodWorthy(e) {
|
||||
// PLEG event for a pod; sync it.
|
||||
|
Reference in New Issue
Block a user