refactor: openpitrix module
Signed-off-by: hongming <talonwan@yunify.com>
This commit is contained in:
@@ -49,10 +49,7 @@ func NewControllerManagerCommand() *cobra.Command {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
err = Complete(s)
|
||||
if err != nil {
|
||||
os.Exit(1)
|
||||
}
|
||||
s = Complete(s)
|
||||
|
||||
if errs := s.Validate(); len(errs) != 0 {
|
||||
klog.Error(utilerrors.NewAggregate(errs))
|
||||
@@ -81,22 +78,24 @@ func NewControllerManagerCommand() *cobra.Command {
|
||||
return cmd
|
||||
}
|
||||
|
||||
func Complete(s *options.KubeSphereControllerManagerOptions) error {
|
||||
func Complete(s *options.KubeSphereControllerManagerOptions) *options.KubeSphereControllerManagerOptions {
|
||||
conf := controllerconfig.Get()
|
||||
|
||||
conf.Apply(&controllerconfig.Config{
|
||||
DevopsOptions: s.DevopsOptions,
|
||||
KubernetesOptions: s.KubernetesOptions,
|
||||
S3Options: s.S3Options,
|
||||
OpenPitrixOptions: s.OpenPitrixOptions,
|
||||
})
|
||||
|
||||
s = &options.KubeSphereControllerManagerOptions{
|
||||
out := &options.KubeSphereControllerManagerOptions{
|
||||
KubernetesOptions: conf.KubernetesOptions,
|
||||
DevopsOptions: conf.DevopsOptions,
|
||||
S3Options: conf.S3Options,
|
||||
OpenPitrixOptions: conf.OpenPitrixOptions,
|
||||
}
|
||||
|
||||
return nil
|
||||
return out
|
||||
}
|
||||
|
||||
func CreateClientSet(s *options.KubeSphereControllerManagerOptions, stopCh <-chan struct{}) error {
|
||||
@@ -104,7 +103,8 @@ func CreateClientSet(s *options.KubeSphereControllerManagerOptions, stopCh <-cha
|
||||
|
||||
csop.SetKubernetesOptions(s.KubernetesOptions).
|
||||
SetDevopsOptions(s.DevopsOptions).
|
||||
SetS3Options(s.S3Options)
|
||||
SetS3Options(s.S3Options).
|
||||
SetOpenPitrixOptions(s.OpenPitrixOptions)
|
||||
client.NewClientSetFactory(csop, stopCh)
|
||||
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user