From aeb0ec91b14f4eae8fefc83368b0a9d1f593af49 Mon Sep 17 00:00:00 2001 From: Tanmay Jain <103629776+tanmayja@users.noreply.github.com> Date: Fri, 9 Aug 2024 10:14:11 +0530 Subject: [PATCH] Adding missing fields in aerospike-cluster-cr.yaml (#306) * Adding missing fields in aerospike-cluster-cr.yaml * Adding fields value reference in values.yaml --- .../templates/aerospike-cluster-cr.yaml | 22 ++++++++++++++++++- helm-charts/aerospike-cluster/values.yaml | 22 ++++++++++++++++++- .../aerospike-kubernetes-operator/values.yaml | 2 +- test/on_demand_operations_test.go | 20 +++++++++-------- 4 files changed, 54 insertions(+), 12 deletions(-) diff --git a/helm-charts/aerospike-cluster/templates/aerospike-cluster-cr.yaml b/helm-charts/aerospike-cluster/templates/aerospike-cluster-cr.yaml index 5ba0dc431..103e13f6e 100644 --- a/helm-charts/aerospike-cluster/templates/aerospike-cluster-cr.yaml +++ b/helm-charts/aerospike-cluster/templates/aerospike-cluster-cr.yaml @@ -13,11 +13,18 @@ metadata: spec: # Aerospike cluster size - size: {{ .Values.replicas | default 3 }} + size: {{ .Values.replicas }} # Aerospike server docker image image: {{ .Values.image.repository | default "aerospike/aerospike-server-enterprise" }}:{{ .Values.image.tag | default "7.1.0.0" }} + ## maxUnavailable defines percentage/number of pods that can be allowed to go down or unavailable + ## before application disruption. + maxUnavailable: {{ .Values.maxUnavailable }} + + ## Disable the PodDisruptionBudget creation for the Aerospike cluster. + disablePDB: {{ .Values.disablePDB }} + # Aerospike access control configuration {{- with .Values.aerospikeAccessControl }} aerospikeAccessControl: {{- toYaml . | nindent 4 }} @@ -50,6 +57,9 @@ spec: {{- end }} + ## enableDynamicConfigUpdate enables dynamic config update flow of the operator. + enableDynamicConfigUpdate: {{ .Values.enableDynamicConfigUpdate }} + # Aerospike network policy {{- with .Values.aerospikeNetworkPolicy }} aerospikeNetworkPolicy: {{- toYaml . | nindent 4 }} @@ -106,3 +116,13 @@ spec: {{- with .Values.seedsFinderServices }} seedsFinderServices: {{- toYaml . | nindent 4 }} {{- end }} + + ## rosterNodeBlockList is a list of blocked nodeIDs from roster in a strong-consistency setup + {{- with .Values.rosterNodeBlockList }} + rosterNodeBlockList: {{- toYaml . | nindent 4 }} + {{- end }} + + ## k8sNodeBlockList is a list of Kubernetes nodes which are not used for Aerospike pods. + {{- with .Values.k8sNodeBlockList }} + k8sNodeBlockList: {{- toYaml . | nindent 4 }} + {{- end }} \ No newline at end of file diff --git a/helm-charts/aerospike-cluster/values.yaml b/helm-charts/aerospike-cluster/values.yaml index cb9774064..2b1ad06f1 100644 --- a/helm-charts/aerospike-cluster/values.yaml +++ b/helm-charts/aerospike-cluster/values.yaml @@ -11,7 +11,7 @@ image: tag: 7.1.0.0 ## In case the above image is pulled from a registry that requires -## authentication, a secret containining credentials can be added +## authentication, a secret containing credentials can be added ## imagePullSecrets: ## - secret_with_credentials_to_custom_registry imagePullSecrets: {} @@ -113,3 +113,23 @@ operatorClientCert: {} ## Dev Mode devMode: false + +## maxUnavailable defines percentage/number of pods that can be allowed to go down or unavailable +## before application disruption. +maxUnavailable: 1 + +## Disable the PodDisruptionBudget creation for the Aerospike cluster. +disablePDB: false + +## enableDynamicConfigUpdate enables dynamic config update flow of the operator. +enableDynamicConfigUpdate: false + +## rosterNodeBlockList is a list of blocked nodeIDs from roster in a strong-consistency setup +## Replace the value with aerospike node id which needs to be blocked. +rosterNodeBlockList: [] +# - + +## k8sNodeBlockList is a list of Kubernetes nodes which are not used for Aerospike pods. +## Replace the value with kubernetes cluster node name which needs to be blocked. +k8sNodeBlockList: [] +# - \ No newline at end of file diff --git a/helm-charts/aerospike-kubernetes-operator/values.yaml b/helm-charts/aerospike-kubernetes-operator/values.yaml index 3befb4221..faea89650 100644 --- a/helm-charts/aerospike-kubernetes-operator/values.yaml +++ b/helm-charts/aerospike-kubernetes-operator/values.yaml @@ -8,7 +8,7 @@ operatorImage: pullPolicy: IfNotPresent ## In case the above image is pulled from a registry that requires -## authentication, a secret containining credentials can be added +## authentication, a secret containing credentials can be added ## imagePullSecrets: ## - secret_with_credentials_to_custom_registry imagePullSecrets: {} diff --git a/test/on_demand_operations_test.go b/test/on_demand_operations_test.go index ed32c6bf2..b3a5644f4 100644 --- a/test/on_demand_operations_test.go +++ b/test/on_demand_operations_test.go @@ -3,6 +3,7 @@ package test import ( goctx "context" "fmt" + "time" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -80,7 +81,7 @@ var _ = Describe( ) It( - "Should execute podRestart operations on all pods", func() { + "Should execute podRestart operation on all pods", func() { aeroCluster, err := getCluster( k8sClient, ctx, clusterNamespacedName, ) @@ -138,16 +139,17 @@ var _ = Describe( err = k8sClient.Update(ctx, aeroCluster) Expect(err).ToNot(HaveOccurred()) - aeroCluster, err = getCluster( - k8sClient, ctx, clusterNamespacedName, - ) - Expect(err).ToNot(HaveOccurred()) + Eventually(func() error { + aeroCluster, err = getCluster( + k8sClient, ctx, clusterNamespacedName, + ) + Expect(err).ToNot(HaveOccurred()) - aeroCluster.Spec.Operations[0].Kind = asdbv1.OperationPodRestart - aeroCluster.Spec.Operations[0].ID = "2" + aeroCluster.Spec.Operations[0].Kind = asdbv1.OperationPodRestart + aeroCluster.Spec.Operations[0].ID = "2" - err = updateCluster(k8sClient, ctx, aeroCluster) - Expect(err).ToNot(HaveOccurred()) + return updateCluster(k8sClient, ctx, aeroCluster) + }, 1*time.Minute).ShouldNot(HaveOccurred()) operationTypeMap := map[string]asdbv1.OperationKind{ "operations-1-0": asdbv1.OperationPodRestart,