From e800ed3e984372277bca6f9ed86e82d3ee6bc475 Mon Sep 17 00:00:00 2001 From: FogDong Date: Fri, 20 May 2022 16:02:52 +0800 Subject: [PATCH] Feat: add if in workflow struct Signed-off-by: FogDong --- apis/core.oam.dev/common/types.go | 6 ++++++ charts/vela-core/README.md | 11 ++++++----- .../crds/core.oam.dev_applicationrevisions.yaml | 4 ++++ charts/vela-core/crds/core.oam.dev_applications.yaml | 2 ++ charts/vela-core/crds/core.oam.dev_workflows.yaml | 4 ++++ charts/vela-core/templates/kubevela-controller.yaml | 1 + charts/vela-core/values.yaml | 2 ++ charts/vela-minimal/README.md | 11 ++++++----- .../crds/core.oam.dev_applicationrevisions.yaml | 4 ++++ .../vela-minimal/crds/core.oam.dev_applications.yaml | 2 ++ .../vela-minimal/templates/kubevela-controller.yaml | 1 + charts/vela-minimal/values.yaml | 2 ++ .../crds/core.oam.dev_applicationrevisions.yaml | 4 ++++ .../crds/core.oam.dev_applications.yaml | 2 ++ .../vela-core-legacy/crds/core.oam.dev_workflows.yaml | 4 ++++ 15 files changed, 50 insertions(+), 10 deletions(-) diff --git a/apis/core.oam.dev/common/types.go b/apis/core.oam.dev/common/types.go index 473cf4c7d..f7cad6eff 100644 --- a/apis/core.oam.dev/common/types.go +++ b/apis/core.oam.dev/common/types.go @@ -347,6 +347,8 @@ type WorkflowStep struct { SubSteps []WorkflowSubStep `json:"subSteps,omitempty"` + If string `json:"if,omitempty"` + DependsOn []string `json:"dependsOn,omitempty"` Inputs StepInputs `json:"inputs,omitempty"` @@ -397,6 +399,10 @@ const ( WorkflowStepPhaseSucceeded WorkflowStepPhase = "succeeded" // WorkflowStepPhaseFailed will report error in `message`. WorkflowStepPhaseFailed WorkflowStepPhase = "failed" + // WorkflowStepPhaseFailedAfterRetries will report error in `message` and stop retrying the step. + WorkflowStepPhaseFailedAfterRetries WorkflowStepPhase = "failedAfterRetries" + // WorkflowStepPhaseSkipped will make the controller skip the step. + WorkflowStepPhaseSkipped WorkflowStepPhase = "skipped" // WorkflowStepPhaseStopped will make the controller stop the workflow. WorkflowStepPhaseStopped WorkflowStepPhase = "stopped" // WorkflowStepPhaseRunning will make the controller continue the workflow. diff --git a/charts/vela-core/README.md b/charts/vela-core/README.md index 705a524e7..c544a477f 100644 --- a/charts/vela-core/README.md +++ b/charts/vela-core/README.md @@ -53,11 +53,12 @@ helm install --create-namespace -n vela-system kubevela kubevela/vela-core --wai ### KubeVela workflow parameters -| Name | Description | Value | -| -------------------------------------- | ------------------------------------------------------ | ----- | -| `workflow.backoff.maxTime.waitState` | The max backoff time of workflow in a wait condition | `60` | -| `workflow.backoff.maxTime.failedState` | The max backoff time of workflow in a failed condition | `300` | -| `workflow.step.errorRetryTimes` | The max retry times of a failed workflow step | `10` | +| Name | Description | Value | +| -------------------------------------- | ------------------------------------------------------ | ------- | +| `workflow.enableSuspendFailedWorkflow` | Enable suspend failed workflow | `false` | +| `workflow.backoff.maxTime.waitState` | The max backoff time of workflow in a wait condition | `60` | +| `workflow.backoff.maxTime.failedState` | The max backoff time of workflow in a failed condition | `300` | +| `workflow.step.errorRetryTimes` | The max retry times of a failed workflow step | `10` | ### KubeVela controller parameters diff --git a/charts/vela-core/crds/core.oam.dev_applicationrevisions.yaml b/charts/vela-core/crds/core.oam.dev_applicationrevisions.yaml index cfbeb0b72..7b2292c79 100644 --- a/charts/vela-core/crds/core.oam.dev_applicationrevisions.yaml +++ b/charts/vela-core/crds/core.oam.dev_applicationrevisions.yaml @@ -2209,6 +2209,8 @@ spec: items: type: string type: array + if: + type: string inputs: description: StepInputs defines variable input of WorkflowStep @@ -3954,6 +3956,8 @@ spec: items: type: string type: array + if: + type: string inputs: description: StepInputs defines variable input of WorkflowStep items: diff --git a/charts/vela-core/crds/core.oam.dev_applications.yaml b/charts/vela-core/crds/core.oam.dev_applications.yaml index c63283bc9..3fbe59f88 100644 --- a/charts/vela-core/crds/core.oam.dev_applications.yaml +++ b/charts/vela-core/crds/core.oam.dev_applications.yaml @@ -1020,6 +1020,8 @@ spec: items: type: string type: array + if: + type: string inputs: description: StepInputs defines variable input of WorkflowStep items: diff --git a/charts/vela-core/crds/core.oam.dev_workflows.yaml b/charts/vela-core/crds/core.oam.dev_workflows.yaml index 155367c3d..dd969b654 100644 --- a/charts/vela-core/crds/core.oam.dev_workflows.yaml +++ b/charts/vela-core/crds/core.oam.dev_workflows.yaml @@ -42,6 +42,8 @@ spec: items: type: string type: array + if: + type: string inputs: description: StepInputs defines variable input of WorkflowStep items: @@ -147,6 +149,8 @@ spec: items: type: string type: array + if: + type: string inputs: description: StepInputs defines variable input of WorkflowStep items: diff --git a/charts/vela-core/templates/kubevela-controller.yaml b/charts/vela-core/templates/kubevela-controller.yaml index ba94201ea..b89a9c20e 100644 --- a/charts/vela-core/templates/kubevela-controller.yaml +++ b/charts/vela-core/templates/kubevela-controller.yaml @@ -169,6 +169,7 @@ spec: - "--concurrent-reconciles={{ .Values.concurrentReconciles }}" - "--kube-api-qps={{ .Values.kubeClient.qps }}" - "--kube-api-burst={{ .Values.kubeClient.burst }}" + - "--enable-suspend-failed-workflow={{ .Values.workflow.enableSuspendFailedWorkflow }}" - "--max-workflow-wait-backoff-time={{ .Values.workflow.backoff.maxTime.waitState }}" - "--max-workflow-failed-backoff-time={{ .Values.workflow.backoff.maxTime.failedState }}" - "--max-workflow-step-error-retry-times={{ .Values.workflow.step.errorRetryTimes }}" diff --git a/charts/vela-core/values.yaml b/charts/vela-core/values.yaml index b89c4ae34..9b5706c37 100644 --- a/charts/vela-core/values.yaml +++ b/charts/vela-core/values.yaml @@ -35,10 +35,12 @@ dependCheckWait: 30s ## @section KubeVela workflow parameters +## @param workflow.enableSuspendFailedWorkflow Enable suspend failed workflow ## @param workflow.backoff.maxTime.waitState The max backoff time of workflow in a wait condition ## @param workflow.backoff.maxTime.failedState The max backoff time of workflow in a failed condition ## @param workflow.step.errorRetryTimes The max retry times of a failed workflow step workflow: + enableSuspendFailedWorkflow: false backoff: maxTime: waitState: 60 diff --git a/charts/vela-minimal/README.md b/charts/vela-minimal/README.md index 3d43be145..6d250ee6f 100644 --- a/charts/vela-minimal/README.md +++ b/charts/vela-minimal/README.md @@ -72,11 +72,12 @@ helm install --create-namespace -n vela-system kubevela kubevela/vela-minimal -- ### KubeVela workflow parameters -| Name | Description | Value | -| -------------------------------------- | ------------------------------------------------------ | ----- | -| `workflow.backoff.maxTime.waitState` | The max backoff time of workflow in a wait condition | `60` | -| `workflow.backoff.maxTime.failedState` | The max backoff time of workflow in a failed condition | `300` | -| `workflow.step.errorRetryTimes` | The max retry times of a failed workflow step | `10` | +| Name | Description | Value | +| -------------------------------------- | ------------------------------------------------------ | ------- | +| `workflow.enableSuspendFailedWorkflow` | Enable suspend failed workflow | `false` | +| `workflow.backoff.maxTime.waitState` | The max backoff time of workflow in a wait condition | `60` | +| `workflow.backoff.maxTime.failedState` | The max backoff time of workflow in a failed condition | `300` | +| `workflow.step.errorRetryTimes` | The max retry times of a failed workflow step | `10` | ### KubeVela controller parameters diff --git a/charts/vela-minimal/crds/core.oam.dev_applicationrevisions.yaml b/charts/vela-minimal/crds/core.oam.dev_applicationrevisions.yaml index cfbeb0b72..7b2292c79 100644 --- a/charts/vela-minimal/crds/core.oam.dev_applicationrevisions.yaml +++ b/charts/vela-minimal/crds/core.oam.dev_applicationrevisions.yaml @@ -2209,6 +2209,8 @@ spec: items: type: string type: array + if: + type: string inputs: description: StepInputs defines variable input of WorkflowStep @@ -3954,6 +3956,8 @@ spec: items: type: string type: array + if: + type: string inputs: description: StepInputs defines variable input of WorkflowStep items: diff --git a/charts/vela-minimal/crds/core.oam.dev_applications.yaml b/charts/vela-minimal/crds/core.oam.dev_applications.yaml index c63283bc9..3fbe59f88 100644 --- a/charts/vela-minimal/crds/core.oam.dev_applications.yaml +++ b/charts/vela-minimal/crds/core.oam.dev_applications.yaml @@ -1020,6 +1020,8 @@ spec: items: type: string type: array + if: + type: string inputs: description: StepInputs defines variable input of WorkflowStep items: diff --git a/charts/vela-minimal/templates/kubevela-controller.yaml b/charts/vela-minimal/templates/kubevela-controller.yaml index ebea018f1..7d7d705bc 100644 --- a/charts/vela-minimal/templates/kubevela-controller.yaml +++ b/charts/vela-minimal/templates/kubevela-controller.yaml @@ -139,6 +139,7 @@ spec: - "--concurrent-reconciles={{ .Values.concurrentReconciles }}" - "--kube-api-qps={{ .Values.kubeClient.qps }}" - "--kube-api-burst={{ .Values.kubeClient.burst }}" + - "--enable-suspend-failed-workflow={{ .Values.workflow.enableSuspendFailedWorkflow }}" - "--max-workflow-wait-backoff-time={{ .Values.workflow.backoff.maxTime.waitState }}" - "--max-workflow-failed-backoff-time={{ .Values.workflow.backoff.maxTime.failedState }}" - "--max-workflow-step-error-retry-times={{ .Values.workflow.step.errorRetryTimes }}" diff --git a/charts/vela-minimal/values.yaml b/charts/vela-minimal/values.yaml index 32d45270e..bca8c7adb 100644 --- a/charts/vela-minimal/values.yaml +++ b/charts/vela-minimal/values.yaml @@ -38,10 +38,12 @@ dependCheckWait: 30s ## @section KubeVela workflow parameters +## @param workflow.enableSuspendFailedWorkflow Enable suspend failed workflow ## @param workflow.backoff.maxTime.waitState The max backoff time of workflow in a wait condition ## @param workflow.backoff.maxTime.failedState The max backoff time of workflow in a failed condition ## @param workflow.step.errorRetryTimes The max retry times of a failed workflow step workflow: + enableSuspendFailedWorkflow: false backoff: maxTime: waitState: 60 diff --git a/legacy/charts/vela-core-legacy/crds/core.oam.dev_applicationrevisions.yaml b/legacy/charts/vela-core-legacy/crds/core.oam.dev_applicationrevisions.yaml index f0f4d2085..1b9711398 100644 --- a/legacy/charts/vela-core-legacy/crds/core.oam.dev_applicationrevisions.yaml +++ b/legacy/charts/vela-core-legacy/crds/core.oam.dev_applicationrevisions.yaml @@ -2209,6 +2209,8 @@ spec: items: type: string type: array + if: + type: string inputs: description: StepInputs defines variable input of WorkflowStep @@ -3954,6 +3956,8 @@ spec: items: type: string type: array + if: + type: string inputs: description: StepInputs defines variable input of WorkflowStep items: diff --git a/legacy/charts/vela-core-legacy/crds/core.oam.dev_applications.yaml b/legacy/charts/vela-core-legacy/crds/core.oam.dev_applications.yaml index 8a398661a..d15f720f3 100644 --- a/legacy/charts/vela-core-legacy/crds/core.oam.dev_applications.yaml +++ b/legacy/charts/vela-core-legacy/crds/core.oam.dev_applications.yaml @@ -1021,6 +1021,8 @@ spec: items: type: string type: array + if: + type: string inputs: description: StepInputs defines variable input of WorkflowStep items: diff --git a/legacy/charts/vela-core-legacy/crds/core.oam.dev_workflows.yaml b/legacy/charts/vela-core-legacy/crds/core.oam.dev_workflows.yaml index 0f0b9a14f..7cd19f8cd 100644 --- a/legacy/charts/vela-core-legacy/crds/core.oam.dev_workflows.yaml +++ b/legacy/charts/vela-core-legacy/crds/core.oam.dev_workflows.yaml @@ -42,6 +42,8 @@ spec: items: type: string type: array + if: + type: string inputs: description: StepInputs defines variable input of WorkflowStep items: @@ -147,6 +149,8 @@ spec: items: type: string type: array + if: + type: string inputs: description: StepInputs defines variable input of WorkflowStep items: