refactor: openpitrix module

Signed-off-by: hongming <talonwan@yunify.com>
This commit is contained in:
hongming
2019-09-25 14:07:15 +08:00
parent d0dc66cf28
commit 1b5681c12b
314 changed files with 72092 additions and 25762 deletions

View File

@@ -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