-
Notifications
You must be signed in to change notification settings - Fork 3.2k
/
common.go
62 lines (55 loc) · 2.76 KB
/
common.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package v1alpha1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
)
type ResourceScope string
const (
ResourceScopeLocal ResourceScope = "local"
ResourceScopeNamespaced ResourceScope = "namespaced"
ResourceScopeCluster ResourceScope = "cluster"
)
// TemplateHolder is an object that holds templates; e.g. Workflow, WorkflowTemplate, and ClusterWorkflowTemplate
type TemplateHolder interface {
GetNamespace() string
GetName() string
GroupVersionKind() schema.GroupVersionKind
GetTemplateByName(name string) *Template
GetResourceScope() ResourceScope
}
// WorkflowSpecHolder is an object that holds a WorkflowSpec; e.g., WorkflowTemplate, and ClusterWorkflowTemplate
type WorkflowSpecHolder interface {
metav1.Object
GetWorkflowMetadata() *metav1.ObjectMeta
GetWorkflowSpec() *WorkflowSpec
}
// TemplateReferenceHolder is an object that holds a reference to other templates; e.g. WorkflowStep, DAGTask, and NodeStatus
type TemplateReferenceHolder interface {
GetTemplateName() string
GetTemplateRef() *TemplateRef
}
// SubmitOpts are workflow submission options
type SubmitOpts struct {
// Name overrides metadata.name
Name string `json:"name,omitempty" protobuf:"bytes,1,opt,name=name"`
// GenerateName overrides metadata.generateName
GenerateName string `json:"generateName,omitempty" protobuf:"bytes,2,opt,name=generateName"`
// Entrypoint overrides spec.entrypoint
Entrypoint string `json:"entryPoint,omitempty" protobuf:"bytes,4,opt,name=entrypoint"`
// Parameters passes input parameters to workflow
Parameters []string `json:"parameters,omitempty" protobuf:"bytes,5,rep,name=parameters"`
// ParameterFile holds a reference to a parameter file. This option is not supported in API
ParameterFile string `json:"parameterFile,omitempty" protobuf:"bytes,6,opt,name=parameterFile"`
// ServiceAccount runs all pods in the workflow using specified ServiceAccount.
ServiceAccount string `json:"serviceAccount,omitempty" protobuf:"bytes,7,opt,name=serviceAccount"`
// DryRun validates the workflow on the client-side without creating it. This option is not supported in API
DryRun bool `json:"dryRun,omitempty" protobuf:"varint,8,opt,name=dryRun"`
// ServerDryRun validates the workflow on the server-side without creating it
ServerDryRun bool `json:"serverDryRun,omitempty" protobuf:"varint,9,opt,name=serverDryRun"`
// Labels adds to metadata.labels
Labels string `json:"labels,omitempty" protobuf:"bytes,10,opt,name=labels"`
// OwnerReference creates a metadata.ownerReference
OwnerReference *metav1.OwnerReference `json:"ownerReference,omitempty" protobuf:"bytes,11,opt,name=ownerReference"`
// Annotations adds to metadata.labels
Annotations string `json:"annotations,omitempty" protobuf:"bytes,12,opt,name=annotations"`
}