Skip to content

Commit 1fd374d

Browse files
hbelmiromprahl
authored andcommitted
Revert "chore(backend): Fixed ServiceAccount in job creation (kubeflow#11481)"
This reverts commit 37c74b3. (cherry picked from commit 1c5a467)
1 parent ab85e6e commit 1fd374d

File tree

3 files changed

+14
-18
lines changed

3 files changed

+14
-18
lines changed

backend/src/apiserver/resource/resource_manager.go

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,19 +1022,18 @@ func (r *ResourceManager) CreateJob(ctx context.Context, job *model.Job) (*model
10221022
for _, modelRef := range job.ResourceReferences {
10231023
modelRef.ResourceUUID = string(swf.UID)
10241024
}
1025-
if tmpl.GetTemplateType() == template.V1 {
1026-
// Get the service account
1027-
serviceAccount := ""
1028-
if swf.Spec.Workflow != nil {
1029-
execSpec, err := util.ScheduleSpecToExecutionSpec(util.ArgoWorkflow, swf.Spec.Workflow)
1030-
if err == nil {
1031-
serviceAccount = execSpec.ServiceAccount()
1032-
}
1025+
// Get the service account
1026+
serviceAccount := ""
1027+
if swf.Spec.Workflow != nil {
1028+
execSpec, err := util.ScheduleSpecToExecutionSpec(util.ArgoWorkflow, swf.Spec.Workflow)
1029+
if err == nil {
1030+
serviceAccount = execSpec.ServiceAccount()
10331031
}
1034-
job.ServiceAccount = serviceAccount
1032+
}
1033+
job.ServiceAccount = serviceAccount
1034+
if tmpl.GetTemplateType() == template.V1 {
10351035
job.PipelineSpec.WorkflowSpecManifest = manifest
10361036
} else {
1037-
job.ServiceAccount = newScheduledWorkflow.Spec.ServiceAccount
10381037
job.PipelineSpec.PipelineSpecManifest = manifest
10391038
}
10401039
return r.jobStore.CreateJob(job)

backend/src/apiserver/template/template_test.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,10 +220,9 @@ func TestScheduledWorkflow(t *testing.T) {
220220
Parameters: []scheduledworkflow.Parameter{{Name: "y", Value: "\"world\""}},
221221
Spec: "",
222222
},
223-
PipelineId: "1",
224-
PipelineName: "pipeline name",
225-
NoCatchup: util.BoolPointer(true),
226-
ServiceAccount: "pipeline-runner",
223+
PipelineId: "1",
224+
PipelineName: "pipeline name",
225+
NoCatchup: util.BoolPointer(true),
227226
},
228227
}
229228

backend/src/apiserver/template/v2_template.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,7 @@ func (t *V2Spec) ScheduledWorkflow(modelJob *model.Job, ownerReferences []metav1
9797
if modelJob.Namespace != "" {
9898
executionSpec.SetExecutionNamespace(modelJob.Namespace)
9999
}
100-
if executionSpec.ServiceAccount() == "" {
101-
setDefaultServiceAccount(executionSpec, modelJob.ServiceAccount)
102-
}
100+
setDefaultServiceAccount(executionSpec, modelJob.ServiceAccount)
103101
// Disable istio sidecar injection if not specified
104102
executionSpec.SetAnnotationsToAllTemplatesIfKeyNotExist(util.AnnotationKeyIstioSidecarInject, util.AnnotationValueIstioSidecarInjectDisabled)
105103
swfGeneratedName, err := toSWFCRDResourceGeneratedName(modelJob.K8SName)
@@ -137,7 +135,7 @@ func (t *V2Spec) ScheduledWorkflow(modelJob *model.Job, ownerReferences []metav1
137135
PipelineId: modelJob.PipelineId,
138136
PipelineName: modelJob.PipelineName,
139137
PipelineVersionId: modelJob.PipelineVersionId,
140-
ServiceAccount: executionSpec.ServiceAccount(),
138+
ServiceAccount: modelJob.ServiceAccount,
141139
},
142140
}
143141
return scheduledWorkflow, nil

0 commit comments

Comments
 (0)