migrate --register-with-taints to KubeletConfiguration

This commit is contained in:
caozhiyuan
2021-10-04 09:17:10 +08:00
parent c84da4e3e6
commit bad4faf1b9
23 changed files with 260 additions and 149 deletions

View File

@@ -20,6 +20,7 @@ import (
"fmt"
"time"
v1 "k8s.io/api/core/v1"
"k8s.io/klog/v2"
"k8s.io/mount-utils"
@@ -28,7 +29,6 @@ import (
internalapi "k8s.io/cri-api/pkg/apis"
kubeletapp "k8s.io/kubernetes/cmd/kubelet/app"
"k8s.io/kubernetes/cmd/kubelet/app/options"
"k8s.io/kubernetes/pkg/apis/core"
"k8s.io/kubernetes/pkg/kubelet"
kubeletconfig "k8s.io/kubernetes/pkg/kubelet/apis/config"
"k8s.io/kubernetes/pkg/kubelet/cadvisor"
@@ -143,7 +143,7 @@ type HollowKubletOptions struct {
MaxPods int
PodsPerCore int
NodeLabels map[string]string
RegisterWithTaints []core.Taint
RegisterWithTaints []v1.Taint
}
// Builds a KubeletConfiguration for the HollowKubelet, ensuring that the
@@ -162,9 +162,7 @@ func GetHollowKubeletConfig(opt *HollowKubletOptions) (*options.KubeletFlags, *k
f.MaxPerPodContainerCount = 2
f.NodeLabels = opt.NodeLabels
f.ContainerRuntimeOptions.ContainerRuntime = kubetypes.RemoteContainerRuntime
f.RegisterNode = true
f.RegisterSchedulable = true
f.RegisterWithTaints = opt.RegisterWithTaints
f.RemoteImageEndpoint = "unix:///run/containerd/containerd.sock"
// Config struct
@@ -209,6 +207,8 @@ func GetHollowKubeletConfig(opt *HollowKubletOptions) (*options.KubeletFlags, *k
c.SerializeImagePulls = true
c.SystemCgroups = ""
c.ProtectKernelDefaults = false
c.RegisterWithTaints = opt.RegisterWithTaints
c.RegisterNode = true
return f, c
}