mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 04:08:16 +00:00 
			
		
		
		
	Merge pull request #60654 from dcbw/kubelet-notify-systemd
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. kubelet: notify systemd that kubelet has started This call has no side-effects if systemd is not used or not installed. Fixes: https://github.com/kubernetes/kubernetes/issues/59079 @smarterclayton @sjenning ```release-note kubelet now notifies systemd that it has finished starting, if systemd is available and running. ```
This commit is contained in:
		@@ -131,6 +131,7 @@ go_library(
 | 
			
		||||
        "//pkg/volume/secret:go_default_library",
 | 
			
		||||
        "//pkg/volume/storageos:go_default_library",
 | 
			
		||||
        "//pkg/volume/vsphere_volume:go_default_library",
 | 
			
		||||
        "//vendor/github.com/coreos/go-systemd/daemon:go_default_library",
 | 
			
		||||
        "//vendor/github.com/golang/glog:go_default_library",
 | 
			
		||||
        "//vendor/github.com/spf13/cobra:go_default_library",
 | 
			
		||||
        "//vendor/github.com/spf13/pflag:go_default_library",
 | 
			
		||||
 
 | 
			
		||||
@@ -31,8 +31,10 @@ import (
 | 
			
		||||
	"path"
 | 
			
		||||
	"path/filepath"
 | 
			
		||||
	"strconv"
 | 
			
		||||
	"sync"
 | 
			
		||||
	"time"
 | 
			
		||||
 | 
			
		||||
	"github.com/coreos/go-systemd/daemon"
 | 
			
		||||
	"github.com/golang/glog"
 | 
			
		||||
	"github.com/spf13/cobra"
 | 
			
		||||
	"github.com/spf13/pflag"
 | 
			
		||||
@@ -697,6 +699,9 @@ func run(s *options.KubeletServer, kubeDeps *kubelet.Dependencies) (err error) {
 | 
			
		||||
		return nil
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// If systemd is used, notify it that we have started
 | 
			
		||||
	go daemon.SdNotify(false, "READY=1")
 | 
			
		||||
 | 
			
		||||
	<-done
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
@@ -937,20 +942,31 @@ func RunKubelet(kubeFlags *options.KubeletFlags, kubeCfg *kubeletconfiginternal.
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func startKubelet(k kubelet.Bootstrap, podCfg *config.PodConfig, kubeCfg *kubeletconfiginternal.KubeletConfiguration, kubeDeps *kubelet.Dependencies, enableServer bool) {
 | 
			
		||||
	wg := sync.WaitGroup{}
 | 
			
		||||
 | 
			
		||||
	// start the kubelet
 | 
			
		||||
	go wait.Until(func() { k.Run(podCfg.Updates()) }, 0, wait.NeverStop)
 | 
			
		||||
	wg.Add(1)
 | 
			
		||||
	go wait.Until(func() {
 | 
			
		||||
		wg.Done()
 | 
			
		||||
		k.Run(podCfg.Updates())
 | 
			
		||||
	}, 0, wait.NeverStop)
 | 
			
		||||
 | 
			
		||||
	// start the kubelet server
 | 
			
		||||
	if enableServer {
 | 
			
		||||
		wg.Add(1)
 | 
			
		||||
		go wait.Until(func() {
 | 
			
		||||
			wg.Done()
 | 
			
		||||
			k.ListenAndServe(net.ParseIP(kubeCfg.Address), uint(kubeCfg.Port), kubeDeps.TLSOptions, kubeDeps.Auth, kubeCfg.EnableDebuggingHandlers, kubeCfg.EnableContentionProfiling)
 | 
			
		||||
		}, 0, wait.NeverStop)
 | 
			
		||||
	}
 | 
			
		||||
	if kubeCfg.ReadOnlyPort > 0 {
 | 
			
		||||
		wg.Add(1)
 | 
			
		||||
		go wait.Until(func() {
 | 
			
		||||
			wg.Done()
 | 
			
		||||
			k.ListenAndServeReadOnly(net.ParseIP(kubeCfg.Address), uint(kubeCfg.ReadOnlyPort))
 | 
			
		||||
		}, 0, wait.NeverStop)
 | 
			
		||||
	}
 | 
			
		||||
	wg.Wait()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func CreateAndInitKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user