Skip to content

Commit

Permalink
Revert "chore(backend): Fixed ServiceAccount in job creation (kubeflo…
Browse files Browse the repository at this point in the history
…w#11481)"

This reverts commit 37c74b3.

(cherry picked from commit 1c5a467)
  • Loading branch information
hbelmiro authored and mprahl committed Jan 23, 2025
1 parent ab85e6e commit 1fd374d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 18 deletions.
19 changes: 9 additions & 10 deletions backend/src/apiserver/resource/resource_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -1022,19 +1022,18 @@ func (r *ResourceManager) CreateJob(ctx context.Context, job *model.Job) (*model
for _, modelRef := range job.ResourceReferences {
modelRef.ResourceUUID = string(swf.UID)
}
if tmpl.GetTemplateType() == template.V1 {
// Get the service account
serviceAccount := ""
if swf.Spec.Workflow != nil {
execSpec, err := util.ScheduleSpecToExecutionSpec(util.ArgoWorkflow, swf.Spec.Workflow)
if err == nil {
serviceAccount = execSpec.ServiceAccount()
}
// Get the service account
serviceAccount := ""
if swf.Spec.Workflow != nil {
execSpec, err := util.ScheduleSpecToExecutionSpec(util.ArgoWorkflow, swf.Spec.Workflow)
if err == nil {
serviceAccount = execSpec.ServiceAccount()
}
job.ServiceAccount = serviceAccount
}
job.ServiceAccount = serviceAccount
if tmpl.GetTemplateType() == template.V1 {
job.PipelineSpec.WorkflowSpecManifest = manifest
} else {
job.ServiceAccount = newScheduledWorkflow.Spec.ServiceAccount
job.PipelineSpec.PipelineSpecManifest = manifest
}
return r.jobStore.CreateJob(job)
Expand Down
7 changes: 3 additions & 4 deletions backend/src/apiserver/template/template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,9 @@ func TestScheduledWorkflow(t *testing.T) {
Parameters: []scheduledworkflow.Parameter{{Name: "y", Value: "\"world\""}},
Spec: "",
},
PipelineId: "1",
PipelineName: "pipeline name",
NoCatchup: util.BoolPointer(true),
ServiceAccount: "pipeline-runner",
PipelineId: "1",
PipelineName: "pipeline name",
NoCatchup: util.BoolPointer(true),
},
}

Expand Down
6 changes: 2 additions & 4 deletions backend/src/apiserver/template/v2_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,7 @@ func (t *V2Spec) ScheduledWorkflow(modelJob *model.Job, ownerReferences []metav1
if modelJob.Namespace != "" {
executionSpec.SetExecutionNamespace(modelJob.Namespace)
}
if executionSpec.ServiceAccount() == "" {
setDefaultServiceAccount(executionSpec, modelJob.ServiceAccount)
}
setDefaultServiceAccount(executionSpec, modelJob.ServiceAccount)
// Disable istio sidecar injection if not specified
executionSpec.SetAnnotationsToAllTemplatesIfKeyNotExist(util.AnnotationKeyIstioSidecarInject, util.AnnotationValueIstioSidecarInjectDisabled)
swfGeneratedName, err := toSWFCRDResourceGeneratedName(modelJob.K8SName)
Expand Down Expand Up @@ -137,7 +135,7 @@ func (t *V2Spec) ScheduledWorkflow(modelJob *model.Job, ownerReferences []metav1
PipelineId: modelJob.PipelineId,
PipelineName: modelJob.PipelineName,
PipelineVersionId: modelJob.PipelineVersionId,
ServiceAccount: executionSpec.ServiceAccount(),
ServiceAccount: modelJob.ServiceAccount,
},
}
return scheduledWorkflow, nil
Expand Down

0 comments on commit 1fd374d

Please sign in to comment.