// CMServer is the mail context object for the controller manager.
typeCMServerstruct{
Portint
Addressutil.IP
ClientConfigclient.Config
CloudProviderstring
CloudConfigFilestring
MinionRegexpstring
NodeSyncPeriodtime.Duration
ResourceQuotaSyncPeriodtime.Duration
RegisterRetryCountint
MachineListutil.StringList
// TODO: Discover these by pinging the host machines, and rip out these params.
NodeMilliCPUint64
NodeMemoryresource.Quantity
KubeletConfigclient.KubeletConfig
}
// NewCMServer creates a new CMServer with default a default config.
funcNewCMServer()*CMServer{
s:=CMServer{
Port:ports.ControllerManagerPort,
Address:util.IP(net.ParseIP("127.0.0.1")),
NodeSyncPeriod:10*time.Second,
ResourceQuotaSyncPeriod:10*time.Second,
RegisterRetryCount:10,
NodeMilliCPU:1000,
NodeMemory:resource.MustParse("3Gi"),
KubeletConfig:client.KubeletConfig{
Port:ports.KubeletPort,
EnableHttps:false,
},
}
return&s
}
// NewHyperkubeServer creates a new hyperkube Server object that includes the
// description and flags.
funcNewHyperkubeServer()*hyperkube.Server{
s:=NewCMServer()
hks:=hyperkube.Server{
SimpleUsage:"controller-manager",
Long:"A server that runs a set of active components. This includes replication controllers, service endpoints and nodes.",
Run:func(_*hyperkube.Server,args[]string)error{
returns.Run(args)
},
}
s.AddFlags(hks.Flags())
return&hks
}
// AddFlags adds flags for a specific CMServer to the specified FlagSet
func(s*CMServer)AddFlags(fs*pflag.FlagSet){
fs.IntVar(&s.Port,"port",s.Port,"The port that the controller-manager's http service runs on")
fs.Var(&s.Address,"address","The IP address to serve on (set to 0.0.0.0 for all interfaces)")
client.BindClientConfigFlags(fs,&s.ClientConfig)
fs.StringVar(&s.CloudProvider,"cloud_provider",s.CloudProvider,"The provider for cloud services. Empty string for no provider.")
fs.StringVar(&s.CloudConfigFile,"cloud_config",s.CloudConfigFile,"The path to the cloud provider configuration file. Empty string for no configuration file.")
fs.StringVar(&s.MinionRegexp,"minion_regexp",s.MinionRegexp,"If non empty, and -cloud_provider is specified, a regular expression for matching minion VMs.")
"The period for syncing nodes from cloudprovider. Longer periods will result in "+
"fewer calls to cloud provider, but may delay addition of new nodes to cluster.")
fs.DurationVar(&s.ResourceQuotaSyncPeriod,"resource_quota_sync_period",s.ResourceQuotaSyncPeriod,"The period for syncing quota usage status in the system")