@@ -2,8 +2,7 @@ package v1alpha1
22
33import (
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+ }
0 commit comments