mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-19 17:16:12 +00:00
adding support for kubemark --node-labels flag
This commit is contained in:
@@ -134,15 +134,19 @@ func (hk *HollowKubelet) Run() {
|
||||
select {}
|
||||
}
|
||||
|
||||
// HollowKubletOptions contains settable parameters for hollow kubelet.
|
||||
type HollowKubletOptions struct {
|
||||
NodeName string
|
||||
KubeletPort int
|
||||
KubeletReadOnlyPort int
|
||||
MaxPods int
|
||||
PodsPerCore int
|
||||
NodeLabels map[string]string
|
||||
}
|
||||
|
||||
// Builds a KubeletConfiguration for the HollowKubelet, ensuring that the
|
||||
// usual defaults are applied for fields we do not override.
|
||||
func GetHollowKubeletConfig(
|
||||
nodeName string,
|
||||
kubeletPort int,
|
||||
kubeletReadOnlyPort int,
|
||||
maxPods int,
|
||||
podsPerCore int) (*options.KubeletFlags, *kubeletconfig.KubeletConfiguration) {
|
||||
|
||||
func GetHollowKubeletConfig(opt *HollowKubletOptions) (*options.KubeletFlags, *kubeletconfig.KubeletConfiguration) {
|
||||
testRootDir := utils.MakeTempDirOrDie("hollow-kubelet.", "")
|
||||
podFilePath := utils.MakeTempDirOrDie("static-pods", testRootDir)
|
||||
klog.Infof("Using %s as root dir for hollow-kubelet", testRootDir)
|
||||
@@ -151,13 +155,13 @@ func GetHollowKubeletConfig(
|
||||
f := options.NewKubeletFlags()
|
||||
f.EnableServer = true
|
||||
f.RootDirectory = testRootDir
|
||||
f.HostnameOverride = nodeName
|
||||
f.HostnameOverride = opt.NodeName
|
||||
f.MinimumGCAge = metav1.Duration{Duration: 1 * time.Minute}
|
||||
f.MaxContainerCount = 100
|
||||
f.MaxPerPodContainerCount = 2
|
||||
f.RegisterNode = true
|
||||
f.RegisterSchedulable = true
|
||||
f.ProviderID = fmt.Sprintf("kubemark://%v", nodeName)
|
||||
f.ProviderID = fmt.Sprintf("kubemark://%v", opt.NodeName)
|
||||
|
||||
// Config struct
|
||||
c, err := options.NewKubeletConfiguration()
|
||||
@@ -167,8 +171,8 @@ func GetHollowKubeletConfig(
|
||||
|
||||
c.StaticPodURL = ""
|
||||
c.Address = "0.0.0.0" /* bind address */
|
||||
c.Port = int32(kubeletPort)
|
||||
c.ReadOnlyPort = int32(kubeletReadOnlyPort)
|
||||
c.Port = int32(opt.KubeletPort)
|
||||
c.ReadOnlyPort = int32(opt.KubeletReadOnlyPort)
|
||||
c.StaticPodPath = podFilePath
|
||||
c.FileCheckFrequency.Duration = 20 * time.Second
|
||||
c.HTTPCheckFrequency.Duration = 20 * time.Second
|
||||
@@ -176,8 +180,8 @@ func GetHollowKubeletConfig(
|
||||
c.NodeStatusReportFrequency.Duration = time.Minute
|
||||
c.SyncFrequency.Duration = 10 * time.Second
|
||||
c.EvictionPressureTransitionPeriod.Duration = 5 * time.Minute
|
||||
c.MaxPods = int32(maxPods)
|
||||
c.PodsPerCore = int32(podsPerCore)
|
||||
c.MaxPods = int32(opt.MaxPods)
|
||||
c.PodsPerCore = int32(opt.PodsPerCore)
|
||||
c.ClusterDNS = []string{}
|
||||
c.ImageGCHighThresholdPercent = 90
|
||||
c.ImageGCLowThresholdPercent = 80
|
||||
|
Reference in New Issue
Block a user