From 7de7c95dc57ad026507fe3b48503a2ef5b9b9487 Mon Sep 17 00:00:00 2001 From: Tanmay Jain Date: Wed, 20 Dec 2023 16:04:35 +0530 Subject: [PATCH] Supporting logging dynamic changes. --- controllers/aero_info_calls.go | 9 +++++++-- controllers/pod.go | 13 +++++++++---- go.mod | 2 +- go.sum | 10 ++-------- 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/controllers/aero_info_calls.go b/controllers/aero_info_calls.go index 5b95b2e8d..e27057ec4 100644 --- a/controllers/aero_info_calls.go +++ b/controllers/aero_info_calls.go @@ -24,7 +24,6 @@ import ( asdbv1 "github.com/aerospike/aerospike-kubernetes-operator/api/v1" "github.com/aerospike/aerospike-kubernetes-operator/pkg/utils" "github.com/aerospike/aerospike-management-lib/deployment" - "github.com/aerospike/aerospike-management-lib/info" ) // ------------------------------------------------------------------------------------ @@ -327,7 +326,13 @@ func (r *SingleClusterReconciler) setDynamicConfig( ) } - asConfCmds, err := info.CreateConfigSetCmdList(diffs) + if len(selectedHostConns) == 0 { + r.Log.Info("No pods selected for dynamic config change") + + return reconcileSuccess() + } + + asConfCmds, err := deployment.CreateConfigSetCmdList(diffs, selectedHostConns[0].ASConn, r.getClientPolicy()) if err != nil { return reconcileError(err) } diff --git a/controllers/pod.go b/controllers/pod.go index d2123b0b8..6be93e85f 100644 --- a/controllers/pod.go +++ b/controllers/pod.go @@ -1331,8 +1331,8 @@ func (r *SingleClusterReconciler) handleDynamicConfigChange(rackState *RackState flatStatusConf := *asConfStatus.GetFlatMap() flatSpecConf := *asConfSpec.GetFlatMap() - specToStatusDiffs := asconfig.ConfDiff(r.Log, flatSpecConf, flatStatusConf, true, false, true, version[1]) - r.Log.Info("print diff", "difference", fmt.Sprintf("%v", specToStatusDiffs)) + specToStatusDiffs := asconfig.ConfDiff(r.Log, flatSpecConf, flatStatusConf, true, false, true, "7.0.0") + r.Log.Info("print diff outside", "difference", fmt.Sprintf("%v", specToStatusDiffs)) if len(specToStatusDiffs) > 1 { r.Log.V(1).Info("Multiple config change in single go is not supported,"+ @@ -1387,8 +1387,13 @@ func isFieldDynamic(dynamic map[string]bool, diff string) bool { return true } - if strings.Contains(key, "rack-id") { - return false + // Marking these fields as static as corresponding set-config commands are not straight forward. + staticFields := []string{"rack-id", "report-data-op"} + + for _, field := range staticFields { + if strings.Contains(key, field) { + return false + } } return dynamic[key] diff --git a/go.mod b/go.mod index 05c220a3b..2c9ad1797 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.19 require ( github.com/aerospike/aerospike-client-go/v6 v6.14.0 - github.com/aerospike/aerospike-management-lib v0.0.0-20231214090640-f5839c8a0c7c + github.com/aerospike/aerospike-management-lib v0.0.0-20231220090750-e26636a42694 github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d github.com/evanphx/json-patch v4.12.0+incompatible github.com/go-logr/logr v1.2.4 diff --git a/go.sum b/go.sum index 4ad795a94..41439000a 100644 --- a/go.sum +++ b/go.sum @@ -598,14 +598,8 @@ github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym github.com/JohnCGriffin/overflow v0.0.0-20211019200055-46fa312c352c/go.mod h1:X0CRv0ky0k6m906ixxpzmDRLvX58TFUKS2eePweuyxk= github.com/aerospike/aerospike-client-go/v6 v6.14.0 h1:Z3FcGWJda1sagzdc6Akz4EJ13Pq55Uyn6qtFLrVUDd0= github.com/aerospike/aerospike-client-go/v6 v6.14.0/go.mod h1:/0Wm81GhMqem+9flWcpazPKoRfjFeG6WrQdXGiMNi0A= -github.com/aerospike/aerospike-management-lib v0.0.0-20231208095128-a898bdce6a13 h1:T8KB2wrwTEPfiyeWzQMXmUI/cm6HmVAdI1QZx952ed8= -github.com/aerospike/aerospike-management-lib v0.0.0-20231208095128-a898bdce6a13/go.mod h1:qoBjUWFlcE7s7PBSyeEXeEJVypgr0/w5lXGKy7MvKVo= -github.com/aerospike/aerospike-management-lib v0.0.0-20231213115658-c5ab043aa10f h1:AGi7jFUBXl5o9Nx+Z/HfQ0E9T8YSDcFxAf7sMN6iYKI= -github.com/aerospike/aerospike-management-lib v0.0.0-20231213115658-c5ab043aa10f/go.mod h1:qoBjUWFlcE7s7PBSyeEXeEJVypgr0/w5lXGKy7MvKVo= -github.com/aerospike/aerospike-management-lib v0.0.0-20231213145135-5a70e4609127 h1:xQBiVdymv2MJMFih7KjBhQy//O8hHQnNP/PyEBC5r38= -github.com/aerospike/aerospike-management-lib v0.0.0-20231213145135-5a70e4609127/go.mod h1:qoBjUWFlcE7s7PBSyeEXeEJVypgr0/w5lXGKy7MvKVo= -github.com/aerospike/aerospike-management-lib v0.0.0-20231214090640-f5839c8a0c7c h1:txL0afFeA436KmPHmPCn8TdYCKAK2vMWULyOKK52ZaM= -github.com/aerospike/aerospike-management-lib v0.0.0-20231214090640-f5839c8a0c7c/go.mod h1:qoBjUWFlcE7s7PBSyeEXeEJVypgr0/w5lXGKy7MvKVo= +github.com/aerospike/aerospike-management-lib v0.0.0-20231220090750-e26636a42694 h1:ge+2XpHQRkxjsGHwouVC3JNv2YuN93w69A85jWPsaig= +github.com/aerospike/aerospike-management-lib v0.0.0-20231220090750-e26636a42694/go.mod h1:qoBjUWFlcE7s7PBSyeEXeEJVypgr0/w5lXGKy7MvKVo= github.com/ajstarks/deck v0.0.0-20200831202436-30c9fc6549a9/go.mod h1:JynElWSGnm/4RlzPXRlREEwqTHAN3T56Bv2ITsFT3gY= github.com/ajstarks/deck/generate v0.0.0-20210309230005-c3f852c02e19/go.mod h1:T13YZdzov6OU0A1+RfKZiZN9ca6VeKdBdyDV+BY97Tk= github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw=