From d4044c1c1a6fc9126aac456ba6e3bca05a5d541e Mon Sep 17 00:00:00 2001 From: Florian Bacher Date: Thu, 15 Feb 2024 10:08:40 +0100 Subject: [PATCH] feat(lifecycle-operator): add feature flag for enabling promotion tasks (#3055) Signed-off-by: Florian Bacher --- .github/scripts/.helm-tests/default/result.yaml | 2 ++ .github/scripts/.helm-tests/lifecycle-only/result.yaml | 2 ++ .github/scripts/.helm-tests/lifecycle-only/values.yaml | 1 + .github/scripts/.helm-tests/lifecycle-with-certs/result.yaml | 2 ++ lifecycle-operator/chart/README.md | 1 + lifecycle-operator/chart/templates/deployment.yaml | 3 +++ lifecycle-operator/chart/values.yaml | 4 +++- lifecycle-operator/config/manager/manager.yaml | 2 ++ lifecycle-operator/main.go | 1 + 9 files changed, 17 insertions(+), 1 deletion(-) diff --git a/.github/scripts/.helm-tests/default/result.yaml b/.github/scripts/.helm-tests/default/result.yaml index b6db62156d..990a23cff6 100644 --- a/.github/scripts/.helm-tests/default/result.yaml +++ b/.github/scripts/.helm-tests/default/result.yaml @@ -11478,6 +11478,8 @@ spec: value: "0" - name: SCHEDULING_GATES_ENABLED value: "false" + - name: PROMOTION_TASKS_ENABLED + value: "false" - name: KUBERNETES_CLUSTER_DOMAIN value: cluster.local - name: CERT_MANAGER_ENABLED diff --git a/.github/scripts/.helm-tests/lifecycle-only/result.yaml b/.github/scripts/.helm-tests/lifecycle-only/result.yaml index 0658703748..18b132c3d4 100644 --- a/.github/scripts/.helm-tests/lifecycle-only/result.yaml +++ b/.github/scripts/.helm-tests/lifecycle-only/result.yaml @@ -8887,6 +8887,8 @@ spec: value: "0" - name: SCHEDULING_GATES_ENABLED value: "false" + - name: PROMOTION_TASKS_ENABLED + value: "true" - name: KUBERNETES_CLUSTER_DOMAIN value: cluster.local - name: CERT_MANAGER_ENABLED diff --git a/.github/scripts/.helm-tests/lifecycle-only/values.yaml b/.github/scripts/.helm-tests/lifecycle-only/values.yaml index 62396aa88a..f8c1781932 100644 --- a/.github/scripts/.helm-tests/lifecycle-only/values.yaml +++ b/.github/scripts/.helm-tests/lifecycle-only/values.yaml @@ -8,6 +8,7 @@ global: lifecycleOperator: enabled: true + promotionTasksEnabled: true lifecycleOperator: image: repository: myrep diff --git a/.github/scripts/.helm-tests/lifecycle-with-certs/result.yaml b/.github/scripts/.helm-tests/lifecycle-with-certs/result.yaml index 8cf7adce8b..950c252e5b 100644 --- a/.github/scripts/.helm-tests/lifecycle-with-certs/result.yaml +++ b/.github/scripts/.helm-tests/lifecycle-with-certs/result.yaml @@ -9201,6 +9201,8 @@ spec: value: "0" - name: SCHEDULING_GATES_ENABLED value: "false" + - name: PROMOTION_TASKS_ENABLED + value: "false" - name: KUBERNETES_CLUSTER_DOMAIN value: cluster.local - name: CERT_MANAGER_ENABLED diff --git a/lifecycle-operator/chart/README.md b/lifecycle-operator/chart/README.md index 577640dc95..aff594ffa1 100644 --- a/lifecycle-operator/chart/README.md +++ b/lifecycle-operator/chart/README.md @@ -75,6 +75,7 @@ and application health checks | `annotations` | add deployment level annotations | `{}` | | `podAnnotations` | adds pod level annotations | `{}` | | `schedulingGatesEnabled` | enables the scheduling gates in lifecycle-operator. This feature is available in alpha version from K8s 1.27 or 1.26 enabling the alpha version | `false` | +| `promotionTasksEnabled` | enables the promotion task feature in the lifecycle-operator. | `false` | | `allowedNamespaces` | specifies the allowed namespaces for the lifecycle orchestration functionality | `[]` | | `deniedNamespaces` | specifies a list of namespaces where the lifecycle orchestration functionality is disabled, ignored if `allowedNamespaces` is set | `["cert-manager","keptn-system","observability","monitoring"]` | diff --git a/lifecycle-operator/chart/templates/deployment.yaml b/lifecycle-operator/chart/templates/deployment.yaml index 81b5be0a37..74f7fb9f87 100644 --- a/lifecycle-operator/chart/templates/deployment.yaml +++ b/lifecycle-operator/chart/templates/deployment.yaml @@ -102,6 +102,9 @@ spec: - name: SCHEDULING_GATES_ENABLED value: {{ .Values.schedulingGatesEnabled | quote }} + - name: PROMOTION_TASKS_ENABLED + value: {{ .Values.promotionTasksEnabled | quote + }} - name: KUBERNETES_CLUSTER_DOMAIN value: {{ .Values.kubernetesClusterDomain }} - name: CERT_MANAGER_ENABLED diff --git a/lifecycle-operator/chart/values.yaml b/lifecycle-operator/chart/values.yaml index 0a02d0d921..ec3c6a3d9e 100644 --- a/lifecycle-operator/chart/values.yaml +++ b/lifecycle-operator/chart/values.yaml @@ -164,7 +164,7 @@ lifecycleOperatorMetricsService: type: ClusterIP ## @section Global -## Current available parameters: kubernetesClusterDomain, imagePullSecrets, schedulingGatesEnabled, allowedNamespaces, deniedNamespaces +## Current available parameters: kubernetesClusterDomain, imagePullSecrets, schedulingGatesEnabled, allowedNamespaces, deniedNamespaces, promotionTasksEnabled ## @param kubernetesClusterDomain overrides cluster.local kubernetesClusterDomain: cluster.local ## @param annotations add deployment level annotations @@ -173,6 +173,8 @@ annotations: {} podAnnotations: {} ## @param schedulingGatesEnabled enables the scheduling gates in lifecycle-operator. This feature is available in alpha version from K8s 1.27 or 1.26 enabling the alpha version schedulingGatesEnabled: false +## @param promotionTasksEnabled enables the promotion task feature in the lifecycle-operator. +promotionTasksEnabled: false ## @param allowedNamespaces specifies the allowed namespaces for the lifecycle orchestration functionality allowedNamespaces: [] ## @param deniedNamespaces specifies a list of namespaces where the lifecycle orchestration functionality is disabled, ignored if `allowedNamespaces` is set diff --git a/lifecycle-operator/config/manager/manager.yaml b/lifecycle-operator/config/manager/manager.yaml index a3b25595d4..33ed6e0401 100644 --- a/lifecycle-operator/config/manager/manager.yaml +++ b/lifecycle-operator/config/manager/manager.yaml @@ -81,6 +81,8 @@ spec: value: "0" - name: SCHEDULING_GATES_ENABLED value: "false" + - name: PROMOTION_TASKS_ENABLED + value: "false" - name: CERT_MANAGER_ENABLED value: "true" securityContext: diff --git a/lifecycle-operator/main.go b/lifecycle-operator/main.go index 91f5fe33d8..56e2afa121 100644 --- a/lifecycle-operator/main.go +++ b/lifecycle-operator/main.go @@ -104,6 +104,7 @@ type envConfig struct { KeptnOptionsControllerLogLevel int `envconfig:"OPTIONS_CONTROLLER_LOG_LEVEL" default:"0"` SchedulingGatesEnabled bool `envconfig:"SCHEDULING_GATES_ENABLED" default:"false"` + PromotionTasksEnabled bool `envconfig:"PROMOTION_TASKS_ENABLED" default:"false"` CertManagerEnabled bool `envconfig:"CERT_MANAGER_ENABLED" default:"true"` }