Skip to content

Commit

Permalink
fix: Remove default resync period (#1237)
Browse files Browse the repository at this point in the history
Signed-off-by: cegao <[email protected]>
  • Loading branch information
gaocegege authored Feb 4, 2021
1 parent 4f69069 commit 6a608a7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
11 changes: 8 additions & 3 deletions cmd/tf-operator.v1/app/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ func Run(opt *options.ServerOption) error {

namespace := os.Getenv(v1.EnvKubeflowNamespace)
if len(namespace) == 0 {
log.Infof("EnvKubeflowNamespace not set, use default namespace")
log.Infof("EnvKubeflowNamespace not set, use default namespace %s",
metav1.NamespaceDefault)
namespace = metav1.NamespaceDefault
}
if opt.Namespace == corev1.NamespaceAll {
Expand Down Expand Up @@ -108,6 +109,9 @@ func Run(opt *options.ServerOption) error {
// Set client qps and burst by opt.
kcfg.QPS = float32(opt.QPS)
kcfg.Burst = opt.Burst
log.Infof(
"Creating client sets and informers with QPS %d, burst %d, resync period %s",
opt.QPS, opt.Burst, opt.ResyncPeriod.String())

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

unstructuredInformer := controller.NewUnstructuredTFJobInformer(kcfg, opt.Namespace)
unstructuredInformer := controller.NewUnstructuredTFJobInformer(
kcfg, opt.Namespace, opt.ResyncPeriod)

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

log.Infof("CRD %s/%s %s is registered\n",
log.Infof("CRD %s/%s %s is registered",
crd.Spec.Group, crd.Spec.Version, crd.Spec.Names.Singular)
return true
}
2 changes: 1 addition & 1 deletion pkg/controller.v1/tensorflow/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func newTFController(
kubeInformerFactory := kubeinformers.NewSharedInformerFactory(kubeClientSet, duration)
tfJobInformerFactory := tfjobinformers.NewSharedInformerFactory(tfJobClientSet, duration)

tfJobInformer := NewUnstructuredTFJobInformer(config, metav1.NamespaceAll)
tfJobInformer := NewUnstructuredTFJobInformer(config, metav1.NamespaceAll, time.Hour*12)

ctr := NewTFController(tfJobInformer, kubeClientSet,
volcanoClientSet, tfJobClientSet, kubeInformerFactory,
Expand Down
3 changes: 1 addition & 2 deletions pkg/controller.v1/tensorflow/informer.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
)

const (
resyncPeriod = 30 * time.Second
failedMarshalMsg = "Failed to marshal the object to TFJob: %v"
)

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

func NewUnstructuredTFJobInformer(restConfig *restclientset.Config, namespace string) tfjobinformersv1.TFJobInformer {
func NewUnstructuredTFJobInformer(restConfig *restclientset.Config, namespace string, resyncPeriod time.Duration) tfjobinformersv1.TFJobInformer {
dclient, err := dynamic.NewForConfig(restConfig)
if err != nil {
panic(err)
Expand Down

0 comments on commit 6a608a7

Please sign in to comment.