Skip to content

Commit

Permalink
Supporting logging dynamic changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
tanmayja committed Dec 20, 2023
1 parent 3751956 commit 7de7c95
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 15 deletions.
9 changes: 7 additions & 2 deletions controllers/aero_info_calls.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

// ------------------------------------------------------------------------------------
Expand Down Expand Up @@ -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)
}
Expand Down
13 changes: 9 additions & 4 deletions controllers/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,"+
Expand Down Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 2 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down

0 comments on commit 7de7c95

Please sign in to comment.