From 8b8244785430ae140e8ad7c519f1bb6b0934bcf0 Mon Sep 17 00:00:00 2001 From: Abhisek Dwivedi Date: Wed, 27 Dec 2023 17:30:30 +0530 Subject: [PATCH 1/2] test new mangemant-lib code changes --- api/v1/access_control_validate.go | 6 +++--- api/v1/aerospikecluster_validating_webhook.go | 11 ++++++----- api/v1/utils.go | 4 ++-- go.mod | 6 +++--- go.sum | 13 ++++++++----- test/cluster_helper.go | 9 ++++----- test/storage_init_test.go | 4 ++-- test/utils.go | 10 +++++----- 8 files changed, 33 insertions(+), 30 deletions(-) diff --git a/api/v1/access_control_validate.go b/api/v1/access_control_validate.go index 1ef0531a1..b68183496 100644 --- a/api/v1/access_control_validate.go +++ b/api/v1/access_control_validate.go @@ -7,7 +7,7 @@ import ( "net" "strings" - "github.com/aerospike/aerospike-management-lib/asconfig" + lib "github.com/aerospike/aerospike-management-lib" ) // PrivilegeScope enumerates valid scopes for privileges. @@ -213,7 +213,7 @@ func isRoleSpecValid( _, ok := PredefinedRoles[roleSpec.Name] if ok { - cmp, err := asconfig.CompareVersions(version, "6.0.0.0") + cmp, err := lib.CompareVersions(version, "6.0.0.0") if err != nil { return false, err } @@ -319,7 +319,7 @@ func isPrivilegeValid( } // Check if new privileges are used in an older version. - cmp, err := asconfig.CompareVersions(version, "6.0.0.0") + cmp, err := lib.CompareVersions(version, "6.0.0.0") if err != nil { return false, err } diff --git a/api/v1/aerospikecluster_validating_webhook.go b/api/v1/aerospikecluster_validating_webhook.go index 96d8e9454..e23fdcf76 100644 --- a/api/v1/aerospikecluster_validating_webhook.go +++ b/api/v1/aerospikecluster_validating_webhook.go @@ -27,6 +27,7 @@ import ( "regexp" "strings" + lib "github.com/aerospike/aerospike-management-lib" validate "github.com/asaskevich/govalidator" "github.com/go-logr/logr" v1 "k8s.io/api/core/v1" @@ -173,7 +174,7 @@ func (c *AerospikeCluster) validate(aslog logr.Logger) error { return err } - val, err := asconfig.CompareVersions(version, baseVersion) + val, err := lib.CompareVersions(version, baseVersion) if err != nil { return fmt.Errorf("failed to check image version: %v", err) } @@ -696,7 +697,7 @@ const maxEnterpriseClusterSzGt5_0 = 256 const versionForSzCheck = "5.0.0" func validateClusterSize(_ logr.Logger, version string, sz int) error { - val, err := asconfig.CompareVersions(version, versionForSzCheck) + val, err := lib.CompareVersions(version, versionForSzCheck) if err != nil { return fmt.Errorf( "failed to validate cluster size limit from version: %v", err, @@ -1288,12 +1289,12 @@ func validateLoadBalancerUpdate( func validateSecurityConfigUpdate( newVersion, oldVersion string, newSpec, oldSpec *AerospikeConfigSpec, ) error { - nv, err := asconfig.CompareVersions(newVersion, "5.7.0") + nv, err := lib.CompareVersions(newVersion, "5.7.0") if err != nil { return err } - ov, err := asconfig.CompareVersions(oldVersion, "5.7.0") + ov, err := lib.CompareVersions(oldVersion, "5.7.0") if err != nil { return err } @@ -1778,7 +1779,7 @@ func validateRequiredFileStorageForMetadata( } if !validationPolicy.SkipXdrDlogFileValidate { - val, err := asconfig.CompareVersions(version, "5.0.0") + val, err := lib.CompareVersions(version, "5.0.0") if err != nil { return fmt.Errorf("failed to check image version: %v", err) } diff --git a/api/v1/utils.go b/api/v1/utils.go index fe1a28e3a..4fad1d2e0 100644 --- a/api/v1/utils.go +++ b/api/v1/utils.go @@ -10,7 +10,7 @@ import ( v1 "k8s.io/api/core/v1" internalerrors "github.com/aerospike/aerospike-kubernetes-operator/errors" - "github.com/aerospike/aerospike-management-lib/asconfig" + lib "github.com/aerospike/aerospike-management-lib" ) const ( @@ -188,7 +188,7 @@ func IsServiceTLSEnabled(aerospikeConfigSpec *AerospikeConfigSpec) bool { func IsSecurityEnabled( version string, aerospikeConfig *AerospikeConfigSpec, ) (bool, error) { - retval, err := asconfig.CompareVersions(version, "5.7.0") + retval, err := lib.CompareVersions(version, "5.7.0") if err != nil { return false, err } diff --git a/go.mod b/go.mod index 87eff97ac..9b5547158 100644 --- a/go.mod +++ b/go.mod @@ -4,13 +4,13 @@ go 1.19 require ( github.com/aerospike/aerospike-client-go/v6 v6.14.0 - github.com/aerospike/aerospike-management-lib v0.0.0-20231129055344-b6aff63f1dbb + github.com/aerospike/aerospike-management-lib v0.0.0-20231221011837-c8471d4a13c7 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 github.com/onsi/ginkgo/v2 v2.9.5 github.com/onsi/gomega v1.27.7 - github.com/stretchr/testify v1.8.3 + github.com/stretchr/testify v1.8.4 golang.org/x/oauth2 v0.7.0 // indirect golang.org/x/term v0.13.0 // indirect k8s.io/api v0.27.2 @@ -82,7 +82,7 @@ require ( golang.org/x/sync v0.2.0 // indirect golang.org/x/sys v0.13.0 // indirect golang.org/x/text v0.13.0 // indirect - golang.org/x/time v0.3.0 // indirect + golang.org/x/time v0.5.0 // indirect golang.org/x/tools v0.9.1 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect diff --git a/go.sum b/go.sum index abd92dab8..c458e8787 100644 --- a/go.sum +++ b/go.sum @@ -598,8 +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-20231129055344-b6aff63f1dbb h1:ykX3ElBNT/VOUhw/+5+jiFnWw3LSbPfl6eRrhQzBBFk= -github.com/aerospike/aerospike-management-lib v0.0.0-20231129055344-b6aff63f1dbb/go.mod h1:LPOsGG8okRSH4hN9Y8VXFzsfIpBDj2WKEsI/f6wxwaw= +github.com/aerospike/aerospike-management-lib v0.0.0-20231221011837-c8471d4a13c7 h1:ouH7fq84xDQ7tet0sj3J9iNAR71GUaH0WgNYytqwbbk= +github.com/aerospike/aerospike-management-lib v0.0.0-20231221011837-c8471d4a13c7/go.mod h1:54II0rXTkJ6Pi7MTR7bCSlQXPCdHr/kqR3aUuKht6sY= 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= @@ -909,8 +909,9 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb h1:zGWFAtiMcyryUHoUjUJX0/lt1H2+i2Ka2n+D3DImSNo= github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= @@ -944,6 +945,7 @@ go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A= +go.uber.org/mock v0.3.0 h1:3mUxI1No2/60yUYax92Pt8eNOEecx2D3lcXZh2NEZJo= go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60= @@ -1013,7 +1015,7 @@ golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91 golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.10.0 h1:lFO9qtOdlre5W1jxS3r/4szv2/6iXxScdzjoBMXNhYk= +golang.org/x/mod v0.11.0 h1:bUO06HqtnRcc/7l71XBe4WcqTZ+3AH1J59zWDDwLKgU= golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1157,8 +1159,9 @@ golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxb golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20220922220347-f3bd1da661af/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.1.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= +golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190206041539-40960b6deb8e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/test/cluster_helper.go b/test/cluster_helper.go index b1263a8c7..5ea880937 100644 --- a/test/cluster_helper.go +++ b/test/cluster_helper.go @@ -24,7 +24,6 @@ import ( internalerrors "github.com/aerospike/aerospike-kubernetes-operator/errors" "github.com/aerospike/aerospike-kubernetes-operator/pkg/utils" lib "github.com/aerospike/aerospike-management-lib" - "github.com/aerospike/aerospike-management-lib/asconfig" "github.com/aerospike/aerospike-management-lib/info" ) @@ -1071,12 +1070,12 @@ func UpdateClusterImage( return err } - ov, err := asconfig.CompareVersions(outgoingVersion, "7.0.0") + ov, err := lib.CompareVersions(outgoingVersion, "7.0.0") if err != nil { return err } - nv, err := asconfig.CompareVersions(incomingVersion, "7.0.0") + nv, err := lib.CompareVersions(incomingVersion, "7.0.0") if err != nil { return err } @@ -1120,12 +1119,12 @@ func UpdateClusterImage( } } - ov, err = asconfig.CompareVersions(outgoingVersion, "5.7.0") + ov, err = lib.CompareVersions(outgoingVersion, "5.7.0") if err != nil { return err } - nv, err = asconfig.CompareVersions(incomingVersion, "5.7.0") + nv, err = lib.CompareVersions(incomingVersion, "5.7.0") if err != nil { return err } diff --git a/test/storage_init_test.go b/test/storage_init_test.go index df127adac..bc00d7a24 100644 --- a/test/storage_init_test.go +++ b/test/storage_init_test.go @@ -20,7 +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" + lib "github.com/aerospike/aerospike-management-lib" ) const ( @@ -811,7 +811,7 @@ func getStorageInitAerospikeCluster( } version, _ := asdbv1.GetImageVersion(image) - ov, _ := asconfig.CompareVersions(version, "7.0.0") + ov, _ := lib.CompareVersions(version, "7.0.0") if ov < 0 { aerospike.Spec.AerospikeConfig.Value["namespaces"] = []interface{}{ diff --git a/test/utils.go b/test/utils.go index 07b885ac0..94da43766 100644 --- a/test/utils.go +++ b/test/utils.go @@ -26,7 +26,7 @@ import ( asdbv1 "github.com/aerospike/aerospike-kubernetes-operator/api/v1" operatorUtils "github.com/aerospike/aerospike-kubernetes-operator/pkg/utils" - "github.com/aerospike/aerospike-management-lib/asconfig" + lib "github.com/aerospike/aerospike-management-lib" ) var ( @@ -491,7 +491,7 @@ func (acs *AerospikeConfSpec) getVersion() string { } func (acs *AerospikeConfSpec) setEnableSecurity(enableSecurity bool) error { - cmpVal, err := asconfig.CompareVersions(acs.version, "5.7.0") + cmpVal, err := lib.CompareVersions(acs.version, "5.7.0") if err != nil { return err } @@ -512,7 +512,7 @@ func (acs *AerospikeConfSpec) setEnableSecurity(enableSecurity bool) error { } func (acs *AerospikeConfSpec) setEnableQuotas(enableQuotas bool) error { - cmpVal, err := asconfig.CompareVersions(acs.version, "5.6.0") + cmpVal, err := lib.CompareVersions(acs.version, "5.6.0") if err != nil { return err } @@ -566,12 +566,12 @@ func getAeroClusterConfig( return nil, err } - cmpVal1, err := asconfig.CompareVersions(version, "5.7.0") + cmpVal1, err := lib.CompareVersions(version, "5.7.0") if err != nil { return nil, err } - cmpVal2, err := asconfig.CompareVersions(version, "7.0.0") + cmpVal2, err := lib.CompareVersions(version, "7.0.0") if err != nil { return nil, err } From c7956bf348e23bba2592fe288161418ef412970e Mon Sep 17 00:00:00 2001 From: Abhisek Dwivedi Date: Mon, 1 Jan 2024 13:54:35 +0530 Subject: [PATCH 2/2] Update management-lib SHA --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index e95427926..0ff571083 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-20231221011837-c8471d4a13c7 + github.com/aerospike/aerospike-management-lib v0.0.0-20231229132959-08273f7a41b7 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 b3444ea27..5ab46141c 100644 --- a/go.sum +++ b/go.sum @@ -598,8 +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-20231221011837-c8471d4a13c7 h1:ouH7fq84xDQ7tet0sj3J9iNAR71GUaH0WgNYytqwbbk= -github.com/aerospike/aerospike-management-lib v0.0.0-20231221011837-c8471d4a13c7/go.mod h1:54II0rXTkJ6Pi7MTR7bCSlQXPCdHr/kqR3aUuKht6sY= +github.com/aerospike/aerospike-management-lib v0.0.0-20231229132959-08273f7a41b7 h1:D+/s/d6l26SRACLJlegmgE35o0qWBjLcYcuB14UhnDc= +github.com/aerospike/aerospike-management-lib v0.0.0-20231229132959-08273f7a41b7/go.mod h1:54II0rXTkJ6Pi7MTR7bCSlQXPCdHr/kqR3aUuKht6sY= 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=