Skip to content

Commit

Permalink
chore: Update k8s to 1.19 and common to 0.3.7
Browse files Browse the repository at this point in the history
Signed-off-by: cegao <[email protected]>
  • Loading branch information
gaocegege committed Aug 31, 2021
1 parent 2ca5077 commit f78d521
Show file tree
Hide file tree
Showing 7 changed files with 514 additions and 19 deletions.
2 changes: 1 addition & 1 deletion cmd/tf-operator.v1/app/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ func createClientSets(config *restclientset.Config) (
func checkCRDExists(clientset apiextensionclientset.Interface, namespace string) bool {
crd, err := clientset.ApiextensionsV1beta1().
CustomResourceDefinitions().
Get(v1.TFCRD, metav1.GetOptions{})
Get(context.TODO(), v1.TFCRD, metav1.GetOptions{})

if err != nil {
log.Error(err)
Expand Down
24 changes: 11 additions & 13 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,18 @@ module github.com/kubeflow/tf-operator
go 1.14

require (
github.com/go-openapi/spec v0.19.2
github.com/google/go-cmp v0.4.1 // indirect
github.com/kubeflow/common v0.3.3
github.com/go-openapi/spec v0.20.3
github.com/kubeflow/common v0.3.7
github.com/onrik/logrus v0.2.2-0.20181225141908-a09d5cdcdc62
github.com/prometheus/client_golang v1.5.1
github.com/sirupsen/logrus v1.4.2
golang.org/x/tools v0.0.0-20200401192744-099440627f01 // indirect
k8s.io/api v0.16.15
k8s.io/apiextensions-apiserver v0.16.9
k8s.io/apimachinery v0.16.15
k8s.io/client-go v0.16.15
k8s.io/code-generator v0.16.15
github.com/prometheus/client_golang v1.10.0
github.com/sirupsen/logrus v1.6.0
k8s.io/api v0.19.9
k8s.io/apiextensions-apiserver v0.19.9
k8s.io/apimachinery v0.19.9
k8s.io/client-go v0.19.9
k8s.io/code-generator v0.19.9
k8s.io/klog v1.0.0
k8s.io/kube-openapi v0.0.0-20200410163147-594e756bea31
k8s.io/kube-openapi v0.0.0-20200805222855-6aeccd4b50c6
sigs.k8s.io/yaml v1.2.0 // indirect
volcano.sh/apis v1.2.0-k8s1.16.15
volcano.sh/apis v1.2.0-k8s1.19.6
)
488 changes: 488 additions & 0 deletions go.sum

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions pkg/common/util/v1/unstructured/informer.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
package unstructured

import (
"context"
"time"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -50,10 +51,12 @@ func newFilteredUnstructuredInformer(resource schema.GroupVersionResource, clien
return cache.NewSharedIndexInformer(
&cache.ListWatch{
ListFunc: func(options metav1.ListOptions) (runtime.Object, error) {
return client.Resource(resource).Namespace(namespace).List(options)
return client.Resource(resource).
Namespace(namespace).List(context.TODO(), options)
},
WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
return client.Resource(resource).Namespace(namespace).Watch(options)
return client.Resource(resource).
Namespace(namespace).Watch(context.TODO(), options)
},
},
&unstructured.Unstructured{},
Expand Down
4 changes: 3 additions & 1 deletion pkg/controller.v1/tensorflow/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package tensorflow

import (
"context"
"fmt"
"time"

Expand Down Expand Up @@ -371,7 +372,8 @@ func (tc *TFController) GetJobFromInformerCache(namespace, name string) (metav1.
}

func (tc *TFController) GetJobFromAPIClient(namespace, name string) (metav1.Object, error) {
return tc.tfJobClientSet.KubeflowV1().TFJobs(namespace).Get(name, metav1.GetOptions{})
return tc.tfJobClientSet.KubeflowV1().
TFJobs(namespace).Get(context.TODO(), name, metav1.GetOptions{})
}

func (tc *TFController) GetAPIGroupVersionKind() schema.GroupVersionKind {
Expand Down
4 changes: 3 additions & 1 deletion pkg/controller.v1/tensorflow/job.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package tensorflow

import (
"context"
"fmt"
"time"

Expand Down Expand Up @@ -43,7 +44,8 @@ func (tc *TFController) DeleteJob(job interface{}) error {
}

log := commonutil.LoggerForJob(tfJob)
if err := tc.tfJobClientSet.KubeflowV1().TFJobs(tfJob.Namespace).Delete(tfJob.Name, &metav1.DeleteOptions{}); err != nil {
if err := tc.tfJobClientSet.KubeflowV1().TFJobs(tfJob.Namespace).
Delete(context.TODO(), tfJob.Name, metav1.DeleteOptions{}); err != nil {
tc.JobController.Recorder.Eventf(tfJob, v1.EventTypeWarning, FailedDeleteJobReason, "Error deleting: %v", err)
log.Errorf("failed to delete job %s/%s, %v", tfJob.Namespace, tfJob.Name, err)
return err
Expand Down
4 changes: 3 additions & 1 deletion pkg/controller.v1/tensorflow/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package tensorflow

import (
"context"
"fmt"
"time"

Expand Down Expand Up @@ -235,7 +236,8 @@ func (tc *TFController) UpdateJobStatusInApiServer(job interface{}, jobStatus *c
tfJob = tfJob.DeepCopy()
tfJob.Status = *jobStatus.DeepCopy()

_, err := tc.tfJobClientSet.KubeflowV1().TFJobs(tfJob.Namespace).UpdateStatus(tfJob)
_, err := tc.tfJobClientSet.KubeflowV1().TFJobs(tfJob.Namespace).UpdateStatus(
context.TODO(), tfJob, metav1.UpdateOptions{})
return err
}

Expand Down

0 comments on commit f78d521

Please sign in to comment.