Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow ownerReferences #1120

Merged
merged 2 commits into from
Dec 18, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions workflow/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,14 @@ func IsWorkflowCompleted(wf *wfv1.Workflow) bool {

// SubmitOpts are workflow submission options
type SubmitOpts struct {
Name string // --name
GenerateName string // --generate-name
InstanceID string // --instanceid
Entrypoint string // --entrypoint
Parameters []string // --parameter
ParameterFile string // --parameter-file
ServiceAccount string // --serviceaccount
Name string // --name
GenerateName string // --generate-name
InstanceID string // --instanceid
Entrypoint string // --entrypoint
Parameters []string // --parameter
ParameterFile string // --parameter-file
ServiceAccount string // --serviceaccount
OwnerReference *metav1.OwnerReference // useful if your custom controller creates argo workflow resources
}

// SubmitWorkflow validates and submit a single workflow and override some of the fields of the workflow
Expand Down Expand Up @@ -233,6 +234,10 @@ func SubmitWorkflow(wfIf v1alpha1.WorkflowInterface, wf *wfv1.Workflow, opts *Su
if opts.Name != "" {
wf.ObjectMeta.Name = opts.Name
}
if opts.OwnerReference != nil {
wf.SetOwnerReferences(append(wf.GetOwnerReferences(), *opts.OwnerReference))
}

err := validate.ValidateWorkflow(wf)
if err != nil {
return nil, err
Expand Down