Skip to content

Commit

Permalink
Informer: Use unstructured (#610)
Browse files Browse the repository at this point in the history
* vendor: Update

Signed-off-by: Ce Gao <gaoce@caicloud.io>

* gopkg: Update

Signed-off-by: Ce Gao <gaoce@caicloud.io>

* controller: Use unstructured informer

Signed-off-by: Ce Gao <gaoce@caicloud.io>
  • Loading branch information
gaocegege authored and k8s-ci-robot committed May 31, 2018
1 parent ad6745b commit a9294ce
Show file tree
Hide file tree
Showing 867 changed files with 59,497 additions and 33,206 deletions.
37 changes: 16 additions & 21 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@ required = [

[[constraint]]
name = "k8s.io/client-go"
version = "~5.0.0"
version = "~6.0.0"

[[constraint]]
name = "k8s.io/kubernetes"
version = "~v1.8.9"
version = "~v1.9.0"

[[constraint]]
branch = "release-1.8"
branch = "release-1.9"
name = "k8s.io/api"

[[constraint]]
branch = "release-1.8"
branch = "release-1.9"
name = "k8s.io/apimachinery"

[[constraint]]
Expand All @@ -43,4 +43,4 @@ required = [

[[constraint]]
name = "k8s.io/apiserver"
version = "~kubernetes-1.8.5"
version = "~kubernetes-1.9"
15 changes: 11 additions & 4 deletions cmd/tf-operator.v2/app/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ var (
leaseDuration = 15 * time.Second
renewDuration = 5 * time.Second
retryPeriod = 3 * time.Second
resyncPeriod = 30 * time.Second
)

const RecommendedKubeConfigPathEnv = "KUBECONFIG"
Expand Down Expand Up @@ -91,15 +92,21 @@ func Run(opt *options.ServerOption) error {
}

// Create informer factory.
kubeInformerFactory := kubeinformers.NewSharedInformerFactory(kubeClientSet, time.Second*30)
tfJobInformerFactory := tfjobinformers.NewSharedInformerFactory(tfJobClientSet, time.Second*30)
kubeInformerFactory := kubeinformers.NewSharedInformerFactory(kubeClientSet, resyncPeriod)
tfJobInformerFactory := tfjobinformers.NewSharedInformerFactory(tfJobClientSet, resyncPeriod)

unstructuredInformer := controller.NewUnstructuredTFJobInformer(kcfg)

// Create tf controller.
tc := controller.NewTFJobController(kubeClientSet, tfJobClientSet, kubeInformerFactory, tfJobInformerFactory)
tc := controller.NewTFJobController(unstructuredInformer, kubeClientSet, tfJobClientSet, kubeInformerFactory, tfJobInformerFactory)

// Start informer goroutines.
go kubeInformerFactory.Start(stopCh)
go tfJobInformerFactory.Start(stopCh)

// We do not use the generated informer because of
// https://github.com/kubeflow/tf-operator/issues/561
// go tfJobInformerFactory.Start(stopCh)
go unstructuredInformer.Informer().Run(stopCh)

// Set leader election start function.
run := func(<-chan struct{}) {
Expand Down
8 changes: 6 additions & 2 deletions pkg/apis/tensorflow/v1alpha2/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,14 @@ var (
const (
// GroupName is the group name use in this package.
GroupName = "kubeflow.org"
// TFJobResourceKind is the kind name.
TFJobResourceKind = "TFJob"
// Kind is the kind name.
Kind = "TFJob"
// GroupVersion is the version.
GroupVersion = "v1alpha2"
// Plural is the Plural for TFJob.
Plural = "tfjobs"
// Singular is the singular for TFJob.
Singular = "tfjob"
)

// SchemeGroupVersion is the group version used to register these objects.
Expand Down
Loading

0 comments on commit a9294ce

Please sign in to comment.