Skip to content

Commit 2dc7063

Browse files
hbelmiromprahl
authored andcommitted
Revert "UPSTREAM: 11480: chore(backend): Fixed namespace in job creation"
This reverts commit 34bf2f8. (cherry picked from commit fb7c5f0)
1 parent 1fd374d commit 2dc7063

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

backend/src/apiserver/resource/resource_manager.go

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -990,6 +990,12 @@ func (r *ResourceManager) CreateJob(ctx context.Context, job *model.Job) (*model
990990
return nil, util.NewInternalServerError(err, "Failed to create a recurring run with an invalid pipeline spec manifest")
991991
}
992992

993+
// TODO(gkcalat): consider changing the flow. Other resource UUIDs are assigned by their respective stores (DB).
994+
// Convert modelJob into scheduledWorkflow.
995+
scheduledWorkflow, err := tmpl.ScheduledWorkflow(job, r.getOwnerReferences())
996+
if err != nil {
997+
return nil, util.Wrap(err, "Failed to create a recurring run during scheduled workflow creation")
998+
}
993999
// Create a new ScheduledWorkflow at the ScheduledWorkflow client.
9941000
k8sNamespace := job.Namespace
9951001
if k8sNamespace == "" {
@@ -998,15 +1004,6 @@ func (r *ResourceManager) CreateJob(ctx context.Context, job *model.Job) (*model
9981004
if k8sNamespace == "" {
9991005
return nil, util.NewInternalServerError(util.NewInvalidInputError("Namespace cannot be empty when creating an Argo scheduled workflow. Check if you have specified POD_NAMESPACE or try adding the parent namespace to the request"), "Failed to create a recurring run due to empty namespace")
10001006
}
1001-
1002-
job.Namespace = k8sNamespace
1003-
1004-
// TODO(gkcalat): consider changing the flow. Other resource UUIDs are assigned by their respective stores (DB).
1005-
// Convert modelJob into scheduledWorkflow.
1006-
scheduledWorkflow, err := tmpl.ScheduledWorkflow(job, r.getOwnerReferences())
1007-
if err != nil {
1008-
return nil, util.Wrap(err, "Failed to create a recurring run during scheduled workflow creation")
1009-
}
10101007
newScheduledWorkflow, err := r.getScheduledWorkflowClient(k8sNamespace).Create(ctx, scheduledWorkflow)
10111008
if err != nil {
10121009
if err, ok := err.(net.Error); ok && err.Timeout() {
@@ -1018,6 +1015,7 @@ func (r *ResourceManager) CreateJob(ctx context.Context, job *model.Job) (*model
10181015
swf := util.NewScheduledWorkflow(newScheduledWorkflow)
10191016
job.UUID = string(swf.UID)
10201017
job.K8SName = swf.Name
1018+
job.Namespace = swf.Namespace
10211019
job.Conditions = model.StatusState(swf.ConditionSummary()).ToString()
10221020
for _, modelRef := range job.ResourceReferences {
10231021
modelRef.ResourceUUID = string(swf.UID)

0 commit comments

Comments
 (0)