diff --git a/cmd/tf-operator.v1/app/server.go b/cmd/tf-operator.v1/app/server.go index 39d2991467..023b7fe653 100644 --- a/cmd/tf-operator.v1/app/server.go +++ b/cmd/tf-operator.v1/app/server.go @@ -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) diff --git a/pkg/common/util/v1/unstructured/informer.go b/pkg/common/util/v1/unstructured/informer.go index cf04bdf670..b24a0c4f53 100644 --- a/pkg/common/util/v1/unstructured/informer.go +++ b/pkg/common/util/v1/unstructured/informer.go @@ -4,6 +4,7 @@ package unstructured import ( + "context" "time" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -50,10 +51,10 @@ 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{}, diff --git a/pkg/controller.v1/tensorflow/controller.go b/pkg/controller.v1/tensorflow/controller.go index 7b5a5014e8..631542637f 100644 --- a/pkg/controller.v1/tensorflow/controller.go +++ b/pkg/controller.v1/tensorflow/controller.go @@ -16,6 +16,7 @@ package tensorflow import ( + "context" "fmt" "time" @@ -371,7 +372,7 @@ 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 { diff --git a/pkg/controller.v1/tensorflow/job.go b/pkg/controller.v1/tensorflow/job.go index e94b53890c..9e1cb52aad 100644 --- a/pkg/controller.v1/tensorflow/job.go +++ b/pkg/controller.v1/tensorflow/job.go @@ -1,6 +1,7 @@ package tensorflow import ( + "context" "fmt" "time" @@ -43,7 +44,7 @@ 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 diff --git a/pkg/controller.v1/tensorflow/status.go b/pkg/controller.v1/tensorflow/status.go index 425055ac71..4d078f7679 100644 --- a/pkg/controller.v1/tensorflow/status.go +++ b/pkg/controller.v1/tensorflow/status.go @@ -16,6 +16,7 @@ package tensorflow import ( + "context" "fmt" "time" @@ -235,7 +236,7 @@ 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 }