From bafc74edd358e8d9f9bc32ca604873dbef3d9e53 Mon Sep 17 00:00:00 2001 From: odubajDT <93584209+odubajDT@users.noreply.github.com> Date: Fri, 23 Feb 2024 09:47:05 +0100 Subject: [PATCH] feat(lifecycle-operator): introduce blockDeployment parameter into KeptnConfig (#3111) Signed-off-by: odubajDT Signed-off-by: vickysomtee --- .github/scripts/.helm-tests/default/result.yaml | 6 ++++++ .github/scripts/.helm-tests/lifecycle-only/result.yaml | 6 ++++++ .../scripts/.helm-tests/lifecycle-with-certs/result.yaml | 6 ++++++ docs/docs/reference/api-reference/options/v1alpha1/index.md | 1 + .../apis/options/v1alpha1/keptnconfig_types.go | 6 ++++++ lifecycle-operator/chart/templates/keptnconfig-crd.yaml | 6 ++++++ .../config/crd/bases/options.keptn.sh_keptnconfigs.yaml | 6 ++++++ test/chainsaw/integration/keptn-config/00-assert.yaml | 1 + test/chainsaw/integration/keptn-config/00-install.yaml | 1 + 9 files changed, 39 insertions(+) diff --git a/.github/scripts/.helm-tests/default/result.yaml b/.github/scripts/.helm-tests/default/result.yaml index 671ab517032..d76377536fa 100644 --- a/.github/scripts/.helm-tests/default/result.yaml +++ b/.github/scripts/.helm-tests/default/result.yaml @@ -2040,6 +2040,12 @@ spec: description: OTelCollectorUrl can be used to set the Open Telemetry collector that the lifecycle operator should use type: string + blockDeployment: + default: true + description: |- + BlockDeployment is used to block the deployment of the application until the pre-deployment + tasks and evaluations succeed + type: boolean cloudEventsEndpoint: description: CloudEventsEndpoint can be used to set the endpoint where Cloud Events should be posted by the lifecycle operator diff --git a/.github/scripts/.helm-tests/lifecycle-only/result.yaml b/.github/scripts/.helm-tests/lifecycle-only/result.yaml index 28b3616c627..185c881624e 100644 --- a/.github/scripts/.helm-tests/lifecycle-only/result.yaml +++ b/.github/scripts/.helm-tests/lifecycle-only/result.yaml @@ -1986,6 +1986,12 @@ spec: description: OTelCollectorUrl can be used to set the Open Telemetry collector that the lifecycle operator should use type: string + blockDeployment: + default: true + description: |- + BlockDeployment is used to block the deployment of the application until the pre-deployment + tasks and evaluations succeed + type: boolean cloudEventsEndpoint: description: CloudEventsEndpoint can be used to set the endpoint where Cloud Events should be posted by the lifecycle operator diff --git a/.github/scripts/.helm-tests/lifecycle-with-certs/result.yaml b/.github/scripts/.helm-tests/lifecycle-with-certs/result.yaml index 017a2341dad..4659fc98896 100644 --- a/.github/scripts/.helm-tests/lifecycle-with-certs/result.yaml +++ b/.github/scripts/.helm-tests/lifecycle-with-certs/result.yaml @@ -2015,6 +2015,12 @@ spec: description: OTelCollectorUrl can be used to set the Open Telemetry collector that the lifecycle operator should use type: string + blockDeployment: + default: true + description: |- + BlockDeployment is used to block the deployment of the application until the pre-deployment + tasks and evaluations succeed + type: boolean cloudEventsEndpoint: description: CloudEventsEndpoint can be used to set the endpoint where Cloud Events should be posted by the lifecycle operator diff --git a/docs/docs/reference/api-reference/options/v1alpha1/index.md b/docs/docs/reference/api-reference/options/v1alpha1/index.md index 564c341e580..1b1cf7eea65 100644 --- a/docs/docs/reference/api-reference/options/v1alpha1/index.md +++ b/docs/docs/reference/api-reference/options/v1alpha1/index.md @@ -66,5 +66,6 @@ _Appears in:_ | `OTelCollectorUrl` _string_ | OTelCollectorUrl can be used to set the Open Telemetry collector that the lifecycle operator should use || ✓ | | `keptnAppCreationRequestTimeoutSeconds` _integer_ | KeptnAppCreationRequestTimeoutSeconds is used to set the interval in which automatic app discovery searches for workload to put into the same auto-generated KeptnApp |30| ✓ | | `cloudEventsEndpoint` _string_ | CloudEventsEndpoint can be used to set the endpoint where Cloud Events should be posted by the lifecycle operator || ✓ | +| `blockDeployment` _boolean_ | BlockDeployment is used to block the deployment of the application until the pre-deployment tasks and evaluations succeed |true| ✓ | diff --git a/lifecycle-operator/apis/options/v1alpha1/keptnconfig_types.go b/lifecycle-operator/apis/options/v1alpha1/keptnconfig_types.go index c14925ff716..8a53cdab75a 100644 --- a/lifecycle-operator/apis/options/v1alpha1/keptnconfig_types.go +++ b/lifecycle-operator/apis/options/v1alpha1/keptnconfig_types.go @@ -41,6 +41,12 @@ type KeptnConfigSpec struct { // CloudEventsEndpoint can be used to set the endpoint where Cloud Events should be posted by the lifecycle operator // +optional CloudEventsEndpoint string `json:"cloudEventsEndpoint,omitempty"` + + // BlockDeployment is used to block the deployment of the application until the pre-deployment + // tasks and evaluations succeed + // +kubebuilder:default:=true + // +optional + BlockDeployment bool `json:"blockDeployment,omitempty"` } // +kubebuilder:object:root=true diff --git a/lifecycle-operator/chart/templates/keptnconfig-crd.yaml b/lifecycle-operator/chart/templates/keptnconfig-crd.yaml index 266fdb3bf19..2760ac2ee4a 100644 --- a/lifecycle-operator/chart/templates/keptnconfig-crd.yaml +++ b/lifecycle-operator/chart/templates/keptnconfig-crd.yaml @@ -51,6 +51,12 @@ spec: description: OTelCollectorUrl can be used to set the Open Telemetry collector that the lifecycle operator should use type: string + blockDeployment: + default: true + description: |- + BlockDeployment is used to block the deployment of the application until the pre-deployment + tasks and evaluations succeed + type: boolean cloudEventsEndpoint: description: CloudEventsEndpoint can be used to set the endpoint where Cloud Events should be posted by the lifecycle operator diff --git a/lifecycle-operator/config/crd/bases/options.keptn.sh_keptnconfigs.yaml b/lifecycle-operator/config/crd/bases/options.keptn.sh_keptnconfigs.yaml index af8e7f5e9e7..14636ef4a37 100644 --- a/lifecycle-operator/config/crd/bases/options.keptn.sh_keptnconfigs.yaml +++ b/lifecycle-operator/config/crd/bases/options.keptn.sh_keptnconfigs.yaml @@ -43,6 +43,12 @@ spec: description: OTelCollectorUrl can be used to set the Open Telemetry collector that the lifecycle operator should use type: string + blockDeployment: + default: true + description: |- + BlockDeployment is used to block the deployment of the application until the pre-deployment + tasks and evaluations succeed + type: boolean cloudEventsEndpoint: description: CloudEventsEndpoint can be used to set the endpoint where Cloud Events should be posted by the lifecycle operator diff --git a/test/chainsaw/integration/keptn-config/00-assert.yaml b/test/chainsaw/integration/keptn-config/00-assert.yaml index 024ccddbe01..df7a14a4656 100644 --- a/test/chainsaw/integration/keptn-config/00-assert.yaml +++ b/test/chainsaw/integration/keptn-config/00-assert.yaml @@ -4,3 +4,4 @@ metadata: name: "some-config" spec: OTelCollectorUrl: "some-url" + blockDeployment: true diff --git a/test/chainsaw/integration/keptn-config/00-install.yaml b/test/chainsaw/integration/keptn-config/00-install.yaml index 024ccddbe01..df7a14a4656 100644 --- a/test/chainsaw/integration/keptn-config/00-install.yaml +++ b/test/chainsaw/integration/keptn-config/00-install.yaml @@ -4,3 +4,4 @@ metadata: name: "some-config" spec: OTelCollectorUrl: "some-url" + blockDeployment: true