diff --git a/backend/src/crd/controller/scheduledworkflow/util/scheduled_workflow.go b/backend/src/crd/controller/scheduledworkflow/util/scheduled_workflow.go index 90dc3d30808..0a06432db01 100644 --- a/backend/src/crd/controller/scheduledworkflow/util/scheduled_workflow.go +++ b/backend/src/crd/controller/scheduledworkflow/util/scheduled_workflow.go @@ -271,7 +271,10 @@ func (s *ScheduledWorkflow) UpdateStatus(updatedEpoch int64, submitted bool, scheduledEpoch int64, active []swfapi.WorkflowStatus, completed []swfapi.WorkflowStatus, location *time.Location) { - updatedTime := metav1.NewTime(time.Unix(updatedEpoch, 0).UTC()) + // updatedEpoch contains current time but using current time causes the + // SWF to fail to be reconciled by the controller. Set LastProbeTime and + // LastTransitionTime to 0 to avoid the irreconcilable status updates. + updatedTime := metav1.NewTime(time.Unix(0, 0).UTC()) conditionType, status, message := s.getStatusAndMessage(len(active)) diff --git a/backend/src/crd/controller/scheduledworkflow/util/scheduled_workflow_test.go b/backend/src/crd/controller/scheduledworkflow/util/scheduled_workflow_test.go index 39b58402a2b..6c80dd1d74c 100644 --- a/backend/src/crd/controller/scheduledworkflow/util/scheduled_workflow_test.go +++ b/backend/src/crd/controller/scheduledworkflow/util/scheduled_workflow_test.go @@ -510,7 +510,7 @@ func TestScheduledWorkflow_GetNextScheduledEpoch_PeriodicSchedule(t *testing.T) func TestScheduledWorkflow_GetNextScheduledEpoch_UpdateStatus_NoWorkflow(t *testing.T) { // Must run now scheduledEpoch := int64(10 * hour) - updatedEpoch := int64(11 * hour) + updatedEpoch := int64(0) creationTimestamp := metav1.NewTime(time.Unix(9*hour, 0).UTC()) schedule := NewScheduledWorkflow(&swfapi.ScheduledWorkflow{ @@ -591,7 +591,7 @@ func createStatus(workflowName string, scheduledEpoch int64) *swfapi.WorkflowSta func TestScheduledWorkflow_GetNextScheduledEpoch_UpdateStatus_WithWorkflow(t *testing.T) { // Must run now scheduledEpoch := int64(10 * hour) - updatedEpoch := int64(11 * hour) + updatedEpoch := int64(0) creationTimestamp := metav1.NewTime(time.Unix(9*hour, 0).UTC()) schedule := NewScheduledWorkflow(&swfapi.ScheduledWorkflow{