Skip to content

Commit

Permalink
UPSTREAM: <carry>: Fixed workflow's ServiceAccountName
Browse files Browse the repository at this point in the history
Signed-off-by: Helber Belmiro <helber.belmiro@gmail.com>
  • Loading branch information
hbelmiro committed Jan 22, 2025
1 parent d9ec34e commit 223937e
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions backend/src/apiserver/template/v2_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"encoding/json"
"errors"
"fmt"
wfapi "github.com/argoproj/argo-workflows/v3/pkg/apis/workflow/v1alpha1"
"io"
"regexp"
"strings"
Expand Down Expand Up @@ -79,7 +80,19 @@ func (t *V2Spec) ScheduledWorkflow(modelJob *model.Job, ownerReferences []metav1

var obj interface{}
if util.CurrentExecutionType() == util.ArgoWorkflow {
var dspaName = ""
for _, ownerRef := range ownerReferences {
if ownerRef.Kind == "DataSciencePipelinesApplication" {
dspaName = ownerRef.Name
}
}

if dspaName == "" {
return nil, errors.New("failed to get the name of the DataSciencePipelinesApplication to mount the ServiceAccountName")
}

obj, err = argocompiler.Compile(job, kubernetesSpec, nil)
obj.(*wfapi.Workflow).Spec.ServiceAccountName += "-" + dspaName
} else if util.CurrentExecutionType() == util.TektonPipelineRun {
obj, err = tektoncompiler.Compile(job, kubernetesSpec, &tektoncompiler.Options{LauncherImage: Launcher})
}
Expand Down

0 comments on commit 223937e

Please sign in to comment.