From c648dbc41d6c4ea2e45008995a363af0605bbcb1 Mon Sep 17 00:00:00 2001 From: Florian Bacher Date: Thu, 15 Feb 2024 09:05:41 +0100 Subject: [PATCH 1/2] feat(lifecycle-operator): add feature flag for enabling promotion tasks 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/main.go | 1 + 8 files changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/scripts/.helm-tests/default/result.yaml b/.github/scripts/.helm-tests/default/result.yaml index 190396ab9a..47210f497a 100644 --- a/.github/scripts/.helm-tests/default/result.yaml +++ b/.github/scripts/.helm-tests/default/result.yaml @@ -11425,6 +11425,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 6b7e87aa7b..661a189b85 100644 --- a/.github/scripts/.helm-tests/lifecycle-only/result.yaml +++ b/.github/scripts/.helm-tests/lifecycle-only/result.yaml @@ -8834,6 +8834,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 9dd218c14c..eb5d28e8c1 100644 --- a/.github/scripts/.helm-tests/lifecycle-with-certs/result.yaml +++ b/.github/scripts/.helm-tests/lifecycle-with-certs/result.yaml @@ -9148,6 +9148,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/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"` } From 0fa1aa8b58c14aee0eee80e84b64ca98d42b6faf Mon Sep 17 00:00:00 2001 From: Florian Bacher Date: Thu, 15 Feb 2024 10:00:51 +0100 Subject: [PATCH 2/2] add new env var to dev manifest as well Signed-off-by: Florian Bacher --- lifecycle-operator/config/manager/manager.yaml | 2 ++ 1 file changed, 2 insertions(+) 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: