...
1
16
17 package options
18
19 import (
20 "fmt"
21
22 "github.com/spf13/pflag"
23
24 "k8s.io/kubernetes/cmd/kube-controller-manager/names"
25 nodelifecycleconfig "k8s.io/kubernetes/pkg/controller/nodelifecycle/config"
26 )
27
28
29 type NodeLifecycleControllerOptions struct {
30 *nodelifecycleconfig.NodeLifecycleControllerConfiguration
31 }
32
33
34 func (o *NodeLifecycleControllerOptions) AddFlags(fs *pflag.FlagSet) {
35 if o == nil {
36 return
37 }
38
39 fs.DurationVar(&o.NodeStartupGracePeriod.Duration, "node-startup-grace-period", o.NodeStartupGracePeriod.Duration,
40 "Amount of time which we allow starting Node to be unresponsive before marking it unhealthy.")
41 fs.DurationVar(&o.NodeMonitorGracePeriod.Duration, "node-monitor-grace-period", o.NodeMonitorGracePeriod.Duration,
42 "Amount of time which we allow running Node to be unresponsive before marking it unhealthy. "+
43 "Must be N times more than kubelet's nodeStatusUpdateFrequency, "+
44 "where N means number of retries allowed for kubelet to post node status.")
45 fs.Float32Var(&o.NodeEvictionRate, "node-eviction-rate", 0.1, "Number of nodes per second on which pods are deleted in case of node failure when a zone is healthy (see --unhealthy-zone-threshold for definition of healthy/unhealthy). Zone refers to entire cluster in non-multizone clusters.")
46 fs.Float32Var(&o.SecondaryNodeEvictionRate, "secondary-node-eviction-rate", 0.01, "Number of nodes per second on which pods are deleted in case of node failure when a zone is unhealthy (see --unhealthy-zone-threshold for definition of healthy/unhealthy). Zone refers to entire cluster in non-multizone clusters. This value is implicitly overridden to 0 if the cluster size is smaller than --large-cluster-size-threshold.")
47 fs.Int32Var(&o.LargeClusterSizeThreshold, "large-cluster-size-threshold", 50, fmt.Sprintf("Number of nodes from which %s treats the cluster as large for the eviction logic purposes. --secondary-node-eviction-rate is implicitly overridden to 0 for clusters this size or smaller. Notice: If nodes reside in multiple zones, this threshold will be considered as zone node size threshold for each zone to determine node eviction rate independently.", names.NodeLifecycleController))
48 fs.Float32Var(&o.UnhealthyZoneThreshold, "unhealthy-zone-threshold", 0.55, "Fraction of Nodes in a zone which needs to be not Ready (minimum 3) for zone to be treated as unhealthy. ")
49 }
50
51
52 func (o *NodeLifecycleControllerOptions) ApplyTo(cfg *nodelifecycleconfig.NodeLifecycleControllerConfiguration) error {
53 if o == nil {
54 return nil
55 }
56
57 cfg.NodeStartupGracePeriod = o.NodeStartupGracePeriod
58 cfg.NodeMonitorGracePeriod = o.NodeMonitorGracePeriod
59 cfg.NodeEvictionRate = o.NodeEvictionRate
60 cfg.SecondaryNodeEvictionRate = o.SecondaryNodeEvictionRate
61 cfg.LargeClusterSizeThreshold = o.LargeClusterSizeThreshold
62 cfg.UnhealthyZoneThreshold = o.UnhealthyZoneThreshold
63
64 return nil
65 }
66
67
68 func (o *NodeLifecycleControllerOptions) Validate() []error {
69 if o == nil {
70 return nil
71 }
72
73 errs := []error{}
74 return errs
75 }
76
View as plain text