Skip to content

Commit 6a608a7

Browse files
authored
fix: Remove default resync period (#1237)
Signed-off-by: cegao <cegao@tencent.com>
1 parent 4f69069 commit 6a608a7

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

cmd/tf-operator.v1/app/server.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ func Run(opt *options.ServerOption) error {
7777

7878
namespace := os.Getenv(v1.EnvKubeflowNamespace)
7979
if len(namespace) == 0 {
80-
log.Infof("EnvKubeflowNamespace not set, use default namespace")
80+
log.Infof("EnvKubeflowNamespace not set, use default namespace %s",
81+
metav1.NamespaceDefault)
8182
namespace = metav1.NamespaceDefault
8283
}
8384
if opt.Namespace == corev1.NamespaceAll {
@@ -108,6 +109,9 @@ func Run(opt *options.ServerOption) error {
108109
// Set client qps and burst by opt.
109110
kcfg.QPS = float32(opt.QPS)
110111
kcfg.Burst = opt.Burst
112+
log.Infof(
113+
"Creating client sets and informers with QPS %d, burst %d, resync period %s",
114+
opt.QPS, opt.Burst, opt.ResyncPeriod.String())
111115

112116
// Create clients.
113117
kubeClientSet, leaderElectionClientSet,
@@ -125,7 +129,8 @@ func Run(opt *options.ServerOption) error {
125129
kubeInformerFactory := kubeinformers.NewFilteredSharedInformerFactory(kubeClientSet, opt.ResyncPeriod, opt.Namespace, nil)
126130
tfJobInformerFactory := tfjobinformers.NewSharedInformerFactory(tfJobClientSet, opt.ResyncPeriod)
127131

128-
unstructuredInformer := controller.NewUnstructuredTFJobInformer(kcfg, opt.Namespace)
132+
unstructuredInformer := controller.NewUnstructuredTFJobInformer(
133+
kcfg, opt.Namespace, opt.ResyncPeriod)
129134

130135
// Create tf controller.
131136
tc := controller.NewTFController(unstructuredInformer, kubeClientSet, volcanoClientSet, tfJobClientSet, kubeInformerFactory, tfJobInformerFactory, *opt)
@@ -240,7 +245,7 @@ func checkCRDExists(clientset apiextensionclientset.Interface, namespace string)
240245
}
241246
}
242247

243-
log.Infof("CRD %s/%s %s is registered\n",
248+
log.Infof("CRD %s/%s %s is registered",
244249
crd.Spec.Group, crd.Spec.Version, crd.Spec.Names.Singular)
245250
return true
246251
}

pkg/controller.v1/tensorflow/controller_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func newTFController(
5555
kubeInformerFactory := kubeinformers.NewSharedInformerFactory(kubeClientSet, duration)
5656
tfJobInformerFactory := tfjobinformers.NewSharedInformerFactory(tfJobClientSet, duration)
5757

58-
tfJobInformer := NewUnstructuredTFJobInformer(config, metav1.NamespaceAll)
58+
tfJobInformer := NewUnstructuredTFJobInformer(config, metav1.NamespaceAll, time.Hour*12)
5959

6060
ctr := NewTFController(tfJobInformer, kubeClientSet,
6161
volcanoClientSet, tfJobClientSet, kubeInformerFactory,

pkg/controller.v1/tensorflow/informer.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import (
2121
)
2222

2323
const (
24-
resyncPeriod = 30 * time.Second
2524
failedMarshalMsg = "Failed to marshal the object to TFJob: %v"
2625
)
2726

@@ -31,7 +30,7 @@ var (
3130
errFailedMarshal = fmt.Errorf("failed to marshal the object to TFJob")
3231
)
3332

34-
func NewUnstructuredTFJobInformer(restConfig *restclientset.Config, namespace string) tfjobinformersv1.TFJobInformer {
33+
func NewUnstructuredTFJobInformer(restConfig *restclientset.Config, namespace string, resyncPeriod time.Duration) tfjobinformersv1.TFJobInformer {
3534
dclient, err := dynamic.NewForConfig(restConfig)
3635
if err != nil {
3736
panic(err)

0 commit comments

Comments
 (0)