diff --git a/config/samples/all_flash_cluster_cr.yaml b/config/samples/all_flash_cluster_cr.yaml index b165494d4..9ee6cee6c 100644 --- a/config/samples/all_flash_cluster_cr.yaml +++ b/config/samples/all_flash_cluster_cr.yaml @@ -12,7 +12,7 @@ metadata: spec: size: 2 - image: aerospike/aerospike-server-enterprise:6.4.0.0 + image: aerospike/aerospike-server-enterprise:7.0.0.0 storage: filesystemVolumePolicy: @@ -82,13 +82,12 @@ spec: port: 3002 namespaces: - name: test - memory-size: 3000000000 replication-factor: 2 index-type: type: flash mounts: - /test/dev/xvdf-index - mounts-size-limit: 4294967296 + mounts-budget: 4294967296 storage-engine: type: device devices: diff --git a/config/samples/dim_nostorage_cluster_cr.yaml b/config/samples/dim_nostorage_cluster_cr.yaml index 90a1c0ef2..50b18b353 100644 --- a/config/samples/dim_nostorage_cluster_cr.yaml +++ b/config/samples/dim_nostorage_cluster_cr.yaml @@ -5,7 +5,7 @@ metadata: namespace: aerospike spec: size: 2 - image: aerospike/aerospike-server-enterprise:6.4.0.0 + image: aerospike/aerospike-server-enterprise:7.0.0.0 podSpec: multiPodPerHost: true @@ -51,7 +51,7 @@ spec: port: 3002 namespaces: - name: test - memory-size: 3000000000 replication-factor: 2 storage-engine: type: memory + data-size: 1073741824 diff --git a/config/samples/dim_nostorage_cluster_skip_validation_cr.yaml b/config/samples/dim_nostorage_cluster_skip_validation_cr.yaml index a845b8a2f..0ef553842 100644 --- a/config/samples/dim_nostorage_cluster_skip_validation_cr.yaml +++ b/config/samples/dim_nostorage_cluster_skip_validation_cr.yaml @@ -20,7 +20,7 @@ metadata: spec: size: 2 - image: aerospike/aerospike-server-enterprise:6.4.0.0 + image: aerospike/aerospike-server-enterprise:7.0.0.0 podSpec: multiPodPerHost: true @@ -49,7 +49,7 @@ spec: port: 3002 namespaces: - name: test - memory-size: 3000000000 replication-factor: 2 storage-engine: type: memory + data-size: 1073741824 diff --git a/config/samples/hdd_dim_storage_cluster_cr.yaml b/config/samples/hdd_dim_storage_cluster_cr.yaml index af9e80e50..96be94226 100644 --- a/config/samples/hdd_dim_storage_cluster_cr.yaml +++ b/config/samples/hdd_dim_storage_cluster_cr.yaml @@ -6,7 +6,7 @@ metadata: spec: size: 2 - image: aerospike/aerospike-server-enterprise:6.4.0.0 + image: aerospike/aerospike-server-enterprise:7.0.0.0 storage: filesystemVolumePolicy: @@ -64,11 +64,9 @@ spec: port: 3002 namespaces: - name: test - memory-size: 3000000000 replication-factor: 2 storage-engine: - type: device + type: memory files: - /opt/aerospike/data/test.dat filesize: 2000000000 - data-in-memory: true diff --git a/config/samples/host_network_cluster_cr.yaml b/config/samples/host_network_cluster_cr.yaml index 0f2011b64..f513e030d 100644 --- a/config/samples/host_network_cluster_cr.yaml +++ b/config/samples/host_network_cluster_cr.yaml @@ -6,7 +6,7 @@ metadata: spec: size: 2 - image: aerospike/aerospike-server-enterprise:6.4.0.0 + image: aerospike/aerospike-server-enterprise:7.0.0.0 storage: filesystemVolumePolicy: @@ -62,7 +62,6 @@ spec: port: 3002 namespaces: - name: test - memory-size: 3000000000 replication-factor: 2 storage-engine: type: device diff --git a/config/samples/ldap_cluster_cr.yaml b/config/samples/ldap_cluster_cr.yaml index 1c71dd132..0e707cad9 100644 --- a/config/samples/ldap_cluster_cr.yaml +++ b/config/samples/ldap_cluster_cr.yaml @@ -14,7 +14,7 @@ metadata: namespace: aerospike spec: size: 2 - image: aerospike/aerospike-server-enterprise:6.4.0.0 + image: aerospike/aerospike-server-enterprise:7.0.0.0 podSpec: multiPodPerHost: true @@ -91,7 +91,7 @@ spec: ca-file: /etc/aerospike/secret/cacert.pem namespaces: - name: test - memory-size: 3000000000 replication-factor: 2 storage-engine: type: memory + data-size: 1073741824 diff --git a/config/samples/pmem_cluster_cr.yaml b/config/samples/pmem_cluster_cr.yaml index 3fc4f2664..48395e43b 100644 --- a/config/samples/pmem_cluster_cr.yaml +++ b/config/samples/pmem_cluster_cr.yaml @@ -6,7 +6,7 @@ metadata: spec: size: 2 - image: aerospike/aerospike-server-enterprise:6.4.0.0 + image: aerospike/aerospike-server-enterprise:7.0.0.0 storage: filesystemVolumePolicy: @@ -73,7 +73,6 @@ spec: port: 3002 namespaces: - name: test - memory-size: 3000000000 replication-factor: 2 storage-engine: type: pmem @@ -84,4 +83,4 @@ spec: type: pmem mounts: - /mnt/pmem1 - mounts-size-limit: 1073741824 + mounts-budget: 1073741824 diff --git a/config/samples/podspec_cr.yaml b/config/samples/podspec_cr.yaml index dbf1026b5..93591b4e3 100644 --- a/config/samples/podspec_cr.yaml +++ b/config/samples/podspec_cr.yaml @@ -6,7 +6,7 @@ metadata: spec: size: 2 - image: aerospike/aerospike-server-enterprise:6.4.0.0 + image: aerospike/aerospike-server-enterprise:7.0.0.0 storage: filesystemVolumePolicy: @@ -91,7 +91,7 @@ spec: namespaces: - name: test - memory-size: 3000000000 replication-factor: 2 storage-engine: type: memory + data-size: 1073741824 diff --git a/config/samples/rack_enabled_cluster_cr.yaml b/config/samples/rack_enabled_cluster_cr.yaml index 3e2d12e4f..ca2038a2d 100644 --- a/config/samples/rack_enabled_cluster_cr.yaml +++ b/config/samples/rack_enabled_cluster_cr.yaml @@ -6,7 +6,7 @@ metadata: spec: size: 2 - image: aerospike/aerospike-server-enterprise:6.4.0.0 + image: aerospike/aerospike-server-enterprise:7.0.0.0 rackConfig: namespaces: - test @@ -74,14 +74,13 @@ spec: namespaces: - name: test - memory-size: 3000000000 replication-factor: 2 storage-engine: type: device devices: - /test/dev/xvdf - name: testMem - memory-size: 3000000000 replication-factor: 1 storage-engine: type: memory + data-size: 1073741824 diff --git a/config/samples/sc_mode_cluster_cr.yaml b/config/samples/sc_mode_cluster_cr.yaml index 0122ffdeb..52ab65d6d 100644 --- a/config/samples/sc_mode_cluster_cr.yaml +++ b/config/samples/sc_mode_cluster_cr.yaml @@ -6,7 +6,7 @@ metadata: spec: size: 4 - image: aerospike/aerospike-server-enterprise:6.4.0.0 + image: aerospike/aerospike-server-enterprise:7.0.0.0 rosterNodeBlockList: - 1A0 @@ -71,7 +71,6 @@ spec: port: 3002 namespaces: - name: test - memory-size: 3000000000 replication-factor: 2 strong-consistency: true storage-engine: diff --git a/config/samples/shadow_device_cluster_cr.yaml b/config/samples/shadow_device_cluster_cr.yaml index f6a8e2f2a..68456b905 100644 --- a/config/samples/shadow_device_cluster_cr.yaml +++ b/config/samples/shadow_device_cluster_cr.yaml @@ -7,7 +7,7 @@ metadata: spec: # Add fields here size: 2 - image: aerospike/aerospike-server-enterprise:6.4.0.0 + image: aerospike/aerospike-server-enterprise:7.0.0.0 storage: filesystemVolumePolicy: @@ -71,7 +71,6 @@ spec: port: 3002 namespaces: - name: test - memory-size: 3000000000 replication-factor: 2 storage-engine: type: device diff --git a/config/samples/shadow_file_cluster_cr.yaml b/config/samples/shadow_file_cluster_cr.yaml index e72dfb9b2..af53079a1 100644 --- a/config/samples/shadow_file_cluster_cr.yaml +++ b/config/samples/shadow_file_cluster_cr.yaml @@ -7,7 +7,7 @@ metadata: spec: # Add fields here size: 2 - image: aerospike/aerospike-server-enterprise:6.4.0.0 + image: aerospike/aerospike-server-enterprise:7.0.0.0 storage: filesystemVolumePolicy: @@ -71,7 +71,6 @@ spec: port: 3002 namespaces: - name: test - memory-size: 3000000000 replication-factor: 2 storage-engine: type: device diff --git a/config/samples/ssd_storage_cluster_cr.yaml b/config/samples/ssd_storage_cluster_cr.yaml index 88eeaeb52..585e5a4a9 100644 --- a/config/samples/ssd_storage_cluster_cr.yaml +++ b/config/samples/ssd_storage_cluster_cr.yaml @@ -6,7 +6,7 @@ metadata: spec: size: 2 - image: aerospike/aerospike-server-enterprise:6.4.0.0 + image: aerospike/aerospike-server-enterprise:7.0.0.0 storage: filesystemVolumePolicy: @@ -62,7 +62,6 @@ spec: port: 3002 namespaces: - name: test - memory-size: 3000000000 replication-factor: 2 storage-engine: type: device diff --git a/config/samples/tls_cluster_cr.yaml b/config/samples/tls_cluster_cr.yaml index b63e8e8c5..c9c5f90fe 100644 --- a/config/samples/tls_cluster_cr.yaml +++ b/config/samples/tls_cluster_cr.yaml @@ -6,7 +6,7 @@ metadata: spec: size: 4 - image: aerospike/aerospike-server-enterprise:6.4.0.0 + image: aerospike/aerospike-server-enterprise:7.0.0.0 storage: filesystemVolumePolicy: @@ -77,11 +77,9 @@ spec: namespaces: - name: bar - memory-size: 3000000000 replication-factor: 1 storage-engine: type: device files: - /opt/aerospike/data/bar.dat filesize: 2000000000 - data-in-memory: true diff --git a/config/samples/xdr_dst_cluster_cr.yaml b/config/samples/xdr_dst_cluster_cr.yaml index 8d381b5ae..3fddcf46e 100644 --- a/config/samples/xdr_dst_cluster_cr.yaml +++ b/config/samples/xdr_dst_cluster_cr.yaml @@ -6,7 +6,7 @@ metadata: spec: size: 2 - image: aerospike/aerospike-server-enterprise:6.4.0.0 + image: aerospike/aerospike-server-enterprise:7.0.0.0 storage: filesystemVolumePolicy: @@ -63,11 +63,9 @@ spec: port: 3002 namespaces: - name: test - memory-size: 3000000000 replication-factor: 2 storage-engine: type: device files: - /opt/aerospike/data/test.dat filesize: 2000000000 - data-in-memory: true diff --git a/config/samples/xdr_src_cluster_cr.yaml b/config/samples/xdr_src_cluster_cr.yaml index c2d148d48..a38122efd 100644 --- a/config/samples/xdr_src_cluster_cr.yaml +++ b/config/samples/xdr_src_cluster_cr.yaml @@ -6,7 +6,7 @@ metadata: spec: size: 2 - image: aerospike/aerospike-server-enterprise:6.4.0.0 + image: aerospike/aerospike-server-enterprise:7.0.0.0 storage: filesystemVolumePolicy: @@ -84,11 +84,9 @@ spec: namespaces: - name: test - memory-size: 3000000000 replication-factor: 2 storage-engine: type: device files: - /opt/aerospike/data/test.dat filesize: 2000000000 - data-in-memory: true diff --git a/helm-charts/aerospike-cluster/README.md b/helm-charts/aerospike-cluster/README.md index c774be930..2b32d62c4 100644 --- a/helm-charts/aerospike-cluster/README.md +++ b/helm-charts/aerospike-cluster/README.md @@ -48,7 +48,7 @@ helm install aerospike ./aerospike-cluster/ \ | ---------- | ----------- | --------- | | `replicas` | Aerospike cluster size | `3` | | `image.repository` | Aerospike server container image repository | `aerospike/aerospike-server-enterprise` | -| `image.tag` | Aerospike server container image tag | `6.4.0.0` | +| `image.tag` | Aerospike server container image tag | `7.0.0.0` | | `imagePullSecrets` | Secrets containing credentials to pull Aerospike container image from a private registry | `{}` (nil) | | `customLabels` | Custom labels to add on the aerospikecluster resource | `{}` (nil) | | `aerospikeAccessControl` | Aerospike access control configuration. Define users and roles to be created on the cluster. | `{}` (nil) | @@ -85,10 +85,10 @@ aerospikeConfig: namespaces: - name: test - memory-size: 1073741824 # 1GiB replication-factor: 2 storage-engine: type: memory + data-size: 1073741824 # 1GiB podSpec: multiPodPerHost: true diff --git a/helm-charts/aerospike-cluster/templates/aerospike-cluster-cr.yaml b/helm-charts/aerospike-cluster/templates/aerospike-cluster-cr.yaml index b94cc0284..9f814f0a4 100644 --- a/helm-charts/aerospike-cluster/templates/aerospike-cluster-cr.yaml +++ b/helm-charts/aerospike-cluster/templates/aerospike-cluster-cr.yaml @@ -16,7 +16,7 @@ spec: size: {{ .Values.replicas | default 3 }} # Aerospike server docker image - image: {{ .Values.image.repository | default "aerospike/aerospike-server-enterprise" }}:{{ .Values.image.tag | default "6.4.0.0" }} + image: {{ .Values.image.repository | default "aerospike/aerospike-server-enterprise" }}:{{ .Values.image.tag | default "7.0.0.0" }} # Aerospike access control configuration {{- with .Values.aerospikeAccessControl }} @@ -43,10 +43,11 @@ spec: namespaces: - name: test - memory-size: 1073741824 # 1GiB replication-factor: 2 storage-engine: type: memory + data-size: 1073741824 # 1GiB + {{- end }} # Aerospike network policy diff --git a/helm-charts/aerospike-cluster/values.yaml b/helm-charts/aerospike-cluster/values.yaml index 515be0b13..9c322c3f9 100644 --- a/helm-charts/aerospike-cluster/values.yaml +++ b/helm-charts/aerospike-cluster/values.yaml @@ -8,7 +8,7 @@ replicas: 3 ## Aerospike server docker image image: repository: aerospike/aerospike-server-enterprise - tag: 6.4.0.0 + tag: 7.0.0.0 ## In case the above image is pulled from a registry that requires ## authentication, a secret containining credentials can be added @@ -53,10 +53,10 @@ aerospikeConfig: # namespaces: # - name: test - # memory-size: 1073741824 # 1GiB # replication-factor: 2 # storage-engine: # type: memory + # data-size: 1073741824 # 1GiB ## Aerospike secrets diff --git a/pkg/configschema/schemas b/pkg/configschema/schemas index 557c338db..b3f2db0a4 160000 --- a/pkg/configschema/schemas +++ b/pkg/configschema/schemas @@ -1 +1 @@ -Subproject commit 557c338db9ab7bb84d3c8f3550068ce9eb73aa36 +Subproject commit b3f2db0a48f09d2a963024934f3681afaaaf52bb diff --git a/test/batch_restart_pods_test.go b/test/batch_restart_pods_test.go index 5d53ef76e..118127941 100644 --- a/test/batch_restart_pods_test.go +++ b/test/batch_restart_pods_test.go @@ -20,9 +20,9 @@ import ( const batchClusterName = "batch-restart" var ( - unavailableImage = fmt.Sprintf("%s:%s", baseImage, "6.0.0.99") - availableImage1 = fmt.Sprintf("%s:%s", baseImage, "6.0.0.1") - availableImage2 = fmt.Sprintf("%s:%s", baseImage, "6.0.0.2") + unavailableImage = fmt.Sprintf("%s:%s", baseImage, "7.0.0.99") + availableImage1 = fmt.Sprintf("%s:%s", baseImage, "7.0.0.0_1") + availableImage2 = fmt.Sprintf("%s:%s", baseImage, "7.0.0.0_2") ) func percent(val string) *intstr.IntOrString { @@ -158,10 +158,10 @@ var _ = Describe("BatchRestart", func() { "namespaces": []interface{}{ map[string]interface{}{ "name": "bar", - "memory-size": 1000955200, "replication-factor": 2, "storage-engine": map[string]interface{}{ - "type": "memory", + "type": "memory", + "data-size": 1073741824, }, }, }, @@ -182,10 +182,10 @@ var _ = Describe("BatchRestart", func() { "namespaces": []interface{}{ map[string]interface{}{ "name": "bar", - "memory-size": 1000955200, "replication-factor": 2, "storage-engine": map[string]interface{}{ - "type": "memory", + "type": "memory", + "data-size": 1073741824, }, }, }, @@ -244,8 +244,8 @@ func BatchRollingRestart(ctx goctx.Context, clusterNamespacedName types.Namespac // Test steps // 1: update cluster to demand huge resources. It will unschedule batch of pods - // 2: verify if more than 1 pods are in unscheduled state. - // In default mode, there can not be more than 1 unscheduled pods + // 2: verify if more than 1 pod are in unscheduled state. + // In default mode, there cannot be more than 1 unscheduled pods // 3: update cluster to demand limited resources. It will schedule old unscheduled pods // Restart full rack at a time @@ -331,7 +331,8 @@ func BatchUpgrade(ctx goctx.Context, clusterNamespacedName types.NamespacedName) aeroCluster, err := getCluster(k8sClient, ctx, clusterNamespacedName) Expect(err).ToNot(HaveOccurred()) - _ = deleteCluster(k8sClient, ctx, aeroCluster) + err = deleteCluster(k8sClient, ctx, aeroCluster) + Expect(err).ToNot(HaveOccurred()) }, ) // Restart 1 node at a time @@ -350,8 +351,8 @@ func BatchUpgrade(ctx goctx.Context, clusterNamespacedName types.NamespacedName) // Test steps // 1: update cluster with unavailable image. It will unschedule batch of pods - // 2: verify if more than 1 pods are in unscheduled state. - // In default mode, there can not be more than 1 unscheduled pods + // 2: verify if more than 1 pod are in unscheduled state. + // In default mode, there cannot be more than 1 unscheduled pods // 3: update cluster to demand limited resources. It will schedule old unscheduled pods // Restart full rack at a time diff --git a/test/cluster_helper.go b/test/cluster_helper.go index 945b871a9..599b5428a 100644 --- a/test/cluster_helper.go +++ b/test/cluster_helper.go @@ -29,10 +29,10 @@ import ( const ( baseImage = "aerospike/aerospike-server-enterprise" - prevServerVersion = "6.3.0.0" + prevServerVersion = "6.4.0.0" pre6Version = "5.7.0.17" version6 = "6.0.0.5" - latestServerVersion = "6.4.0.0" + latestServerVersion = "7.0.0.0" invalidVersion = "3.0.0.4" ) @@ -321,7 +321,6 @@ func rollingRestartClusterByUpdatingNamespaceStorageTest( // Change namespace storage-engine namespaceConfig := aeroCluster.Spec.AerospikeConfig.Value["namespaces"].([]interface{})[0].(map[string]interface{}) - namespaceConfig["storage-engine"].(map[string]interface{})["data-in-memory"] = true namespaceConfig["storage-engine"].(map[string]interface{})["filesize"] = 2000000000 aeroCluster.Spec.AerospikeConfig.Value["namespaces"].([]interface{})[0] = namespaceConfig @@ -781,7 +780,7 @@ func createAerospikeClusterPost460( }, "network": getNetworkTLSConfig(), "namespaces": []interface{}{ - getNonSCNamespaceConfig("test", "/test/dev/xvdf"), + getNonSCNamespaceConfigPre700("test", "/test/dev/xvdf"), }, }, }, @@ -842,7 +841,7 @@ func createAerospikeClusterPost560( "security": map[string]interface{}{}, "network": getNetworkTLSConfig(), "namespaces": []interface{}{ - getNonSCNamespaceConfig("test", "/test/dev/xvdf"), + getNonSCNamespaceConfigPre700("test", "/test/dev/xvdf"), }, }, }, @@ -855,6 +854,17 @@ func createAerospikeClusterPost560( return aeroCluster } +func createAerospikeClusterPost640( + clusterNamespacedName types.NamespacedName, size int32, image string, +) *asdbv1.AerospikeCluster { + // create Aerospike custom resource + aeroCluster := createAerospikeClusterPost560(clusterNamespacedName, size, image) + aeroCluster.Spec.AerospikeConfig.Value["namespaces"] = []interface{}{ + getNonSCNamespaceConfig("test", "/test/dev/xvdf"), + } + + return aeroCluster +} func createDummyRackAwareWithStorageAerospikeCluster( clusterNamespacedName types.NamespacedName, size int32, ) *asdbv1.AerospikeCluster { @@ -1039,12 +1049,61 @@ func UpdateClusterImage( return err } - ov, err := asconfig.CompareVersions(outgoingVersion, "5.7.0") + ov, err := asconfig.CompareVersions(outgoingVersion, "7.0.0") if err != nil { return err } - nv, err := asconfig.CompareVersions(incomingVersion, "5.7.0") + nv, err := asconfig.CompareVersions(incomingVersion, "7.0.0") + if err != nil { + return err + } + + switch { + case nv >= 0 && ov >= 0, nv < 0 && ov < 0: + aerocluster.Spec.Image = image + + case nv >= 0 && ov < 0: + aerocluster.Spec.Image = image + + namespaces := aerocluster.Spec.AerospikeConfig.Value["namespaces"].([]interface{}) + for idx := range namespaces { + ns := namespaces[idx].(map[string]interface{}) + delete(ns, "memory-size") + + storageEngine := ns["storage-engine"].(map[string]interface{}) + if storageEngine["type"] == "memory" { + storageEngine["data-size"] = 1073741824 + ns["storage-engine"] = storageEngine + } + + namespaces[idx] = ns + } + + default: + aerocluster.Spec.Image = image + + namespaces := aerocluster.Spec.AerospikeConfig.Value["namespaces"].([]interface{}) + for idx := range namespaces { + ns := namespaces[idx].(map[string]interface{}) + ns["memory-size"] = 1073741824 + + storageEngine := ns["storage-engine"].(map[string]interface{}) + if storageEngine["type"] == "memory" { + delete(storageEngine, "data-size") + ns["storage-engine"] = storageEngine + } + + namespaces[idx] = ns + } + } + + ov, err = asconfig.CompareVersions(outgoingVersion, "5.7.0") + if err != nil { + return err + } + + nv, err = asconfig.CompareVersions(incomingVersion, "5.7.0") if err != nil { return err } @@ -1231,13 +1290,11 @@ func createHDDAndDataInMemStorageCluster( aeroCluster.Spec.AerospikeConfig.Value["namespaces"] = []interface{}{ map[string]interface{}{ "name": "test", - "memory-size": 2000955200, "replication-factor": repFact, "storage-engine": map[string]interface{}{ - "type": "device", - "files": []interface{}{"/opt/aerospike/data/test.dat"}, - "filesize": 2000955200, - "data-in-memory": true, + "type": "memory", + "files": []interface{}{"/opt/aerospike/data/test.dat"}, + "filesize": 2000955200, }, }, } @@ -1254,10 +1311,10 @@ func createDataInMemWithoutPersistentStorageCluster( aeroCluster.Spec.AerospikeConfig.Value["namespaces"] = []interface{}{ map[string]interface{}{ "name": "test", - "memory-size": 2000955200, "replication-factor": repFact, "storage-engine": map[string]interface{}{ - "type": "memory", + "type": "memory", + "data-size": 1073741824, }, }, } @@ -1389,7 +1446,6 @@ func getStorageVolumeForSecret() asdbv1.VolumeSpec { func getSCNamespaceConfig(name, path string) map[string]interface{} { return map[string]interface{}{ "name": name, - "memory-size": 1000955200, "replication-factor": 2, "strong-consistency": true, "storage-engine": map[string]interface{}{ @@ -1402,8 +1458,19 @@ func getSCNamespaceConfig(name, path string) map[string]interface{} { func getNonSCInMemoryNamespaceConfig(name string) map[string]interface{} { return map[string]interface{}{ "name": name, - "memory-size": 1000955200, "replication-factor": 2, + "storage-engine": map[string]interface{}{ + "type": "memory", + "data-size": 1073741824, + }, + } +} + +func getNonSCInMemoryNamespaceConfigPre700(name string) map[string]interface{} { + return map[string]interface{}{ + "name": name, + "replication-factor": 2, + "memory-size": 1073741824, "storage-engine": map[string]interface{}{ "type": "memory", }, @@ -1414,10 +1481,17 @@ func getNonSCNamespaceConfig(name, path string) map[string]interface{} { return getNonSCNamespaceConfigWithRF(name, path, 2) } +// getNonSCNamespaceConfigPre700 returns a namespace config for Aerospike version < 7.0.0 +func getNonSCNamespaceConfigPre700(name, path string) map[string]interface{} { + config := getNonSCNamespaceConfigWithRF(name, path, 2) + config["memory-size"] = 2000955200 + + return config +} + func getNonSCNamespaceConfigWithRF(name, path string, rf int) map[string]interface{} { return map[string]interface{}{ "name": name, - "memory-size": 1000955200, "replication-factor": rf, "storage-engine": map[string]interface{}{ "type": "device", diff --git a/test/cluster_test.go b/test/cluster_test.go index 6b0a1293a..d5af68e05 100644 --- a/test/cluster_test.go +++ b/test/cluster_test.go @@ -128,7 +128,7 @@ func ScaleDownWithMigrateFillDelay(ctx goctx.Context) { func DeployClusterForAllImagesPost490(ctx goctx.Context) { // post 4.9.0, need feature-key file versions := []string{ - "6.2.0.9", "6.1.0.14", "6.0.0.16", "5.7.0.8", "5.6.0.7", "5.5.0.3", "5.4.0.5", + "6.4.0.7", "6.3.0.13", "6.2.0.9", "6.1.0.14", "6.0.0.16", "5.7.0.8", "5.6.0.7", "5.5.0.3", "5.4.0.5", } for _, v := range versions { @@ -600,7 +600,6 @@ func UpdateClusterTest(ctx goctx.Context) { } dynamicNs := map[string]interface{}{ "name": "dynamicns", - "memory-size": 1000955200, "replication-factor": 2, "storage-engine": map[string]interface{}{ "type": "device", @@ -959,7 +958,7 @@ func negativeDeployClusterValidationTest( It( "MultipleCertSource: should fail if both SecretCertSource and CertPathInOperator is set", func() { - aeroCluster := createAerospikeClusterPost560( + aeroCluster := createAerospikeClusterPost640( clusterNamespacedName, 1, latestImage, ) aeroCluster.Spec.OperatorClientCertSpec.CertPathInOperator = &asdbv1.AerospikeCertPathInOperatorSource{} @@ -973,7 +972,7 @@ func negativeDeployClusterValidationTest( It( "MissingClientKeyFilename: should fail if ClientKeyFilename is missing", func() { - aeroCluster := createAerospikeClusterPost560( + aeroCluster := createAerospikeClusterPost640( clusterNamespacedName, 1, latestImage, ) aeroCluster.Spec.OperatorClientCertSpec.SecretCertSource.ClientKeyFilename = "" @@ -988,7 +987,7 @@ func negativeDeployClusterValidationTest( It( "Should fail if both CaCertsFilename and CaCertsSource is set", func() { - aeroCluster := createAerospikeClusterPost560( + aeroCluster := createAerospikeClusterPost640( clusterNamespacedName, 1, latestImage, ) aeroCluster.Spec.OperatorClientCertSpec.SecretCertSource.CaCertsSource = &asdbv1.CaCertsSource{} @@ -1003,7 +1002,7 @@ func negativeDeployClusterValidationTest( It( "MissingClientCertPath: should fail if clientCertPath is missing", func() { - aeroCluster := createAerospikeClusterPost560( + aeroCluster := createAerospikeClusterPost640( clusterNamespacedName, 1, latestImage, ) aeroCluster.Spec.OperatorClientCertSpec.SecretCertSource = nil @@ -1223,7 +1222,6 @@ func negativeDeployClusterValidationTest( ) secondNs := map[string]interface{}{ "name": "ns1", - "memory-size": 1000955200, "replication-factor": 2, "storage-engine": map[string]interface{}{ "type": "device", @@ -1368,7 +1366,7 @@ func negativeDeployClusterValidationTest( It( "WhenFeatureKeyExist: should fail for no feature-key-file path in storage volume", func() { - aeroCluster := createAerospikeClusterPost560( + aeroCluster := createAerospikeClusterPost640( clusterNamespacedName, 1, latestImage, ) aeroCluster.Spec.AerospikeConfig.Value["service"] = map[string]interface{}{ @@ -1382,7 +1380,7 @@ func negativeDeployClusterValidationTest( It( "WhenTLSExist: should fail for no tls path in storage volume", func() { - aeroCluster := createAerospikeClusterPost560( + aeroCluster := createAerospikeClusterPost640( clusterNamespacedName, 1, latestImage, ) aeroCluster.Spec.AerospikeConfig.Value["network"] = map[string]interface{}{ @@ -1401,7 +1399,7 @@ func negativeDeployClusterValidationTest( It( "WhenTLSExist: should fail for both ca-file and ca-path in tls", func() { - aeroCluster := createAerospikeClusterPost560( + aeroCluster := createAerospikeClusterPost640( clusterNamespacedName, 1, latestImage, ) aeroCluster.Spec.AerospikeConfig.Value["network"] = map[string]interface{}{ @@ -1423,7 +1421,7 @@ func negativeDeployClusterValidationTest( It( "WhenTLSExist: should fail for ca-file path pointing to Secret Manager", func() { - aeroCluster := createAerospikeClusterPost560( + aeroCluster := createAerospikeClusterPost640( clusterNamespacedName, 1, latestImage, ) aeroCluster.Spec.AerospikeConfig.Value["network"] = map[string]interface{}{ @@ -1444,7 +1442,7 @@ func negativeDeployClusterValidationTest( It( "WhenTLSExist: should fail for ca-path pointing to Secret Manager", func() { - aeroCluster := createAerospikeClusterPost560( + aeroCluster := createAerospikeClusterPost640( clusterNamespacedName, 1, latestImage, ) aeroCluster.Spec.AerospikeConfig.Value["network"] = map[string]interface{}{ @@ -1763,7 +1761,6 @@ func negativeUpdateClusterValidationTest( secondNs := map[string]interface{}{ "name": "ns1", - "memory-size": 1000955200, "replication-factor": 2, "storage-engine": map[string]interface{}{ "type": "device", @@ -1920,7 +1917,7 @@ func negativeUpdateClusterValidationTest( "InvalidAerospikeConfigSecret", func() { BeforeEach( func() { - aeroCluster := createAerospikeClusterPost560( + aeroCluster := createAerospikeClusterPost640( clusterNamespacedName, 2, latestImage, ) diff --git a/test/host_network_test.go b/test/host_network_test.go index fc21332c3..5c1b5315d 100644 --- a/test/host_network_test.go +++ b/test/host_network_test.go @@ -22,7 +22,7 @@ var _ = Describe( clusterNamespacedName := getNamespacedName( clusterName, namespace, ) - aeroCluster := createAerospikeClusterPost560( + aeroCluster := createAerospikeClusterPost640( clusterNamespacedName, 2, latestImage, ) aeroCluster.Spec.PodSpec.HostNetwork = true diff --git a/test/ldap_auth_test.go b/test/ldap_auth_test.go index ed7412d4f..52f4d16b3 100644 --- a/test/ldap_auth_test.go +++ b/test/ldap_auth_test.go @@ -179,10 +179,10 @@ func getAerospikeClusterSpecWithLDAP( map[string]interface{}{ "name": "test", "replication-factor": 2, - "memory-size": 3000000000, "migrate-sleep": 0, "storage-engine": map[string]interface{}{ - "type": "memory", + "type": "memory", + "data-size": 1073741824, }, }, }, diff --git a/test/network_policy_test.go b/test/network_policy_test.go index 158401fcb..82f725484 100644 --- a/test/network_policy_test.go +++ b/test/network_policy_test.go @@ -1363,7 +1363,6 @@ func getAerospikeClusterSpecWithNetworkPolicy( map[string]interface{}{ "name": "test", "replication-factor": networkTestPolicyClusterSize, - "memory-size": 3000000000, "migrate-sleep": 0, "storage-engine": map[string]interface{}{ "type": "device", diff --git a/test/storage_init_test.go b/test/storage_init_test.go index f0206d3c3..df127adac 100644 --- a/test/storage_init_test.go +++ b/test/storage_init_test.go @@ -20,6 +20,7 @@ import ( asdbv1 "github.com/aerospike/aerospike-kubernetes-operator/api/v1" "github.com/aerospike/aerospike-kubernetes-operator/pkg/jsonpatch" "github.com/aerospike/aerospike-kubernetes-operator/pkg/utils" + "github.com/aerospike/aerospike-management-lib/asconfig" ) const ( @@ -761,7 +762,7 @@ func getStorageInitAerospikeCluster( image string, ) *asdbv1.AerospikeCluster { // create Aerospike custom resource - return &asdbv1.AerospikeCluster{ + aerospike := &asdbv1.AerospikeCluster{ ObjectMeta: metav1.ObjectMeta{ Name: clusterNamespacedName.Name, Namespace: clusterNamespacedName.Namespace, @@ -802,20 +803,23 @@ func getStorageInitAerospikeCluster( "network": getNetworkConfig(), "security": map[string]interface{}{}, "namespaces": []interface{}{ - map[string]interface{}{ - "name": "test", - "replication-factor": storageInitTestClusterSize, - "memory-size": 3000000000, - "migrate-sleep": 0, - "storage-engine": map[string]interface{}{ - "type": "memory", - }, - }, + getNonSCInMemoryNamespaceConfig("test"), }, }, }, }, } + + version, _ := asdbv1.GetImageVersion(image) + ov, _ := asconfig.CompareVersions(version, "7.0.0") + + if ov < 0 { + aerospike.Spec.AerospikeConfig.Value["namespaces"] = []interface{}{ + getNonSCInMemoryNamespaceConfigPre700("test"), + } + } + + return aerospike } func getLongInitStorageConfig( diff --git a/test/storage_wipe_test.go b/test/storage_wipe_test.go index 999fa63d4..feef30681 100644 --- a/test/storage_wipe_test.go +++ b/test/storage_wipe_test.go @@ -355,7 +355,6 @@ func getAerospikeClusterConfig() *asdbv1.AerospikeConfigSpec { map[string]interface{}{ "name": "test", "replication-factor": 1, - "memory-size": 3000000000, "migrate-sleep": 0, "storage-engine": map[string]interface{}{ "type": "device", @@ -368,7 +367,6 @@ func getAerospikeClusterConfig() *asdbv1.AerospikeConfigSpec { map[string]interface{}{ "name": "test1", "replication-factor": 1, - "memory-size": 3000000000, "migrate-sleep": 0, "storage-engine": map[string]interface{}{ "type": "device", diff --git a/test/strong_consistency_test.go b/test/strong_consistency_test.go index b761a6100..9d3edadca 100644 --- a/test/strong_consistency_test.go +++ b/test/strong_consistency_test.go @@ -139,10 +139,10 @@ var _ = Describe("SCMode", func() { addedNs := "newns" conf := map[string]interface{}{ "name": addedNs, - "memory-size": 1000955200, "replication-factor": 2, "storage-engine": map[string]interface{}{ - "type": "memory", + "type": "memory", + "data-size": 1073741824, }, } aeroCluster.Spec.AerospikeConfig.Value["namespaces"] = @@ -306,11 +306,11 @@ var _ = Describe("SCMode", func() { "namespaces": []interface{}{ map[string]interface{}{ "name": sc1Name, - "memory-size": 1000955200, "replication-factor": 2, "strong-consistency": true, "storage-engine": map[string]interface{}{ - "type": "memory", + "type": "memory", + "data-size": 1073741824, }, }, }, @@ -456,10 +456,10 @@ func getSCAndNonSCAerospikeConfig() *asdbv1.AerospikeConfigSpec { conf := getSCAerospikeConfig() nonSCConf := map[string]interface{}{ "name": "bar", - "memory-size": 1000955200, "replication-factor": 2, "storage-engine": map[string]interface{}{ - "type": "memory", + "type": "memory", + "data-size": 1073741824, }, } conf.Value["namespaces"] = append(conf.Value["namespaces"].([]interface{}), nonSCConf) diff --git a/test/tls_authenticate_client_test.go b/test/tls_authenticate_client_test.go index db551b1ad..ed4b0ba38 100644 --- a/test/tls_authenticate_client_test.go +++ b/test/tls_authenticate_client_test.go @@ -197,7 +197,6 @@ func getAerospikeConfig( map[string]interface{}{ "name": "test", "replication-factor": 1, - "memory-size": 3000000000, "migrate-sleep": 0, "storage-engine": map[string]interface{}{ "type": "device", @@ -225,7 +224,6 @@ func getAerospikeConfig( map[string]interface{}{ "name": "test", "replication-factor": 1, - "memory-size": 3000000000, "migrate-sleep": 0, "storage-engine": map[string]interface{}{ "type": "device", diff --git a/test/utils.go b/test/utils.go index 955b4d723..6046917f2 100644 --- a/test/utils.go +++ b/test/utils.go @@ -253,7 +253,7 @@ func waitForAerospikeCluster( if errors.IsNotFound(err) { pkgLog.Info( "Waiting for availability of %s AerospikeCluster\n", - aeroCluster.Name, + "name", aeroCluster.Name, ) return false, nil } @@ -467,10 +467,10 @@ func NewAerospikeConfSpec(image string) (*AerospikeConfSpec, error) { namespaces := []interface{}{ map[string]interface{}{ "name": "test", - "memory-size": 1000955200, "replication-factor": 1, "storage-engine": map[string]interface{}{ - "type": "memory", + "type": "memory", + "data-size": 1073741824, }, }, } @@ -564,20 +564,35 @@ func getAeroClusterConfig( return nil, err } - cmpVal, err := asconfig.CompareVersions(version, "5.7.0") + cmpVal1, err := asconfig.CompareVersions(version, "5.7.0") if err != nil { return nil, err } - if cmpVal >= 0 { + cmpVal2, err := asconfig.CompareVersions(version, "7.0.0") + if err != nil { + return nil, err + } + + switch { + case cmpVal2 >= 0: + return createAerospikeClusterPost640( + namespace, 2, image, + ), nil + + case cmpVal1 >= 0: return createAerospikeClusterPost560( namespace, 2, image, ), nil - } - return createAerospikeClusterPost460( - namespace, 2, image, - ), nil + case cmpVal1 < 0: + return createAerospikeClusterPost460( + namespace, 2, image, + ), nil + + default: + return nil, fmt.Errorf("invalid image version %s", version) + } } func getAerospikeStorageConfig( diff --git a/test/warm_restart_test.go b/test/warm_restart_test.go index 6322e314a..6f91a8268 100644 --- a/test/warm_restart_test.go +++ b/test/warm_restart_test.go @@ -54,9 +54,11 @@ func rollCluster(ctx goCtx.Context, image string, expectWarmStart bool) { clusterName := "warm-restart-cluster" clusterNamespacedName := getNamespacedName(clusterName, namespace) - aeroCluster := createAerospikeClusterPost560( - clusterNamespacedName, 2, image, + aeroCluster, err := getAeroClusterConfig( + clusterNamespacedName, image, ) + Expect(err).ToNot(HaveOccurred()) + // Add a volume of type empty dir to figure if pod restarted. aeroCluster.Spec.Storage.Volumes = append( aeroCluster.Spec.Storage.Volumes, asdbv1.VolumeSpec{ @@ -67,7 +69,7 @@ func rollCluster(ctx goCtx.Context, image string, expectWarmStart bool) { Aerospike: &asdbv1.AerospikeServerVolumeAttachment{Path: tempTestDir}, }, ) - err := deployCluster(k8sClient, ctx, aeroCluster) + err = deployCluster(k8sClient, ctx, aeroCluster) Expect(err).ToNot(HaveOccurred()) defer func(