[cloud-controller manager]get rid of GenericControllerManagerOptions sub-struct

This commit is contained in:
stewart-yu
2018-05-16 15:48:32 +08:00
parent f47f515600
commit 2a8d258f66
4 changed files with 278 additions and 281 deletions

View File

@@ -33,6 +33,22 @@ type GenericComponentConfigOptions struct {
LeaderElection componentconfig.LeaderElectionConfiguration
}
// NewGenericComponentConfigOptions returns generic configuration default values for both
// the kube-controller-manager and the cloud-contoller-manager. Any common changes should
// be made here. Any individual changes should be made in that controller.
func NewGenericComponentConfigOptions(cfg componentconfig.GenericComponentConfiguration) *GenericComponentConfigOptions {
o := &GenericComponentConfigOptions{
MinResyncPeriod: cfg.MinResyncPeriod,
ContentType: cfg.ContentType,
KubeAPIQPS: cfg.KubeAPIQPS,
KubeAPIBurst: cfg.KubeAPIBurst,
ControllerStartInterval: cfg.ControllerStartInterval,
LeaderElection: cfg.LeaderElection,
}
return o
}
// AddFlags adds flags related to generic for controller manager to the specified FlagSet.
func (o *GenericComponentConfigOptions) AddFlags(fs *pflag.FlagSet) {
if o == nil {

View File

@@ -40,6 +40,22 @@ type KubeCloudSharedOptions struct {
NodeSyncPeriod metav1.Duration
}
// NewKubeCloudSharedOptions returns common/default configuration values for both
// the kube-controller-manager and the cloud-contoller-manager. Any common changes should
// be made here. Any individual changes should be made in that controller.
func NewKubeCloudSharedOptions(cfg componentconfig.KubeCloudSharedConfiguration) *KubeCloudSharedOptions {
o := &KubeCloudSharedOptions{
Port: cfg.Port,
Address: cfg.Address,
RouteReconciliationPeriod: cfg.RouteReconciliationPeriod,
NodeMonitorPeriod: cfg.NodeMonitorPeriod,
ClusterName: cfg.ClusterName,
ConfigureCloudRoutes: cfg.ConfigureCloudRoutes,
}
return o
}
// AddFlags adds flags related to shared variable for controller manager to the specified FlagSet.
func (o *KubeCloudSharedOptions) AddFlags(fs *pflag.FlagSet) {
if o == nil {