From b2cc1ef72ab5ae7f105eb914bc56cf1b21cabd8b Mon Sep 17 00:00:00 2001 From: Yuki Iwai Date: Sat, 9 Nov 2024 15:59:17 +0900 Subject: [PATCH] Stop to connect condition type and reason in JobSet plugin Signed-off-by: Yuki Iwai --- pkg/runtime.v2/framework/core/framework_test.go | 5 ++--- pkg/runtime.v2/framework/plugins/jobset/jobset.go | 2 -- test/integration/controller.v2/trainjob_controller_test.go | 4 ++-- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/pkg/runtime.v2/framework/core/framework_test.go b/pkg/runtime.v2/framework/core/framework_test.go index 604aae6aea..223603398a 100644 --- a/pkg/runtime.v2/framework/core/framework_test.go +++ b/pkg/runtime.v2/framework/core/framework_test.go @@ -18,7 +18,6 @@ package core import ( "context" - "fmt" "testing" "github.com/google/go-cmp/cmp" @@ -612,7 +611,7 @@ func TestTerminalConditionPlugins(t *testing.T) { Obj(), wantCondition: &metav1.Condition{ Type: kubeflowv2.TrainJobComplete, - Reason: fmt.Sprintf("%sDueTo%s", jobsetv1alpha2.JobSetCompleted, jobsetconsts.AllJobsCompletedReason), + Reason: jobsetconsts.AllJobsCompletedReason, Message: jobsetconsts.AllJobsCompletedMessage, Status: metav1.ConditionTrue, }, @@ -631,7 +630,7 @@ func TestTerminalConditionPlugins(t *testing.T) { Obj(), wantCondition: &metav1.Condition{ Type: kubeflowv2.TrainJobFailed, - Reason: fmt.Sprintf("%sDueTo%s", jobsetv1alpha2.JobSetFailed, jobsetconsts.FailedJobsReason), + Reason: jobsetconsts.FailedJobsReason, Message: jobsetconsts.FailedJobsMessage, Status: metav1.ConditionTrue, }, diff --git a/pkg/runtime.v2/framework/plugins/jobset/jobset.go b/pkg/runtime.v2/framework/plugins/jobset/jobset.go index e372b34857..f913cd169f 100644 --- a/pkg/runtime.v2/framework/plugins/jobset/jobset.go +++ b/pkg/runtime.v2/framework/plugins/jobset/jobset.go @@ -133,12 +133,10 @@ func (j *JobSet) TerminalCondition(ctx context.Context, trainJob *kubeflowv2.Tra return nil, err } if completed := meta.FindStatusCondition(jobSet.Status.Conditions, string(jobsetv1alpha2.JobSetCompleted)); completed != nil && completed.Status == metav1.ConditionTrue { - completed.Reason = fmt.Sprintf("%sDueTo%s", completed.Type, completed.Reason) completed.Type = kubeflowv2.TrainJobComplete return completed, nil } if failed := meta.FindStatusCondition(jobSet.Status.Conditions, string(jobsetv1alpha2.JobSetFailed)); failed != nil && failed.Status == metav1.ConditionTrue { - failed.Reason = fmt.Sprintf("%sDueTo%s", failed.Type, failed.Reason) failed.Type = kubeflowv2.TrainJobFailed return failed, nil } diff --git a/test/integration/controller.v2/trainjob_controller_test.go b/test/integration/controller.v2/trainjob_controller_test.go index 24ee32bd0c..487114d38e 100644 --- a/test/integration/controller.v2/trainjob_controller_test.go +++ b/test/integration/controller.v2/trainjob_controller_test.go @@ -422,7 +422,7 @@ var _ = ginkgo.Describe("TrainJob controller", ginkgo.Ordered, func() { { Type: kubeflowv2.TrainJobComplete, Status: metav1.ConditionTrue, - Reason: fmt.Sprintf("%sDueTo%s", jobsetv1alpha2.JobSetCompleted, jobsetconsts.AllJobsCompletedReason), + Reason: jobsetconsts.AllJobsCompletedReason, Message: jobsetconsts.AllJobsCompletedMessage, }, }, util.IgnoreConditions)) @@ -481,7 +481,7 @@ var _ = ginkgo.Describe("TrainJob controller", ginkgo.Ordered, func() { { Type: kubeflowv2.TrainJobFailed, Status: metav1.ConditionTrue, - Reason: fmt.Sprintf("%sDueTo%s", jobsetv1alpha2.JobSetFailed, jobsetconsts.FailedJobsReason), + Reason: jobsetconsts.FailedJobsReason, Message: jobsetconsts.FailedJobsMessage, }, }, util.IgnoreConditions))