Skip to content

Commit

Permalink
Merge pull request kubernetes#94471 from kshitijcode/kubelet-taint-fi…
Browse files Browse the repository at this point in the history
…x-93608

Added support for register-with-taints setting kubernetes#93608
  • Loading branch information
k8s-ci-robot committed Sep 7, 2020
2 parents c06bc2f + e4dee9c commit 4e9bdd4
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cmd/kubemark/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ go_library(
importpath = "k8s.io/kubernetes/cmd/kubemark",
deps = [
"//pkg/api/legacyscheme:go_default_library",
"//pkg/apis/core:go_default_library",
"//pkg/cluster/ports:go_default_library",
"//pkg/kubelet/cadvisor/testing:go_default_library",
"//pkg/kubelet/cm:go_default_library",
Expand All @@ -25,6 +26,7 @@ go_library(
"//pkg/kubemark:go_default_library",
"//pkg/util/iptables/testing:go_default_library",
"//pkg/util/sysctl/testing:go_default_library",
"//pkg/util/taints:go_default_library",
"//staging/src/k8s.io/api/core/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/util/sets:go_default_library",
"//staging/src/k8s.io/client-go/kubernetes:go_default_library",
Expand Down
5 changes: 5 additions & 0 deletions cmd/kubemark/hollow-node.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import (
"k8s.io/component-base/version"
"k8s.io/component-base/version/verflag"
"k8s.io/kubernetes/pkg/api/legacyscheme"
"k8s.io/kubernetes/pkg/apis/core"
"k8s.io/kubernetes/pkg/cluster/ports"
cadvisortest "k8s.io/kubernetes/pkg/kubelet/cadvisor/testing"
"k8s.io/kubernetes/pkg/kubelet/cm"
Expand All @@ -49,6 +50,7 @@ import (
"k8s.io/kubernetes/pkg/kubemark"
fakeiptables "k8s.io/kubernetes/pkg/util/iptables/testing"
fakesysctl "k8s.io/kubernetes/pkg/util/sysctl/testing"
utiltaints "k8s.io/kubernetes/pkg/util/taints"
fakeexec "k8s.io/utils/exec/testing"
)

Expand All @@ -64,6 +66,7 @@ type hollowNodeConfig struct {
ProxierSyncPeriod time.Duration
ProxierMinSyncPeriod time.Duration
NodeLabels map[string]string
RegisterWithTaints []core.Taint
}

const (
Expand All @@ -88,6 +91,7 @@ func (c *hollowNodeConfig) addFlags(fs *pflag.FlagSet) {
fs.DurationVar(&c.ProxierMinSyncPeriod, "proxier-min-sync-period", 0, "Minimum period that proxy rules are refreshed in hollow-proxy.")
bindableNodeLabels := cliflag.ConfigurationMap(c.NodeLabels)
fs.Var(&bindableNodeLabels, "node-labels", "Additional node labels")
fs.Var(utiltaints.NewTaintsVar(&c.RegisterWithTaints), "register-with-taints", "Register the node with the given list of taints (comma separated \"<key>=<value>:<effect>\"). No-op if register-node is false.")
}

func (c *hollowNodeConfig) createClientConfigFromFile() (*restclient.Config, error) {
Expand All @@ -113,6 +117,7 @@ func (c *hollowNodeConfig) createHollowKubeletOptions() *kubemark.HollowKubletOp
MaxPods: maxPods,
PodsPerCore: podsPerCore,
NodeLabels: c.NodeLabels,
RegisterWithTaints: c.RegisterWithTaints,
}
}

Expand Down
1 change: 1 addition & 0 deletions pkg/kubemark/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ go_library(
"//cmd/kube-proxy/app:go_default_library",
"//cmd/kubelet/app:go_default_library",
"//cmd/kubelet/app/options:go_default_library",
"//pkg/apis/core:go_default_library",
"//pkg/kubelet:go_default_library",
"//pkg/kubelet/apis/config:go_default_library",
"//pkg/kubelet/cadvisor:go_default_library",
Expand Down
3 changes: 3 additions & 0 deletions pkg/kubemark/hollow_kubelet.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ 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"
Expand Down Expand Up @@ -144,6 +145,7 @@ type HollowKubletOptions struct {
MaxPods int
PodsPerCore int
NodeLabels map[string]string
RegisterWithTaints []core.Taint
}

// Builds a KubeletConfiguration for the HollowKubelet, ensuring that the
Expand All @@ -164,6 +166,7 @@ func GetHollowKubeletConfig(opt *HollowKubletOptions) (*options.KubeletFlags, *k
f.ContainerRuntimeOptions.ContainerRuntime = kubetypes.RemoteContainerRuntime
f.RegisterNode = true
f.RegisterSchedulable = true
f.RegisterWithTaints = opt.RegisterWithTaints

// Config struct
c, err := options.NewKubeletConfiguration()
Expand Down

0 comments on commit 4e9bdd4

Please sign in to comment.