From e84bc226c1f86b496356f344cf9360405769ab63 Mon Sep 17 00:00:00 2001 From: junqian Date: Mon, 9 Aug 2021 15:24:12 +0800 Subject: [PATCH] make ResyncDuration Configurable --- main.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 4442038..0f66fda 100644 --- a/main.go +++ b/main.go @@ -57,6 +57,8 @@ var ( kubeAPIBurst int // TApp sync worker number worker int + //informer ResyncDuration + resync int // Admission related config registerAdmission bool @@ -80,6 +82,7 @@ var ( const ( defaultWorkerNumber = 5 + defaultResync = 30 defaultKubeAPIQPS = 2000 defaultKubeAPIBurst = 2500 ) @@ -107,8 +110,8 @@ func main() { klog.Fatalf("Error instantiating apiextensions client: %s", err.Error()) } - kubeInformerFactory := kubeinformers.NewSharedInformerFactory(kubeClient, time.Second*30) - tappInformerFactory := informers.NewSharedInformerFactory(tappClient, time.Second*30) + kubeInformerFactory := kubeinformers.NewSharedInformerFactory(kubeClient, time.Second*time.Duration(resync)) + tappInformerFactory := informers.NewSharedInformerFactory(tappClient, time.Second*time.Duration(resync)) controller := tapp.NewController(kubeClient, tappClient, kubeInformerFactory, tappInformerFactory) run := func(ctx context.Context) { @@ -198,6 +201,7 @@ func addFlags(fs *pflag.FlagSet) { fs.Float32Var(&kubeAPIQPS, "kube-api-qps", defaultKubeAPIQPS, "QPS to use while talking with kubernetes apiserver") fs.IntVar(&kubeAPIBurst, "kube-api-burst", defaultKubeAPIBurst, "Burst to use while talking with kubernetes apiserver") fs.IntVar(&worker, "worker", defaultWorkerNumber, "TApp sync worker number, default: 5") + fs.IntVar(&resync, "resync", defaultResync, "informer ResyncDuration , default: 30") // Admission related fs.BoolVar(®isterAdmission, "register-admission", false, "Register admission for tapp controller")