Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update jobset status without spec #281

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions pkg/controllers/jobset_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ func (r *JobSetReconciler) calculateAndUpdateReplicatedJobsStatuses(ctx context.
return nil
}
js.Status.ReplicatedJobsStatus = status
return r.Status().Update(ctx, js)
return r.updateStatusWithoutSpec(ctx, js)
}

func (r *JobSetReconciler) calculateReplicatedJobStatuses(ctx context.Context, js *jobset.JobSet, jobs *childJobs) []jobset.ReplicatedJobStatus {
Expand Down Expand Up @@ -510,18 +510,25 @@ func (r *JobSetReconciler) deleteJobs(ctx context.Context, jobsForDeletion []*ba

// updateStatus updates the status of a JobSet.
func (r *JobSetReconciler) updateStatus(ctx context.Context, js *jobset.JobSet, eventType, eventReason, eventMsg string) error {
if err := r.Status().Update(ctx, js); err != nil {
if err := r.updateStatusWithoutSpec(ctx, js); err != nil {
return err
}
r.Record.Eventf(js, eventType, eventReason, eventMsg)
return nil
}

// to fix issue#141
func (r *JobSetReconciler) updateStatusWithoutSpec(ctx context.Context, js *jobset.JobSet) error {
jobsetCopy := js.DeepCopy()
jobsetCopy.Spec = jobset.JobSetSpec{}
return r.Status().Update(ctx, jobsetCopy)
}

func (r *JobSetReconciler) ensureCondition(ctx context.Context, js *jobset.JobSet, eventType string, condition metav1.Condition) error {
if !updateCondition(js, condition) {
return nil
}
if err := r.Status().Update(ctx, js); err != nil {
if err := r.updateStatusWithoutSpec(ctx, js); err != nil {
return err
}

Expand Down