Merge pull request #3581 from yanggangtony/operator

operator cleanup
This commit is contained in:
karmada-bot 2023-05-29 09:14:17 +08:00 committed by GitHub
commit c08d6dc145
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 21 deletions

View File

@ -73,9 +73,9 @@ func (o *Options) AddFlags(fs *pflag.FlagSet, allControllers []string, disabledB
fs.Int32Var(&o.KubeAPIBurst, "kube-api-burst", o.KubeAPIBurst, "Burst to use while talking with kubernetes apiserver.") fs.Int32Var(&o.KubeAPIBurst, "kube-api-burst", o.KubeAPIBurst, "Burst to use while talking with kubernetes apiserver.")
fs.StringSliceVar(&o.Controllers, "controllers", o.Controllers, fmt.Sprintf(""+ fs.StringSliceVar(&o.Controllers, "controllers", o.Controllers, fmt.Sprintf(""+
"A list of controllers to enable. '*' enables all on-by-default controllers, 'foo' enables the controller "+ "A list of controllers to enable. '*' enables all on-by-default controllers, 'foo' enables the controller "+
"named 'foo', '-foo' disables the controller named 'foo'.\nAll controllers: %s\nDisabled-by-default controllers: %s", "named 'foo', '-foo' disables the controller named 'foo'.\nAll controllers: %s .\nDisabled-by-default controllers: %s .",
strings.Join(allControllers, ", "), strings.Join(disabledByDefaultControllers, ", "))) strings.Join(allControllers, ", "), strings.Join(disabledByDefaultControllers, ", ")))
fs.IntVar(&o.ConcurrentKarmadaSyncs, "concurrent-karmada-syncs", o.ConcurrentKarmadaSyncs, "The number of karmada objects that are allowed to sync concurrently..") fs.IntVar(&o.ConcurrentKarmadaSyncs, "concurrent-karmada-syncs", o.ConcurrentKarmadaSyncs, "The number of karmada objects that are allowed to sync concurrently.")
options.BindLeaderElectionFlags(&o.LeaderElection, fs) options.BindLeaderElectionFlags(&o.LeaderElection, fs)
} }

View File

@ -16,11 +16,6 @@ spec:
selector: selector:
matchLabels: matchLabels:
karmada-app: kube-controller-manager karmada-app: kube-controller-manager
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
type: RollingUpdate
template: template:
metadata: metadata:
labels: labels:

View File

@ -22,7 +22,7 @@ type DeInitOptions struct {
} }
// DeInitOpt defines a type of function to set DeInitOptions values. // DeInitOpt defines a type of function to set DeInitOptions values.
type DeInitOpt func(opt *DeInitOptions) type DeInitOpt func(o *DeInitOptions)
var _ tasks.DeInitData = &deInitData{} var _ tasks.DeInitData = &deInitData{}
@ -103,19 +103,19 @@ func defaultJobDeInitOptions() *DeInitOptions {
// NewDeInitOptWithKarmada returns a DeInitOpt function to initialize DeInitOptions with karmada resource // NewDeInitOptWithKarmada returns a DeInitOpt function to initialize DeInitOptions with karmada resource
func NewDeInitOptWithKarmada(karmada *operatorv1alpha1.Karmada) DeInitOpt { func NewDeInitOptWithKarmada(karmada *operatorv1alpha1.Karmada) DeInitOpt {
return func(opt *DeInitOptions) { return func(o *DeInitOptions) {
opt.Name = karmada.GetName() o.Name = karmada.GetName()
opt.Namespace = karmada.GetNamespace() o.Namespace = karmada.GetNamespace()
if karmada.Spec.HostCluster != nil { if karmada.Spec.HostCluster != nil {
opt.HostCluster = karmada.Spec.HostCluster o.HostCluster = karmada.Spec.HostCluster
} }
} }
} }
// NewDeInitOptWithKubeconfig returns a DeInitOpt function to set kubeconfig to DeInitOptions with rest config // NewDeInitOptWithKubeconfig returns a DeInitOpt function to set kubeconfig to DeInitOptions with rest config
func NewDeInitOptWithKubeconfig(config *rest.Config) DeInitOpt { func NewDeInitOptWithKubeconfig(config *rest.Config) DeInitOpt {
return func(options *DeInitOptions) { return func(o *DeInitOptions) {
options.Kubeconfig = config o.Kubeconfig = config
} }
} }

View File

@ -37,7 +37,7 @@ type InitOptions struct {
} }
// InitOpt defines a type of function to set InitOptions values. // InitOpt defines a type of function to set InitOptions values.
type InitOpt func(opt *InitOptions) type InitOpt func(o *InitOptions)
var _ tasks.InitData = &initData{} var _ tasks.InitData = &initData{}
@ -234,16 +234,16 @@ func defaultJobInitOptions() *InitOptions {
// NewInitOptWithKarmada returns a InitOpt function to initialize InitOptions with karmada resource // NewInitOptWithKarmada returns a InitOpt function to initialize InitOptions with karmada resource
func NewInitOptWithKarmada(karmada *operatorv1alpha1.Karmada) InitOpt { func NewInitOptWithKarmada(karmada *operatorv1alpha1.Karmada) InitOpt {
return func(opt *InitOptions) { return func(o *InitOptions) {
opt.Karmada = karmada o.Karmada = karmada
opt.Name = karmada.GetName() o.Name = karmada.GetName()
opt.Namespace = karmada.GetNamespace() o.Namespace = karmada.GetNamespace()
} }
} }
// NewInitOptWithKubeconfig returns a InitOpt function to set kubeconfig to InitOptions with rest config // NewInitOptWithKubeconfig returns a InitOpt function to set kubeconfig to InitOptions with rest config
func NewInitOptWithKubeconfig(config *rest.Config) InitOpt { func NewInitOptWithKubeconfig(config *rest.Config) InitOpt {
return func(options *InitOptions) { return func(o *InitOptions) {
options.Kubeconfig = config o.Kubeconfig = config
} }
} }