Skip to content

Commit b1d0924

Browse files
committed
chore: moves workflow crd helper structs to this repo
Signed-off-by: Amit Singh <singhamitch@outlook.com>
1 parent 528095b commit b1d0924

4 files changed

Lines changed: 259 additions & 9 deletions

File tree

apis/oam/v1alpha1/workflow_types.go

Lines changed: 75 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ package v1alpha1
22

33
import (
44
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
5-
6-
workflowv1alpha1 "github.com/kubevela/workflow/api/v1alpha1"
5+
"k8s.io/apimachinery/pkg/runtime"
76
)
87

98
// +kubebuilder:object:root=true
@@ -17,8 +16,8 @@ type Workflow struct {
1716
metav1.TypeMeta `json:",inline"`
1817
metav1.ObjectMeta `json:"metadata,omitempty"`
1918

20-
Mode *workflowv1alpha1.WorkflowExecuteMode `json:"mode,omitempty"`
21-
workflowv1alpha1.WorkflowSpec `json:",inline"`
19+
Mode *WorkflowExecuteMode `json:"mode,omitempty"`
20+
WorkflowSpec `json:",inline"`
2221
}
2322

2423
// +kubebuilder:object:root=true
@@ -30,3 +29,75 @@ type WorkflowList struct {
3029
metav1.ListMeta `json:"metadata,omitempty"`
3130
Items []Workflow `json:"items"`
3231
}
32+
33+
// InputItem defines an input variable of WorkflowStep
34+
type InputItem struct {
35+
ParameterKey string `json:"parameterKey,omitempty"`
36+
From string `json:"from"`
37+
}
38+
39+
// OutputItem defines an output variable of WorkflowStep
40+
type OutputItem struct {
41+
ValueFrom string `json:"valueFrom"`
42+
Name string `json:"name"`
43+
}
44+
45+
// StepOutputs defines output variable of WorkflowStep
46+
type StepOutputs []OutputItem
47+
48+
// StepInputs defines variable input of WorkflowStep
49+
type StepInputs []InputItem
50+
51+
// WorkflowStepMeta contains the meta data of a workflow step
52+
type WorkflowStepMeta struct {
53+
Alias string `json:"alias,omitempty"`
54+
}
55+
56+
// WorkflowStepBase defines the workflow step base
57+
type WorkflowStepBase struct {
58+
// Name is the unique name of the workflow step.
59+
Name string `json:"name,omitempty"`
60+
// Type is the type of the workflow step.
61+
Type string `json:"type"`
62+
// Meta is the meta data of the workflow step.
63+
Meta *WorkflowStepMeta `json:"meta,omitempty"`
64+
// If is the if condition of the step
65+
If string `json:"if,omitempty"`
66+
// Timeout is the timeout of the step
67+
Timeout string `json:"timeout,omitempty"`
68+
// DependsOn is the dependency of the step
69+
DependsOn []string `json:"dependsOn,omitempty"`
70+
// Inputs is the inputs of the step
71+
Inputs StepInputs `json:"inputs,omitempty"`
72+
// Outputs is the outputs of the step
73+
Outputs StepOutputs `json:"outputs,omitempty"`
74+
75+
// Properties is the properties of the step
76+
// +kubebuilder:pruning:PreserveUnknownFields
77+
Properties *runtime.RawExtension `json:"properties,omitempty"`
78+
}
79+
80+
// WorkflowStep defines how to execute a workflow step.
81+
type WorkflowStep struct {
82+
WorkflowStepBase `json:",inline"`
83+
// Mode is only valid for sub steps, it defines the mode of the sub steps
84+
// +nullable
85+
Mode WorkflowMode `json:"mode,omitempty"`
86+
SubSteps []WorkflowStepBase `json:"subSteps,omitempty"`
87+
}
88+
89+
// WorkflowSpec defines workflow steps and other attributes
90+
type WorkflowSpec struct {
91+
Steps []WorkflowStep `json:"steps,omitempty"`
92+
}
93+
94+
// WorkflowMode describes the mode of workflow
95+
type WorkflowMode string
96+
97+
// WorkflowExecuteMode defines the mode of workflow execution
98+
type WorkflowExecuteMode struct {
99+
// Steps is the mode of workflow steps execution
100+
Steps WorkflowMode `json:"steps,omitempty"`
101+
// SubSteps is the mode of workflow sub steps execution
102+
SubSteps WorkflowMode `json:"subSteps,omitempty"`
103+
}

apis/oam/v1alpha1/zz_generated.deepcopy.go

Lines changed: 184 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go.mod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ require (
7676
github.com/inconshreveable/mousetrap v1.1.0 // indirect
7777
github.com/josharian/intern v1.0.0 // indirect
7878
github.com/json-iterator/go v1.1.12 // indirect
79-
github.com/kubevela/workflow v0.6.2
8079
github.com/mailru/easyjson v0.7.7 // indirect
8180
github.com/mattn/go-colorable v0.1.13 // indirect
8281
github.com/mattn/go-isatty v0.0.20 // indirect

go.sum

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,6 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
129129
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
130130
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
131131
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
132-
github.com/kubevela/workflow v0.6.2 h1:zmsjQStemSSAJVACsf9c39WTIJqdn1YQlb5jltOfSwU=
133-
github.com/kubevela/workflow v0.6.2/go.mod h1:nJIoAw1SHthfLhJqFFKX2dwwoDy6vF2DZrBdlAJNSXU=
134132
github.com/lib/pq v1.10.7 h1:p7ZhMD+KsSRozJr34udlUrhboJwWAgCg34+/ZZNvZZw=
135133
github.com/lib/pq v1.10.7/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
136134
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=

0 commit comments

Comments
 (0)