From 1bfae781ec4c6ad4cfcfd08772f0b3c3a4727ee0 Mon Sep 17 00:00:00 2001 From: Dawid Rusnak Date: Thu, 8 Aug 2024 14:36:12 +0200 Subject: [PATCH] feat: add options to control Test Workflow' containers isolation (#293) * feat: add options to control Test Workflow' containers isolation * fix: make TestWorkflowSystem variables optional --- api/testworkflows/v1/base_types.go | 11 +++++++++++ api/testworkflows/v1/step_types.go | 3 +++ ...stworkflows.testkube.io_testworkflows.yaml | 19 +++++++++++++++++++ ...ows.testkube.io_testworkflowtemplates.yaml | 19 +++++++++++++++++++ 4 files changed, 52 insertions(+) diff --git a/api/testworkflows/v1/base_types.go b/api/testworkflows/v1/base_types.go index 6b82afaf..f65d6eca 100644 --- a/api/testworkflows/v1/base_types.go +++ b/api/testworkflows/v1/base_types.go @@ -6,6 +6,9 @@ type TestWorkflowSpecBase struct { // events triggering execution of the test workflow Events []Event `json:"events,omitempty" expr:"include"` + // system configuration to define the orchestration behavior + System *TestWorkflowSystem `json:"system,omitempty" expr:"include"` + // make the instance configurable with some input data for scheduling it Config map[string]ParameterSchema `json:"config,omitempty" expr:"include"` @@ -25,3 +28,11 @@ type TestWorkflowSpecBase struct { // Deprecated: field is not used Notifications *NotificationsConfig `json:"notifications,omitempty" expr:"include"` } + +type TestWorkflowSystem struct { + // assume all the steps are pure by default + PureByDefault *bool `json:"pureByDefault,omitempty"` + + // disable the behavior of merging multiple operations in a single container + IsolatedContainers *bool `json:"isolatedContainers,omitempty"` +} diff --git a/api/testworkflows/v1/step_types.go b/api/testworkflows/v1/step_types.go index 1e4c681a..3a100472 100644 --- a/api/testworkflows/v1/step_types.go +++ b/api/testworkflows/v1/step_types.go @@ -24,6 +24,9 @@ type StepMeta struct { // expression to declare under which conditions the step should be run // defaults to: "passed", except artifacts where it defaults to "always" Condition string `json:"condition,omitempty" expr:"expression"` + + // mark the step as pure, applying optimizations to merge the containers together + Pure *bool `json:"pure,omitempty"` } type StepSource struct { diff --git a/config/crd/bases/testworkflows.testkube.io_testworkflows.yaml b/config/crd/bases/testworkflows.testkube.io_testworkflows.yaml index ccdc1943..56c2381c 100644 --- a/config/crd/bases/testworkflows.testkube.io_testworkflows.yaml +++ b/config/crd/bases/testworkflows.testkube.io_testworkflows.yaml @@ -1708,6 +1708,9 @@ spec: paused: description: pause the step initially type: boolean + pure: + description: mark the step as pure, applying optimizations to merge the containers together + type: boolean retry: description: policy for retrying the step properties: @@ -6434,6 +6437,9 @@ spec: paused: description: pause the step initially type: boolean + pure: + description: mark the step as pure, applying optimizations to merge the containers together + type: boolean retry: description: policy for retrying the step properties: @@ -9356,6 +9362,9 @@ spec: paused: description: pause the step initially type: boolean + pure: + description: mark the step as pure, applying optimizations to merge the containers together + type: boolean retry: description: policy for retrying the step properties: @@ -10612,6 +10621,16 @@ spec: type: string type: object type: array + system: + description: system configuration to define the orchestration behavior + properties: + isolatedContainers: + description: disable the behavior of merging multiple operations in a single container + type: boolean + pureByDefault: + description: assume all the steps are pure by default + type: boolean + type: object use: description: templates to include at a top-level of workflow items: diff --git a/config/crd/bases/testworkflows.testkube.io_testworkflowtemplates.yaml b/config/crd/bases/testworkflows.testkube.io_testworkflowtemplates.yaml index 1c4aa58e..1019c3c1 100644 --- a/config/crd/bases/testworkflows.testkube.io_testworkflowtemplates.yaml +++ b/config/crd/bases/testworkflows.testkube.io_testworkflowtemplates.yaml @@ -1691,6 +1691,9 @@ spec: paused: description: pause the step initially type: boolean + pure: + description: mark the step as pure, applying optimizations to merge the containers together + type: boolean retry: description: policy for retrying the step properties: @@ -6323,6 +6326,9 @@ spec: paused: description: pause the step initially type: boolean + pure: + description: mark the step as pure, applying optimizations to merge the containers together + type: boolean retry: description: policy for retrying the step properties: @@ -9171,6 +9177,9 @@ spec: paused: description: pause the step initially type: boolean + pure: + description: mark the step as pure, applying optimizations to merge the containers together + type: boolean retry: description: policy for retrying the step properties: @@ -10370,6 +10379,16 @@ spec: type: string type: object type: array + system: + description: system configuration to define the orchestration behavior + properties: + isolatedContainers: + description: disable the behavior of merging multiple operations in a single container + type: boolean + pureByDefault: + description: assume all the steps are pure by default + type: boolean + type: object type: object required: - spec