Merge pull request #1265 from Garrybest/pr_resync

stop resync for controllers
This commit is contained in:
karmada-bot 2022-01-21 09:00:26 +08:00 committed by GitHub
commit 7c78d03c3b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -5,6 +5,7 @@ import (
"flag"
"fmt"
"os"
"time"
"github.com/spf13/cobra"
corev1 "k8s.io/api/core/v1"
@ -115,8 +116,11 @@ func run(ctx context.Context, karmadaConfig karmadactl.KarmadaConfig, opts *opti
return err
}
// TODO(Garrybest): add resyncPeriod to options
resyncPeriod := time.Duration(0)
controllerManager, err := controllerruntime.NewManager(controlPlaneRestConfig, controllerruntime.Options{
Scheme: gclient.NewSchema(),
SyncPeriod: &resyncPeriod,
Namespace: executionSpace,
LeaderElection: opts.LeaderElection.LeaderElect,
LeaderElectionID: fmt.Sprintf("karmada-agent-%s", opts.ClusterName),

View File

@ -6,6 +6,7 @@ import (
"net"
"os"
"strconv"
"time"
"github.com/spf13/cobra"
"k8s.io/client-go/discovery"
@ -74,8 +75,11 @@ func Run(ctx context.Context, opts *options.Options) error {
panic(err)
}
config.QPS, config.Burst = opts.KubeAPIQPS, opts.KubeAPIBurst
// TODO(Garrybest): add resyncPeriod to options
resyncPeriod := time.Duration(0)
controllerManager, err := controllerruntime.NewManager(config, controllerruntime.Options{
Scheme: gclient.NewSchema(),
SyncPeriod: &resyncPeriod,
LeaderElection: opts.LeaderElection.LeaderElect,
LeaderElectionID: opts.LeaderElection.ResourceName,
LeaderElectionNamespace: opts.LeaderElection.ResourceNamespace,