cleanup controllerruntime deprecated option SyncPeriod Namespace

Signed-off-by: huangyanfeng <huangyanfeng1992@gmail.com>
This commit is contained in:
huangyanfeng 2023-12-21 10:25:08 +08:00
parent 0865183292
commit 22e4f4bb8c
2 changed files with 2 additions and 3 deletions

View File

@ -196,8 +196,7 @@ func run(ctx context.Context, opts *options.Options) error {
controllerManager, err := controllerruntime.NewManager(controlPlaneRestConfig, controllerruntime.Options{
Scheme: gclient.NewSchema(),
SyncPeriod: &opts.ResyncPeriod.Duration,
Namespace: executionSpace,
Cache: cache.Options{SyncPeriod: &opts.ResyncPeriod.Duration, Namespaces: []string{executionSpace}},
LeaderElection: opts.LeaderElection.LeaderElect,
LeaderElectionID: fmt.Sprintf("karmada-agent-%s", opts.ClusterName),
LeaderElectionNamespace: opts.LeaderElection.ResourceNamespace,

View File

@ -145,7 +145,7 @@ func Run(ctx context.Context, opts *options.Options) error {
controllerManager, err := controllerruntime.NewManager(controlPlaneRestConfig, controllerruntime.Options{
Logger: klog.Background(),
Scheme: gclient.NewSchema(),
SyncPeriod: &opts.ResyncPeriod.Duration,
Cache: cache.Options{SyncPeriod: &opts.ResyncPeriod.Duration},
LeaderElection: opts.LeaderElection.LeaderElect,
LeaderElectionID: opts.LeaderElection.ResourceName,
LeaderElectionNamespace: opts.LeaderElection.ResourceNamespace,