diff --git a/api/v1/aerospikecluster_mutating_webhook.go b/api/v1/aerospikecluster_mutating_webhook.go index 9d48addee..ae9221c35 100644 --- a/api/v1/aerospikecluster_mutating_webhook.go +++ b/api/v1/aerospikecluster_mutating_webhook.go @@ -18,7 +18,6 @@ package v1 import ( "fmt" - lib "github.com/aerospike/aerospike-management-lib" "reflect" "strings" @@ -31,6 +30,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 @@ -240,7 +240,6 @@ func (c *AerospikeCluster) updateRacksPodSpecFromGlobal(asLog logr.Logger) { func (c *AerospikeCluster) updateRacksAerospikeConfigFromGlobal(asLog logr.Logger) error { for idx := range c.Spec.RackConfig.Racks { - asLog.Info("#########printing spec aerospike config", "spec", c.Spec.AerospikeConfig.Value) rack := &c.Spec.RackConfig.Racks[idx] var ( @@ -248,8 +247,6 @@ func (c *AerospikeCluster) updateRacksAerospikeConfigFromGlobal(asLog logr.Logge err error ) - asconf := AerospikeConfigSpec{Value: map[string]interface{}{}} - if rack.InputAerospikeConfig != nil { // Merge this rack's and global config. m, err = merge.Merge( @@ -260,8 +257,6 @@ func (c *AerospikeCluster) updateRacksAerospikeConfigFromGlobal(asLog logr.Logge return err } - asconf.Value = m - asLog.V(1).Info( "Merged rack config from global aerospikeConfig", "rack id", rack.ID, "rackAerospikeConfig", m, "globalAerospikeConfig", @@ -269,34 +264,28 @@ func (c *AerospikeCluster) updateRacksAerospikeConfigFromGlobal(asLog logr.Logge ) } else { // Use the global config. - lib.DeepCopy(&asconf.Value, &c.Spec.AerospikeConfig.Value) - //m = c.Spec.AerospikeConfig.Value + m = lib.DeepCopy(c.Spec.AerospikeConfig.Value).(map[string]interface{}) } asLog.V(1).Info( "Update rack aerospikeConfig from default aerospikeConfig", - "rackAerospikeConfig", asconf.Value, + "rackAerospikeConfig", m, ) // Set defaults in updated rack config // Above merge function may have overwritten defaults. - if err := c.setDefaultAerospikeConfigs(asLog, asconf, rack.ID); err != nil { + if err := c.setDefaultAerospikeConfigs(asLog, AerospikeConfigSpec{Value: m}, rack.ID); err != nil { return err } - asLog.V(1).Info( - "Update rack aerospikeConfig from default aerospikeConfig", - "rackAerospikeConfig", asconf.Value, - ) - - c.Spec.RackConfig.Racks[idx].AerospikeConfig = asconf - + c.Spec.RackConfig.Racks[idx].AerospikeConfig.Value = m } return nil } -func (c *AerospikeCluster) setDefaultAerospikeConfigs(asLog logr.Logger, configSpec AerospikeConfigSpec, rackID int) error { +func (c *AerospikeCluster) setDefaultAerospikeConfigs(asLog logr.Logger, + configSpec AerospikeConfigSpec, rackID int) error { config := configSpec.Value // namespace conf @@ -304,8 +293,6 @@ func (c *AerospikeCluster) setDefaultAerospikeConfigs(asLog logr.Logger, configS return err } - asLog.Info("after setDefaultNsConf", "c.Spec.AerospikeConfig", c.Spec.AerospikeConfig.Value, "rackID", rackID) - // service conf if err := setDefaultServiceConf(asLog, configSpec, c.Name); err != nil { return err diff --git a/api/v1/aerospikecluster_types.go b/api/v1/aerospikecluster_types.go index 9346610f5..8a0a68a89 100644 --- a/api/v1/aerospikecluster_types.go +++ b/api/v1/aerospikecluster_types.go @@ -864,87 +864,78 @@ func init() { } // CopySpecToStatus copy spec in status. Spec to Status DeepCopy doesn't work. It fails in reflect lib. -func CopySpecToStatus(spec *AerospikeClusterSpec) (*AerospikeClusterStatusSpec, error) { //nolint:dupl // not duplicate +func CopySpecToStatus(spec *AerospikeClusterSpec) (*AerospikeClusterStatusSpec, error) { status := AerospikeClusterStatusSpec{} status.Size = spec.Size status.Image = spec.Image // Storage - statusStorage := AerospikeStorageSpec{} - lib.DeepCopy(&statusStorage, &spec.Storage) + statusStorage := lib.DeepCopy(spec.Storage).(AerospikeStorageSpec) status.Storage = statusStorage if spec.AerospikeAccessControl != nil { // AerospikeAccessControl - statusAerospikeAccessControl := &AerospikeAccessControlSpec{} - lib.DeepCopy( - statusAerospikeAccessControl, spec.AerospikeAccessControl, - ) + statusAerospikeAccessControl := lib.DeepCopy( + *spec.AerospikeAccessControl, + ).(AerospikeAccessControlSpec) - status.AerospikeAccessControl = statusAerospikeAccessControl + status.AerospikeAccessControl = &statusAerospikeAccessControl } - // AerospikeConfig - statusAerospikeConfig := &AerospikeConfigSpec{} - lib.DeepCopy( - statusAerospikeConfig, spec.AerospikeConfig, - ) + if spec.AerospikeConfig != nil { + // AerospikeConfig + statusAerospikeConfig := lib.DeepCopy( + *spec.AerospikeConfig, + ).(AerospikeConfigSpec) - status.AerospikeConfig = statusAerospikeConfig + status.AerospikeConfig = &statusAerospikeConfig + } if spec.ValidationPolicy != nil { // ValidationPolicy - statusValidationPolicy := &ValidationPolicySpec{} - lib.DeepCopy( - statusValidationPolicy, spec.ValidationPolicy, - ) + statusValidationPolicy := lib.DeepCopy( + *spec.ValidationPolicy, + ).(ValidationPolicySpec) - status.ValidationPolicy = statusValidationPolicy + status.ValidationPolicy = &statusValidationPolicy } // RackConfig - statusRackConfig := RackConfig{} - lib.DeepCopy(&statusRackConfig, &spec.RackConfig) + statusRackConfig := lib.DeepCopy(spec.RackConfig).(RackConfig) status.RackConfig = statusRackConfig // AerospikeNetworkPolicy - statusAerospikeNetworkPolicy := AerospikeNetworkPolicy{} - lib.DeepCopy( - &statusAerospikeNetworkPolicy, &spec.AerospikeNetworkPolicy, - ) + statusAerospikeNetworkPolicy := lib.DeepCopy( + spec.AerospikeNetworkPolicy, + ).(AerospikeNetworkPolicy) status.AerospikeNetworkPolicy = statusAerospikeNetworkPolicy if spec.OperatorClientCertSpec != nil { - clientCertSpec := &AerospikeOperatorClientCertSpec{} - lib.DeepCopy( - clientCertSpec, spec.OperatorClientCertSpec, - ) + clientCertSpec := lib.DeepCopy( + *spec.OperatorClientCertSpec, + ).(AerospikeOperatorClientCertSpec) - status.OperatorClientCertSpec = clientCertSpec + status.OperatorClientCertSpec = &clientCertSpec } // Storage - statusPodSpec := AerospikePodSpec{} - lib.DeepCopy(&statusPodSpec, &spec.PodSpec) + statusPodSpec := lib.DeepCopy(spec.PodSpec).(AerospikePodSpec) status.PodSpec = statusPodSpec - seedsFinderServices := SeedsFinderServices{} - lib.DeepCopy( - &seedsFinderServices, &spec.SeedsFinderServices, - ) + seedsFinderServices := lib.DeepCopy( + spec.SeedsFinderServices, + ).(SeedsFinderServices) status.SeedsFinderServices = seedsFinderServices // RosterNodeBlockList if len(spec.RosterNodeBlockList) != 0 { - var rosterNodeBlockList []string - - lib.DeepCopy( - &rosterNodeBlockList, &spec.RosterNodeBlockList, - ) + rosterNodeBlockList := lib.DeepCopy( + spec.RosterNodeBlockList, + ).([]string) status.RosterNodeBlockList = rosterNodeBlockList } @@ -953,88 +944,79 @@ func CopySpecToStatus(spec *AerospikeClusterSpec) (*AerospikeClusterStatusSpec, } // CopyStatusToSpec copy status in spec. Status to Spec DeepCopy doesn't work. It fails in reflect lib. -func CopyStatusToSpec(status *AerospikeClusterStatusSpec) (*AerospikeClusterSpec, error) { //nolint:dupl // no need +func CopyStatusToSpec(status *AerospikeClusterStatusSpec) (*AerospikeClusterSpec, error) { spec := AerospikeClusterSpec{} spec.Size = status.Size spec.Image = status.Image // Storage - specStorage := AerospikeStorageSpec{} - lib.DeepCopy(&specStorage, &status.Storage) + specStorage := lib.DeepCopy(status.Storage).(AerospikeStorageSpec) spec.Storage = specStorage if status.AerospikeAccessControl != nil { // AerospikeAccessControl - specAerospikeAccessControl := &AerospikeAccessControlSpec{} - lib.DeepCopy( - specAerospikeAccessControl, status.AerospikeAccessControl, - ) + specAerospikeAccessControl := lib.DeepCopy( + status.AerospikeAccessControl, + ).(*AerospikeAccessControlSpec) spec.AerospikeAccessControl = specAerospikeAccessControl } // AerospikeConfig - specAerospikeConfig := &AerospikeConfigSpec{} - lib.DeepCopy( - specAerospikeConfig, status.AerospikeConfig, - ) + if status.AerospikeConfig != nil { + specAerospikeConfig := lib.DeepCopy( + status.AerospikeConfig, + ).(*AerospikeConfigSpec) - spec.AerospikeConfig = specAerospikeConfig + spec.AerospikeConfig = specAerospikeConfig + } if status.ValidationPolicy != nil { // ValidationPolicy - specValidationPolicy := &ValidationPolicySpec{} - lib.DeepCopy( - specValidationPolicy, status.ValidationPolicy, - ) + specValidationPolicy := lib.DeepCopy( + *status.ValidationPolicy, + ).(ValidationPolicySpec) - spec.ValidationPolicy = specValidationPolicy + spec.ValidationPolicy = &specValidationPolicy } // RackConfig - specRackConfig := RackConfig{} - lib.DeepCopy(&specRackConfig, &status.RackConfig) + specRackConfig := lib.DeepCopy(status.RackConfig).(RackConfig) spec.RackConfig = specRackConfig // AerospikeNetworkPolicy - specAerospikeNetworkPolicy := AerospikeNetworkPolicy{} - lib.DeepCopy( - &specAerospikeNetworkPolicy, &status.AerospikeNetworkPolicy, - ) + specAerospikeNetworkPolicy := lib.DeepCopy( + status.AerospikeNetworkPolicy, + ).(AerospikeNetworkPolicy) spec.AerospikeNetworkPolicy = specAerospikeNetworkPolicy if status.OperatorClientCertSpec != nil { - clientCertSpec := &AerospikeOperatorClientCertSpec{} - lib.DeepCopy( - clientCertSpec, status.OperatorClientCertSpec, - ) + clientCertSpec := lib.DeepCopy( + *status.OperatorClientCertSpec, + ).(AerospikeOperatorClientCertSpec) - spec.OperatorClientCertSpec = clientCertSpec + spec.OperatorClientCertSpec = &clientCertSpec } // Storage - specPodSpec := AerospikePodSpec{} - lib.DeepCopy(&specPodSpec, &status.PodSpec) + specPodSpec := lib.DeepCopy(status.PodSpec).(AerospikePodSpec) spec.PodSpec = specPodSpec - seedsFinderServices := SeedsFinderServices{} - lib.DeepCopy( - &seedsFinderServices, &status.SeedsFinderServices, - ) + seedsFinderServices := lib.DeepCopy( + status.SeedsFinderServices, + ).(SeedsFinderServices) spec.SeedsFinderServices = seedsFinderServices // RosterNodeBlockList if len(status.RosterNodeBlockList) != 0 { - var rosterNodeBlockList []string - - lib.DeepCopy( - &rosterNodeBlockList, &status.RosterNodeBlockList, - ) + rosterNodeBlockList := lib.DeepCopy( + status.RosterNodeBlockList, + ).([]string) spec.RosterNodeBlockList = rosterNodeBlockList } diff --git a/api/v1/aerospikeconfig.go b/api/v1/aerospikeconfig.go index 824b75a40..d2e37db70 100644 --- a/api/v1/aerospikeconfig.go +++ b/api/v1/aerospikeconfig.go @@ -27,7 +27,7 @@ func (c *AerospikeConfigSpec) DeepCopy() *AerospikeConfigSpec { dst := &AerospikeConfigSpec{ Value: map[string]interface{}{}, } - lib.DeepCopy(dst, c) + dst.Value = lib.DeepCopy(c.Value).(map[string]interface{}) return dst } diff --git a/api/v1beta1/aerospikeconfig.go b/api/v1beta1/aerospikeconfig.go index 7d7ae431c..5b94577ed 100644 --- a/api/v1beta1/aerospikeconfig.go +++ b/api/v1beta1/aerospikeconfig.go @@ -24,11 +24,10 @@ func (c *AerospikeConfigSpec) UnmarshalJSON(b []byte) error { } func (c *AerospikeConfigSpec) DeepCopy() *AerospikeConfigSpec { - src := *c - dst := AerospikeConfigSpec{ + dst := &AerospikeConfigSpec{ Value: map[string]interface{}{}, } - lib.DeepCopy(dst.Value, src.Value) + dst.Value = lib.DeepCopy(c.Value).(map[string]interface{}) - return &dst + return dst } diff --git a/controllers/configmap.go b/controllers/configmap.go index 102ef5911..a94bbd78e 100644 --- a/controllers/configmap.go +++ b/controllers/configmap.go @@ -167,10 +167,9 @@ func (r *SingleClusterReconciler) createConfigMapData(rack *asdbv1.Rack) ( func createPodSpecForRack( aeroCluster *asdbv1.AerospikeCluster, rack *asdbv1.Rack, ) *asdbv1.AerospikePodSpec { - rackFullPodSpec := asdbv1.AerospikePodSpec{} - lib.DeepCopy( - &rackFullPodSpec, &aeroCluster.Spec.PodSpec, - ) + rackFullPodSpec := lib.DeepCopy( + aeroCluster.Spec.PodSpec, + ).(asdbv1.AerospikePodSpec) rackFullPodSpec.Affinity = rack.PodSpec.Affinity rackFullPodSpec.Tolerations = rack.PodSpec.Tolerations diff --git a/controllers/pod.go b/controllers/pod.go index 848aa6b0d..9bf04c06c 100644 --- a/controllers/pod.go +++ b/controllers/pod.go @@ -1403,5 +1403,9 @@ func isFieldDynamic(dynamic map[string]bool, diff string) bool { return true } + if strings.Contains(key, "rack-id") { + return false + } + return dynamic[key] } diff --git a/controllers/rack.go b/controllers/rack.go index 1e7c8ae42..df9cc9c22 100644 --- a/controllers/rack.go +++ b/controllers/rack.go @@ -424,7 +424,7 @@ func (r *SingleClusterReconciler) upgradeOrRollingRestartRack(found *appsv1.Stat if !res.isSuccess { if res.err != nil { r.Log.Error( - res.err, "Failed to do rolling restart", "stsName", + res.err, "Failed to do dynamic update", "stsName", found.Name, ) @@ -435,6 +435,8 @@ func (r *SingleClusterReconciler) upgradeOrRollingRestartRack(found *appsv1.Stat rackState.Rack.ID, found.Namespace, found.Name, ) } + + return found, res } } } @@ -1296,9 +1298,7 @@ func (r *SingleClusterReconciler) isStorageVolumeSourceUpdated(volume *asdbv1.Vo return true } - var volumeCopy asdbv1.VolumeSpec - - lib.DeepCopy(&volumeCopy, volume) + volumeCopy := lib.DeepCopy(*volume).(asdbv1.VolumeSpec) if volumeCopy.Source.Secret != nil { setDefaultsSecretVolumeSource(volumeCopy.Source.Secret) diff --git a/controllers/reconciler.go b/controllers/reconciler.go index 58b4417bb..d6fcb915a 100644 --- a/controllers/reconciler.go +++ b/controllers/reconciler.go @@ -384,18 +384,17 @@ func (r *SingleClusterReconciler) updateAccessControlStatus() error { } // AerospikeAccessControl - statusAerospikeAccessControl := &asdbv1.AerospikeAccessControlSpec{} - lib.DeepCopy( - statusAerospikeAccessControl, r.aeroCluster.Spec.AerospikeAccessControl, - ) + statusAerospikeAccessControl := lib.DeepCopy( + *r.aeroCluster.Spec.AerospikeAccessControl, + ).(asdbv1.AerospikeAccessControlSpec) - newAeroCluster.Status.AerospikeClusterStatusSpec.AerospikeAccessControl = statusAerospikeAccessControl + newAeroCluster.Status.AerospikeClusterStatusSpec.AerospikeAccessControl = &statusAerospikeAccessControl if err := r.patchStatus(newAeroCluster); err != nil { return fmt.Errorf("error updating status: %w", err) } - r.aeroCluster.Status.AerospikeClusterStatusSpec.AerospikeAccessControl = statusAerospikeAccessControl + r.aeroCluster.Status.AerospikeClusterStatusSpec.AerospikeAccessControl = &statusAerospikeAccessControl r.Log.Info("Updated access control status", "status", newAeroCluster.Status) @@ -539,7 +538,7 @@ func (r *SingleClusterReconciler) patchStatus(newAeroCluster *asdbv1.AerospikeCl // Seems like a bug in encoding/json/Unmarshall. // // Workaround by force copying new object's status to old object's status. - lib.DeepCopy(&oldAeroCluster.Status, &newAeroCluster.Status) + oldAeroCluster.Status = lib.DeepCopy(newAeroCluster.Status).(asdbv1.AerospikeClusterStatus) return nil } diff --git a/controllers/statefulset.go b/controllers/statefulset.go index 1d36c7596..877982cbe 100644 --- a/controllers/statefulset.go +++ b/controllers/statefulset.go @@ -133,7 +133,7 @@ func (r *SingleClusterReconciler) createSTS( { Name: asdbv1.AerospikeInitContainerName, Image: asdbv1.GetAerospikeInitContainerImage(r.aeroCluster), - ImagePullPolicy: corev1.PullIfNotPresent, + ImagePullPolicy: corev1.PullAlways, VolumeMounts: getDefaultAerospikeInitContainerVolumeMounts(), Env: append( envVarList, []corev1.EnvVar{ @@ -790,13 +790,13 @@ func (r *SingleClusterReconciler) updateSTSNonPVStorage( func (r *SingleClusterReconciler) updateSTSSchedulingPolicy( st *appsv1.StatefulSet, rackState *RackState, ) { - affinity := &corev1.Affinity{} + var affinity corev1.Affinity // Use rack affinity, if given if rackState.Rack.PodSpec.Affinity != nil { - lib.DeepCopy(affinity, rackState.Rack.PodSpec.Affinity) + affinity = lib.DeepCopy(*rackState.Rack.PodSpec.Affinity).(corev1.Affinity) } else if r.aeroCluster.Spec.PodSpec.Affinity != nil { - lib.DeepCopy(affinity, r.aeroCluster.Spec.PodSpec.Affinity) + affinity = lib.DeepCopy(*r.aeroCluster.Spec.PodSpec.Affinity).(corev1.Affinity) } // Set our rules in PodAntiAffinity @@ -896,7 +896,7 @@ func (r *SingleClusterReconciler) updateSTSSchedulingPolicy( } } - st.Spec.Template.Spec.Affinity = affinity + st.Spec.Template.Spec.Affinity = &affinity // Use rack nodeSelector, if given if len(rackState.Rack.PodSpec.NodeSelector) != 0 { @@ -961,8 +961,7 @@ func updateSTSContainers( // Create a copy because updating stateful sets defaults // on the sidecar container object which mutates original aeroCluster object. - specContainerCopy := &corev1.Container{} - lib.DeepCopy(specContainerCopy, specContainer) + specContainerCopy := lib.DeepCopy(specContainer).(corev1.Container) for stsIdx := range stsContainers { if specContainer.Name != stsContainers[stsIdx].Name { @@ -972,7 +971,7 @@ func updateSTSContainers( // Retain volume mounts and devices to make sure external storage will not lose. specContainerCopy.VolumeMounts = stsContainers[stsIdx].VolumeMounts specContainerCopy.VolumeDevices = stsContainers[stsIdx].VolumeDevices - stsContainers[stsIdx] = *specContainerCopy + stsContainers[stsIdx] = specContainerCopy found = true break @@ -980,7 +979,7 @@ func updateSTSContainers( if !found { // Add to stateful set containers. - stsContainers = append(stsContainers, *specContainerCopy) + stsContainers = append(stsContainers, specContainerCopy) } } diff --git a/go.mod b/go.mod index b38b18b08..10e7d55c7 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-20231205095037-cabdd1d857fb + github.com/aerospike/aerospike-management-lib v0.0.0-20231208095128-a898bdce6a13 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 @@ -68,7 +68,6 @@ require ( github.com/prometheus/client_model v0.4.0 // indirect github.com/prometheus/common v0.42.0 // indirect github.com/prometheus/procfs v0.9.0 // indirect - github.com/qdm12/reprint v0.0.0-20200326205758-722754a53494 // indirect github.com/rogpeppe/go-internal v1.11.0 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect @@ -78,7 +77,7 @@ require ( go.uber.org/atomic v1.7.0 // indirect go.uber.org/multierr v1.6.0 // indirect go.uber.org/zap v1.24.0 // indirect - golang.org/x/net v0.10.0 // indirect + golang.org/x/net v0.17.0 // indirect golang.org/x/sync v0.2.0 // indirect golang.org/x/sys v0.13.0 // indirect golang.org/x/text v0.13.0 // indirect @@ -87,7 +86,7 @@ require ( google.golang.org/appengine v1.6.7 // indirect google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect google.golang.org/grpc v1.54.0 // indirect - google.golang.org/protobuf v1.30.0 // indirect + google.golang.org/protobuf v1.31.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/go.sum b/go.sum index 15f78c3a9..a222b152f 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-20231205095037-cabdd1d857fb h1:9KuXNhwpqFYwO3/KRgtYRc1Kh3YmZtN4VSxTji8dZl8= -github.com/aerospike/aerospike-management-lib v0.0.0-20231205095037-cabdd1d857fb/go.mod h1:LPOsGG8okRSH4hN9Y8VXFzsfIpBDj2WKEsI/f6wxwaw= +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/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= @@ -878,8 +878,6 @@ github.com/prometheus/common v0.42.0 h1:EKsfXEYo4JpWMHH5cg+KOUWeuJSov1Id8zGR8eeI github.com/prometheus/common v0.42.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr1yjz4b7Zbc= github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJfhI= github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY= -github.com/qdm12/reprint v0.0.0-20200326205758-722754a53494 h1:wSmWgpuccqS2IOfmYrbRiUgv+g37W5suLLLxwwniTSc= -github.com/qdm12/reprint v0.0.0-20200326205758-722754a53494/go.mod h1:yipyliwI08eQ6XwDm1fEwKPdF/xdbkiHtrU+1Hg+vc4= github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= @@ -1457,8 +1455,9 @@ google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.29.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/test/cluster_helper.go b/test/cluster_helper.go index b1263a8c7..f165f4abd 100644 --- a/test/cluster_helper.go +++ b/test/cluster_helper.go @@ -298,7 +298,7 @@ func rollingRestartClusterTest( aeroCluster.Spec.AerospikeConfig.Value["service"] = map[string]interface{}{} } - aeroCluster.Spec.AerospikeConfig.Value["service"].(map[string]interface{})["proto-fd-max"] = defaultProtofdmax + 1 + aeroCluster.Spec.AerospikeConfig.Value["service"].(map[string]interface{})["indent-allocations"] = true err = updateCluster(k8sClient, ctx, aeroCluster) if err != nil { @@ -307,7 +307,7 @@ func rollingRestartClusterTest( // Verify that the change has been applied on the cluster. return validateAerospikeConfigServiceClusterUpdate( - log, k8sClient, ctx, clusterNamespacedName, []string{"proto-fd-max"}, + log, k8sClient, ctx, clusterNamespacedName, []string{"indent-allocations"}, ) } @@ -1363,16 +1363,14 @@ func aerospikeClusterCreateUpdateWithTO( // Apply the update. if desired.Spec.AerospikeAccessControl != nil { - current.Spec.AerospikeAccessControl = &asdbv1.AerospikeAccessControlSpec{} - lib.DeepCopy(¤t.Spec, &desired.Spec) + current.Spec = lib.DeepCopy(desired.Spec).(asdbv1.AerospikeClusterSpec) } else { current.Spec.AerospikeAccessControl = nil } - lib.DeepCopy( - ¤t.Spec.AerospikeConfig.Value, - &desired.Spec.AerospikeConfig.Value, - ) + current.Spec.AerospikeConfig.Value = lib.DeepCopy( + desired.Spec.AerospikeConfig.Value, + ).(map[string]interface{}) if err := k8sClient.Update(ctx, current); err != nil { return err diff --git a/test/services_test.go b/test/services_test.go index b7e49e8d8..8ea26485d 100644 --- a/test/services_test.go +++ b/test/services_test.go @@ -129,10 +129,9 @@ func createLoadBalancer() *asdbv1.LoadBalancerSpec { ), ) - result := &asdbv1.LoadBalancerSpec{} - lib.DeepCopy(result, lb) + result := lib.DeepCopy(lb).(asdbv1.LoadBalancerSpec) - return result + return &result } func loadBalancerName(aeroCluster *asdbv1.AerospikeCluster) types.NamespacedName {