Skip to content

Commit

Permalink
Adding dnamic config test for all integer types
Browse files Browse the repository at this point in the history
  • Loading branch information
tanmayja committed Apr 14, 2024
1 parent aafd2ab commit cf51e34
Show file tree
Hide file tree
Showing 6 changed files with 385 additions and 8 deletions.
11 changes: 5 additions & 6 deletions api/v1/aerospikecluster_mutating_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"

"github.com/aerospike/aerospike-kubernetes-operator/pkg/merge"
lib "github.com/aerospike/aerospike-management-lib"
)

//nolint:lll // for readability
Expand Down Expand Up @@ -248,21 +249,19 @@ func (c *AerospikeCluster) updateRacksAerospikeConfigFromGlobal(asLog logr.Logge
for idx := range c.Spec.RackConfig.Racks {
rack := &c.Spec.RackConfig.Racks[idx]

var (
m map[string]interface{}
err error
)
var m map[string]interface{}

if rack.InputAerospikeConfig != nil {
// Merge this rack's and global config.
m, err = merge.Merge(
merged, err := merge.Merge(
c.Spec.AerospikeConfig.Value, rack.InputAerospikeConfig.Value,
)

if err != nil {
return err
}

m = lib.DeepCopy(merged).(map[string]interface{})

asLog.V(1).Info(
"Merged rack config from global aerospikeConfig", "rack id",
rack.ID, "rackAerospikeConfig", m, "globalAerospikeConfig",
Expand Down
2 changes: 1 addition & 1 deletion controllers/aero_info_calls.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ func (r *SingleClusterReconciler) setDynamicConfig(

for _, host := range selectedHostConns {
podName := podIPNameMap[host.ASConn.AerospikeHostName]
asConfCmds, err := asconfig.CreateSetConfigCmdList(dynamicConfDiffPerPod[podName],
asConfCmds, err := asconfig.CreateSetConfigCmdList(r.Log, dynamicConfDiffPerPod[podName],
host.ASConn, r.getClientPolicy())

if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.21
toolchain go1.21.8

require (
github.com/aerospike/aerospike-management-lib v1.3.1-0.20240404063536-2adfbedf9687
github.com/aerospike/aerospike-management-lib v1.3.1-0.20240414093735-a11e7fe7c3ec
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d
github.com/evanphx/json-patch v4.12.0+incompatible
github.com/go-logr/logr v1.3.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ github.com/aerospike/aerospike-management-lib v1.2.1-0.20240325134810-f8046fe987
github.com/aerospike/aerospike-management-lib v1.2.1-0.20240325134810-f8046fe9872e/go.mod h1:E4dk798IikCp9a8fugpYoeQVIXuvdxogHvt6sKhaORQ=
github.com/aerospike/aerospike-management-lib v1.3.1-0.20240404063536-2adfbedf9687 h1:d7oDvHmiKhq4rzcD/w3z9tP3wH0+iaDvxKDk3IYuqeU=
github.com/aerospike/aerospike-management-lib v1.3.1-0.20240404063536-2adfbedf9687/go.mod h1:E4dk798IikCp9a8fugpYoeQVIXuvdxogHvt6sKhaORQ=
github.com/aerospike/aerospike-management-lib v1.3.1-0.20240414093735-a11e7fe7c3ec h1:o0G+fsUiUfiKU/tnG20/rhHsKd579HkWPMvzz7OwtSU=
github.com/aerospike/aerospike-management-lib v1.3.1-0.20240414093735-a11e7fe7c3ec/go.mod h1:E4dk798IikCp9a8fugpYoeQVIXuvdxogHvt6sKhaORQ=
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d h1:Byv0BzEl3/e6D5CLfI0j/7hiIEtvGVFPCZ7Ei2oq8iQ=
Expand Down
18 changes: 18 additions & 0 deletions test/cluster_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -1006,6 +1006,7 @@ func createDummyAerospikeClusterWithoutStorage(
return createDummyAerospikeClusterWithRFAndStorage(clusterNamespacedName, size, 1, nil)
}


Check failure on line 1009 in test/cluster_helper.go

View workflow job for this annotation

GitHub Actions / lint

File is not `gofmt`-ed with `-s` (gofmt)
func createDummyAerospikeClusterWithRF(
clusterNamespacedName types.NamespacedName, size int32, rf int,
) *asdbv1.AerospikeCluster {
Expand Down Expand Up @@ -1554,6 +1555,23 @@ func getSCNamespaceConfig(name, path string) map[string]interface{} {
}
}

func getSCNamespaceConfigWithSet(name, path string) map[string]interface{} {
return map[string]interface{}{
"name": name,
"replication-factor": 2,
"strong-consistency": true,
"storage-engine": map[string]interface{}{
"type": "device",
"devices": []interface{}{path},
},
"sets": []map[string]interface{}{
{
"name": "testset",
},
},
}
}

func getNonSCInMemoryNamespaceConfig(name string) map[string]interface{} {
return map[string]interface{}{
"name": name,
Expand Down
Loading

0 comments on commit cf51e34

Please sign in to comment.