Skip to content

Commit

Permalink
minor modification
Browse files Browse the repository at this point in the history
  • Loading branch information
Vivek Thrivikraman committed Feb 5, 2021
1 parent 5f31ac0 commit f17bb8f
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions util-images/network/netperfbenchmark/pkg/worker/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,9 @@ func (w *Worker) getStartTimestamp() int64 {
}

func (w *Worker) updateStatus(status map[string]interface{}) error {
resource, err := w.getResource()
resource, err := w.resourceInterface.Get(context.TODO(), w.work.resourceName, metav1.GetOptions{})
if err != nil {
return fmt.Errorf("Updating status failed: %v,", err)
return fmt.Errorf("updating status failed: %v", err)
}
resourceContent := resource.UnstructuredContent()
resourceContent["status"] = status
Expand All @@ -240,17 +240,6 @@ func (w *Worker) updateStatus(status map[string]interface{}) error {
return nil
}

func (w *Worker) getResource() (*unstructured.Unstructured, error) {
resourceContent, err := w.resourceInterface.Get(context.TODO(), w.work.resourceName, metav1.GetOptions{})
if err != nil {
err := fmt.Errorf("error getting custom resource: %v", err)
klog.Error(err)
return nil, err
}
return resourceContent, nil

}

func (w *Worker) handleError(err error) {
klog.Error(err)
if err := w.updateStatus(makeErrorStatus(err)); err != nil {
Expand Down

0 comments on commit f17bb8f

Please sign in to comment.