1- From 16262f01a972ef4f2f88c5953e8114106e834351 Mon Sep 17 00:00:00 2001
1+ From ae9147faf2e2ad7142702d2fa5d821a9efdff85e Mon Sep 17 00:00:00 2001
22From: Konstantinos Tsakalozos <kos.tsakalozos@canonical.com>
33Date: Wed, 3 Mar 2021 18:19:37 +0200
44Subject: [PATCH] Kubelite integration
55
66---
77 cmd/kube-apiserver/app/server.go | 9 ++--
88 cmd/kube-scheduler/app/server.go | 6 ++-
9- cmd/kubelet/app/server.go | 11 ++--
9+ cmd/kubelet/app/server.go | 13 + ++--
1010 cmd/kubelite/app/daemons/daemon.go | 84 +++++++++++++++++++++++++++++
1111 cmd/kubelite/app/options/options.go | 79 +++++++++++++++++++++++++++
1212 cmd/kubelite/app/server.go | 79 +++++++++++++++++++++++++++
1313 cmd/kubelite/kubelite.go | 28 ++++++++++
1414 pkg/volume/csi/csi_plugin.go | 10 ++--
15- 8 files changed, 296 insertions(+), 10 deletions(-)
15+ 8 files changed, 296 insertions(+), 12 deletions(-)
1616 create mode 100644 cmd/kubelite/app/daemons/daemon.go
1717 create mode 100644 cmd/kubelite/app/options/options.go
1818 create mode 100644 cmd/kubelite/app/server.go
1919 create mode 100644 cmd/kubelite/kubelite.go
2020
2121diff --git a/cmd/kube-apiserver/app/server.go b/cmd/kube-apiserver/app/server.go
22- index 0887d9124ba..c7ece2136a1 100644
22+ index aa2995428ba..9cc861190d5 100644
2323--- a/cmd/kube-apiserver/app/server.go
2424+++ b/cmd/kube-apiserver/app/server.go
25- @@ -86 ,7 +86 ,7 @@ func init() {
25+ @@ -87 ,7 +87 ,7 @@ func init() {
2626 }
2727
2828 // NewAPIServerCommand creates a *cobra.Command object with default parameters
@@ -31,7 +31,7 @@ index 0887d9124ba..c7ece2136a1 100644
3131 s := options.NewServerRunOptions()
3232 cmd := &cobra.Command{
3333 Use: "kube-apiserver",
34- @@ -124 ,8 +124 ,11 @@ cluster's shared state through which all other components interact.`,
34+ @@ -125 ,8 +125 ,11 @@ cluster's shared state through which all other components interact.`,
3535 if errs := completedOptions.Validate(); len(errs) != 0 {
3636 return utilerrors.NewAggregate(errs)
3737 }
@@ -46,10 +46,10 @@ index 0887d9124ba..c7ece2136a1 100644
4646 Args: func(cmd *cobra.Command, args []string) error {
4747 for _, arg := range args {
4848diff --git a/cmd/kube-scheduler/app/server.go b/cmd/kube-scheduler/app/server.go
49- index e6bda61b6e6..049b52fefaa 100644
49+ index c352ba664d0..54177aa117d 100644
5050--- a/cmd/kube-scheduler/app/server.go
5151+++ b/cmd/kube-scheduler/app/server.go
52- @@ -128 ,7 +128 ,11 @@ func runCommand(cmd *cobra.Command, opts *options.Options, registryOptions ...Op
52+ @@ -129 ,7 +129 ,11 @@ func runCommand(cmd *cobra.Command, opts *options.Options, registryOptions ...Op
5353 ctx, cancel := context.WithCancel(context.Background())
5454 defer cancel()
5555 go func() {
@@ -63,10 +63,10 @@ index e6bda61b6e6..049b52fefaa 100644
6363 cancel()
6464 }()
6565diff --git a/cmd/kubelet/app/server.go b/cmd/kubelet/app/server.go
66- index 86c73b030d5..efeb017e92f 100644
66+ index 6d064326ec7..98d99d828e5 100644
6767--- a/cmd/kubelet/app/server.go
6868+++ b/cmd/kubelet/app/server.go
69- @@ -114 ,7 +114 ,7 @@ const (
69+ @@ -116 ,7 +116 ,7 @@ const (
7070 )
7171
7272 // NewKubeletCommand creates a *cobra.Command object with default parameters
@@ -75,11 +75,10 @@ index 86c73b030d5..efeb017e92f 100644
7575 cleanFlagSet := pflag.NewFlagSet(componentKubelet, pflag.ContinueOnError)
7676 cleanFlagSet.SetNormalizeFunc(cliflag.WordSepNormalizeFunc)
7777 kubeletFlags := options.NewKubeletFlags()
78- @@ -253,7 +253,12 @@ HTTP server: The kubelet can also listen for HTTP and respond to a simple API
78+ @@ -253,6 +253,12 @@ HTTP server: The kubelet can also listen for HTTP and respond to a simple API
79+ if err := checkPermissions(); err != nil {
7980 klog.ErrorS(err, "kubelet running with insufficient permissions")
8081 }
81- // set up signal context here in order to be reused by kubelet and docker shim
82- - ctx := genericapiserver.SetupSignalContext()
8382+ runctx := context.Background()
8483+ if len(ctx) == 0 {
8584+ runctx = genericapiserver.SetupSignalContext()
@@ -89,9 +88,13 @@ index 86c73b030d5..efeb017e92f 100644
8988
9089 // make the kubelet's config safe for logging
9190 config := kubeletServer.KubeletConfiguration.DeepCopy()
92- @@ -264,7 +269,7 @@ HTTP server: The kubelet can also listen for HTTP and respond to a simple API
91+ @@ -262,11 +268,8 @@ HTTP server: The kubelet can also listen for HTTP and respond to a simple API
92+ // log the kubelet's config for inspection
9393 klog.V(5).InfoS("KubeletConfiguration", "configuration", config)
9494
95+ - // set up signal context for kubelet shutdown
96+ - ctx := genericapiserver.SetupSignalContext()
97+ -
9598 // run the kubelet
9699- return Run(ctx, kubeletServer, kubeletDeps, utilfeature.DefaultFeatureGate)
97100+ return Run(runctx, kubeletServer, kubeletDeps, utilfeature.DefaultFeatureGate)
@@ -394,23 +397,21 @@ index 00000000000..667b24f68e6
394397+ println("Stopping kubelite")
395398+ }
396399diff --git a/pkg/volume/csi/csi_plugin.go b/pkg/volume/csi/csi_plugin.go
397- index 3b0a5773e58..6da5e3d4ea1 100644
400+ index 592aaaeaaf6..4a47b4d87a3 100644
398401--- a/pkg/volume/csi/csi_plugin.go
399402+++ b/pkg/volume/csi/csi_plugin.go
400- @@ -243,20 +243,24 @@ func (p *csiPlugin) Init(host volume.VolumeHost) error {
403+ @@ -243,18 +243,22 @@ func (p *csiPlugin) Init(host volume.VolumeHost) error {
401404 }
402405
403406 // Initializing the label management channels
404407- nim = nodeinfomanager.NewNodeInfoManager(host.GetNodeName(), host, migratedPlugins)
405408+ localNim := nodeinfomanager.NewNodeInfoManager(host.GetNodeName(), host, migratedPlugins)
406409
407- if utilfeature.DefaultFeatureGate.Enabled(features.CSIMigration) {
408- // This function prevents Kubelet from posting Ready status until CSINode
409- // is both installed and initialized
410- - if err := initializeCSINode(host); err != nil {
411- + if err := initializeCSINode(host, localNim); err != nil {
412- return errors.New(log("failed to initialize CSINode: %v", err))
413- }
410+ // This function prevents Kubelet from posting Ready status until CSINode
411+ // is both installed and initialized
412+ - if err := initializeCSINode(host); err != nil {
413+ + if err := initializeCSINode(host, localNim); err != nil {
414+ return errors.New(log("failed to initialize CSINode: %v", err))
414415 }
415416
416417+ if _, ok := host.(volume.KubeletVolumeHost); ok {
0 commit comments