From 0a2134281b34d1d6ba0b9ea01d5eb0257afeeb14 Mon Sep 17 00:00:00 2001 From: Mihail Radkov Date: Wed, 10 Apr 2024 11:26:44 +0300 Subject: [PATCH] GDB-7986: Added feature toggles - `cluster.jobs.createCluster.enabled` - `cluster.jobs.patchCluster.enabled` - `cluster.jobs.scaleCluster.enabled` - `headlessService.enabled` - `proxy.service.enabled` - `proxy.headlessService.enabled` --- CHANGELOG.md | 7 +++++++ templates/graphdb/configmap.yaml | 2 +- templates/graphdb/service-headless.yaml | 2 ++ templates/jobs/configmap-cluster-config.yaml | 2 +- templates/jobs/job-create-cluster.yaml | 2 +- templates/jobs/job-patch-cluster.yaml | 2 +- templates/jobs/job-scale-down-cluster.yaml | 2 ++ templates/jobs/job-scale-up-cluster.yaml | 2 +- templates/proxy/service-headless.yaml | 2 +- templates/proxy/service.yaml | 2 +- values.yaml | 17 +++++++++++++++++ 11 files changed, 35 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e5222801..7296d069 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -60,6 +60,13 @@ TODO: decide how detailed we want this to be - Added `ports` mappings in each service - Added `extraContainerPorts` and `proxy.extraContainerPorts` - Added `imagePullPolicy` to the jobs containers +- Added feature toggles + - `cluster.jobs.createCluster.enabled` + - `cluster.jobs.patchCluster.enabled` + - `cluster.jobs.scaleCluster.enabled` + - `headlessService.enabled` + - `proxy.service.enabled` + - `proxy.headlessService.enabled` ### Updates diff --git a/templates/graphdb/configmap.yaml b/templates/graphdb/configmap.yaml index 4f27f181..d73d2de9 100644 --- a/templates/graphdb/configmap.yaml +++ b/templates/graphdb/configmap.yaml @@ -21,4 +21,4 @@ data: {{- if gt (int .Values.replicas) 1 }} -Dgraphdb.auth.token.secret={{ .Values.cluster.clusterSecret | quote }} {{- end }} - {{ default .Values.configuration.javaArguments}} + {{ .Values.configuration.javaArguments }} diff --git a/templates/graphdb/service-headless.yaml b/templates/graphdb/service-headless.yaml index c7c1cbd5..90696d80 100644 --- a/templates/graphdb/service-headless.yaml +++ b/templates/graphdb/service-headless.yaml @@ -1,3 +1,4 @@ +{{- if .Values.headlessService.enabled }} apiVersion: v1 kind: Service metadata: @@ -26,3 +27,4 @@ spec: targetPort: rpc protocol: TCP {{- end }} +{{- end }} diff --git a/templates/jobs/configmap-cluster-config.yaml b/templates/jobs/configmap-cluster-config.yaml index 2f6a0b75..3a4a4425 100644 --- a/templates/jobs/configmap-cluster-config.yaml +++ b/templates/jobs/configmap-cluster-config.yaml @@ -1,4 +1,4 @@ -{{- if and (gt (int .Values.replicas) 1) (not .Values.cluster.existingConfig) }} +{{- if and .Values.cluster.jobs.createCluster.enabled (gt (int .Values.replicas) 1) (not .Values.cluster.existingConfig) }} # Default configuration map for provisioning the GraphDB cluster configuration. # To change it, prepare another configuration map and update "graphdb.configs.clusterConfig" apiVersion: v1 diff --git a/templates/jobs/job-create-cluster.yaml b/templates/jobs/job-create-cluster.yaml index 06d3aec3..043265ad 100644 --- a/templates/jobs/job-create-cluster.yaml +++ b/templates/jobs/job-create-cluster.yaml @@ -1,4 +1,4 @@ -{{- if gt (int .Values.replicas) 1 }} +{{- if and .Values.cluster.jobs.createCluster.enabled (gt (int .Values.replicas) 1) }} apiVersion: batch/v1 kind: Job metadata: diff --git a/templates/jobs/job-patch-cluster.yaml b/templates/jobs/job-patch-cluster.yaml index 33953e8f..7d298584 100644 --- a/templates/jobs/job-patch-cluster.yaml +++ b/templates/jobs/job-patch-cluster.yaml @@ -1,4 +1,4 @@ -{{- if gt (int .Values.replicas) 1 }} +{{- if and .Values.cluster.jobs.patchCluster.enabled (gt (int .Values.replicas) 1) }} apiVersion: batch/v1 kind: Job metadata: diff --git a/templates/jobs/job-scale-down-cluster.yaml b/templates/jobs/job-scale-down-cluster.yaml index b5be5067..f2922eed 100644 --- a/templates/jobs/job-scale-down-cluster.yaml +++ b/templates/jobs/job-scale-down-cluster.yaml @@ -1,3 +1,4 @@ +{{- if .Values.cluster.jobs.scaleCluster.enabled }} apiVersion: batch/v1 kind: Job metadata: @@ -62,3 +63,4 @@ spec: - name: graphdb-utils configMap: name: {{ include "graphdb.fullname.configmap.utils" . }} +{{- end }} diff --git a/templates/jobs/job-scale-up-cluster.yaml b/templates/jobs/job-scale-up-cluster.yaml index 4b069563..d06a8c43 100644 --- a/templates/jobs/job-scale-up-cluster.yaml +++ b/templates/jobs/job-scale-up-cluster.yaml @@ -1,4 +1,4 @@ -{{- if gt (int .Values.replicas) 1 }} +{{- if and .Values.cluster.jobs.scaleCluster.enabled (gt (int .Values.replicas) 1) }} apiVersion: batch/v1 kind: Job metadata: diff --git a/templates/proxy/service-headless.yaml b/templates/proxy/service-headless.yaml index 3642eea7..04476730 100644 --- a/templates/proxy/service-headless.yaml +++ b/templates/proxy/service-headless.yaml @@ -1,4 +1,4 @@ -{{- if gt (int .Values.replicas) 1 }} +{{- if and .Values.proxy.headlessService.enabled (gt (int .Values.replicas) 1) }} apiVersion: v1 kind: Service metadata: diff --git a/templates/proxy/service.yaml b/templates/proxy/service.yaml index 4f4c7b98..4adaf000 100644 --- a/templates/proxy/service.yaml +++ b/templates/proxy/service.yaml @@ -1,4 +1,4 @@ -{{- if gt (int .Values.replicas) 1 }} +{{- if and .Values.proxy.service.enabled (gt (int .Values.replicas) 1) }} apiVersion: v1 kind: Service metadata: diff --git a/values.yaml b/values.yaml index 612e0701..e536b270 100644 --- a/values.yaml +++ b/values.yaml @@ -142,6 +142,17 @@ cluster: transactionLogMaximumSizeGB: 50 # The amount of time in milliseconds a follower node would wait before attempting to verify the last committed entry when the first verification is unsuccessful. verificationTimeout: 1500 + # Jobs configurations for to the cluster automation + jobs: + createCluster: + # Enables or disables the cluster creation Job + enabled: true + patchCluster: + # Enables or disables the Job for patching the cluster configuration + enabled: true + scaleCluster: + # Enables or disables the Jobs for scaling up or down the cluster + enabled: true ########################## # Ingress Configurations # @@ -183,6 +194,8 @@ ingress: ########################## headlessService: + # Enables or disables the headless Service deployment + enabled: true # Extra labels to append to the headless service labels: {} # Extra annotations to append to the service @@ -424,6 +437,8 @@ proxy: # GraphDB cluster proxy service configurations service: + # Enables or disables the Service deployment + enabled: true # Extra labels to append to the service labels: {} # Extra annotations to append to the service @@ -440,6 +455,8 @@ proxy: # GraphDB cluster proxy headless service configurations headlessService: + # Enables or disables the headless Service deployment + enabled: true # Extra labels to append to the headless service labels: {} # Extra annotations to append to the service