diff --git a/api/v1/aerospikecluster_types.go b/api/v1/aerospikecluster_types.go index 8c5a5a541..9015e2e1d 100644 --- a/api/v1/aerospikecluster_types.go +++ b/api/v1/aerospikecluster_types.go @@ -200,7 +200,7 @@ type AerospikePodSpec struct { //nolint:govet // for readability // The container port will be exposed to the external network at :, // where the hostIP is the IP address of the Kubernetes Node where the container is running and // the hostPort is the port requested by the user. - MultiPodPerHost bool `json:"multiPodPerHost,omitempty"` + MultiPodPerHost *bool `json:"multiPodPerHost,omitempty"` // HostNetwork enables host networking for the pod. // To enable hostNetwork multiPodPerHost must be false. @@ -594,7 +594,7 @@ type AerospikeClusterStatusSpec struct { //nolint:govet // for readability // where the hostIP is the IP address of the Kubernetes Node where the container is running and // the hostPort is the port requested by the user. // Deprecated: MultiPodPerHost is now part of podSpec - MultiPodPerHost bool `json:"multiPodPerHost,omitempty"` + MultiPodPerHost *bool `json:"multiPodPerHost,omitempty"` // Storage specify persistent storage to use for the Aerospike pods. Storage AerospikeStorageSpec `json:"storage,omitempty"` // AerospikeAccessControl has the Aerospike roles and users definitions. diff --git a/api/v1/aerospikecluster_validating_webhook.go b/api/v1/aerospikecluster_validating_webhook.go index 986bd7428..d3b36fead 100644 --- a/api/v1/aerospikecluster_validating_webhook.go +++ b/api/v1/aerospikecluster_validating_webhook.go @@ -1,5 +1,5 @@ /* -Copyright 2021. +Copyright 2024. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -27,18 +27,19 @@ 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" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/util/intstr" "k8s.io/apimachinery/pkg/util/sets" + "k8s.io/utils/ptr" logf "sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/webhook" "sigs.k8s.io/controller-runtime/pkg/webhook/admission" internalerrors "github.com/aerospike/aerospike-kubernetes-operator/errors" + lib "github.com/aerospike/aerospike-management-lib" "github.com/aerospike/aerospike-management-lib/asconfig" "github.com/aerospike/aerospike-management-lib/deployment" ) @@ -104,7 +105,7 @@ func (c *AerospikeCluster) ValidateUpdate(oldObj runtime.Object) (admission.Warn } // MultiPodPerHost cannot be updated - if c.Spec.PodSpec.MultiPodPerHost != old.Spec.PodSpec.MultiPodPerHost { + if !ptr.Equal(c.Spec.PodSpec.MultiPodPerHost, old.Spec.PodSpec.MultiPodPerHost) { return nil, fmt.Errorf("cannot update MultiPodPerHost setting") } @@ -1993,7 +1994,7 @@ func isPathParentOrSame(dir1, dir2 string) bool { } func (c *AerospikeCluster) validatePodSpec() error { - if c.Spec.PodSpec.HostNetwork && c.Spec.PodSpec.MultiPodPerHost { + if c.Spec.PodSpec.HostNetwork && ptr.Deref(c.Spec.PodSpec.MultiPodPerHost, false) { return fmt.Errorf("host networking cannot be enabled with multi pod per host") } diff --git a/api/v1/zz_generated.deepcopy.go b/api/v1/zz_generated.deepcopy.go index 6696bf022..cf43e1878 100644 --- a/api/v1/zz_generated.deepcopy.go +++ b/api/v1/zz_generated.deepcopy.go @@ -221,6 +221,11 @@ func (in *AerospikeClusterStatus) DeepCopy() *AerospikeClusterStatus { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *AerospikeClusterStatusSpec) DeepCopyInto(out *AerospikeClusterStatusSpec) { *out = *in + if in.MultiPodPerHost != nil { + in, out := &in.MultiPodPerHost, &out.MultiPodPerHost + *out = new(bool) + **out = **in + } in.Storage.DeepCopyInto(&out.Storage) if in.AerospikeAccessControl != nil { in, out := &in.AerospikeAccessControl, &out.AerospikeAccessControl diff --git a/controllers/configmap.go b/controllers/configmap.go index 080d025c0..189515f3f 100644 --- a/controllers/configmap.go +++ b/controllers/configmap.go @@ -17,6 +17,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/sets" + "k8s.io/utils/ptr" ctrl "sigs.k8s.io/controller-runtime" asdbv1 "github.com/aerospike/aerospike-kubernetes-operator/api/v1" @@ -256,7 +257,7 @@ func (r *SingleClusterReconciler) getBaseConfData(rack *asdbv1.Rack) (map[string initTemplateInput := initializeTemplateInput{ WorkDir: workDir, - MultiPodPerHost: r.aeroCluster.Spec.PodSpec.MultiPodPerHost, + MultiPodPerHost: ptr.Deref(r.aeroCluster.Spec.PodSpec.MultiPodPerHost, false), NetworkPolicy: r.aeroCluster.Spec.AerospikeNetworkPolicy, PodPort: servicePortParam, PodTLSPort: serviceTLSPortParam, diff --git a/controllers/pod.go b/controllers/pod.go index 1244e6f3e..5d19503b8 100644 --- a/controllers/pod.go +++ b/controllers/pod.go @@ -15,6 +15,7 @@ import ( "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/intstr" "k8s.io/apimachinery/pkg/util/sets" + "k8s.io/utils/ptr" "sigs.k8s.io/controller-runtime/pkg/client" asdbv1 "github.com/aerospike/aerospike-kubernetes-operator/api/v1" @@ -550,7 +551,7 @@ func (r *SingleClusterReconciler) cleanupPods( } // Try to delete corresponding pod service if it was created - if r.aeroCluster.Spec.PodSpec.MultiPodPerHost { + if ptr.Deref(r.aeroCluster.Spec.PodSpec.MultiPodPerHost, false) { // Remove service for pod // TODO: make it more robust, what if it fails if err := r.deletePodService( diff --git a/controllers/rack.go b/controllers/rack.go index 66e269349..dce55200d 100644 --- a/controllers/rack.go +++ b/controllers/rack.go @@ -559,8 +559,7 @@ func (r *SingleClusterReconciler) reconcileRack( // Safe check to delete all dangling pod services which are no longer required // There won't be any case of dangling pod service with MultiPodPerHost false, so ignore that case - if r.aeroCluster.Spec.PodSpec.MultiPodPerHost && - !podServiceNeeded(r.aeroCluster.Spec.PodSpec.MultiPodPerHost, &r.aeroCluster.Spec.AerospikeNetworkPolicy) { + if !podServiceNeeded(r.aeroCluster.Spec.PodSpec.MultiPodPerHost, &r.aeroCluster.Spec.AerospikeNetworkPolicy) { if err := r.cleanupDanglingPodServices(rackState); err != nil { return reconcileError(err) } diff --git a/controllers/service.go b/controllers/service.go index b95a68974..e2bd4d5c1 100644 --- a/controllers/service.go +++ b/controllers/service.go @@ -11,6 +11,7 @@ import ( "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/intstr" "k8s.io/apimachinery/pkg/util/sets" + "k8s.io/utils/ptr" "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" asdbv1 "github.com/aerospike/aerospike-kubernetes-operator/api/v1" @@ -400,8 +401,8 @@ func (r *SingleClusterReconciler) cleanupDanglingPodServices(rackState *RackStat return nil } -func podServiceNeeded(multiPodPerHost bool, networkPolicy *asdbv1.AerospikeNetworkPolicy) bool { - if !multiPodPerHost || networkPolicy == nil { +func podServiceNeeded(multiPodPerHost *bool, networkPolicy *asdbv1.AerospikeNetworkPolicy) bool { + if !ptr.Deref(multiPodPerHost, false) || networkPolicy == nil { return false } diff --git a/controllers/statefulset.go b/controllers/statefulset.go index b8a21c7c8..60aa7ac3f 100644 --- a/controllers/statefulset.go +++ b/controllers/statefulset.go @@ -16,6 +16,7 @@ import ( "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/sets" + "k8s.io/utils/ptr" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" @@ -801,7 +802,7 @@ func (r *SingleClusterReconciler) updateSTSSchedulingPolicy( // Set our rules in PodAntiAffinity // only enable in production, so it can be used in 1 node clusters while debugging (minikube) - if !r.aeroCluster.Spec.PodSpec.MultiPodPerHost { + if !ptr.Deref(r.aeroCluster.Spec.PodSpec.MultiPodPerHost, false) { if affinity.PodAntiAffinity == nil { affinity.PodAntiAffinity = &corev1.PodAntiAffinity{} } @@ -1460,7 +1461,7 @@ func addVolumeDeviceInContainer( } func getSTSContainerPort( - multiPodPerHost bool, aeroConf *asdbv1.AerospikeConfigSpec, + multiPodPerHost *bool, aeroConf *asdbv1.AerospikeConfigSpec, ) []corev1.ContainerPort { ports := make([]corev1.ContainerPort, 0, len(defaultContainerPorts)) @@ -1482,7 +1483,7 @@ func getSTSContainerPort( // The container port will be exposed to the external network at :, // where the hostIP is the IP address of the Kubernetes node where // the container is running and the hostPort is the port requested by the user - if (!multiPodPerHost) && portInfo.exposedOnHost { + if !ptr.Deref(multiPodPerHost, false) && portInfo.exposedOnHost { containerPort.HostPort = containerPort.ContainerPort } diff --git a/test/access_control_test.go b/test/access_control_test.go index 08eb10ebf..70e2a237c 100644 --- a/test/access_control_test.go +++ b/test/access_control_test.go @@ -14,6 +14,7 @@ import ( . "github.com/onsi/gomega" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" + "k8s.io/utils/ptr" as "github.com/aerospike/aerospike-client-go/v6" asdbv1 "github.com/aerospike/aerospike-kubernetes-operator/api/v1" @@ -2133,7 +2134,7 @@ func getAerospikeClusterSpecWithAccessControl( }, }, PodSpec: asdbv1.AerospikePodSpec{ - MultiPodPerHost: true, + MultiPodPerHost: ptr.To(true), }, AerospikeConfig: &asdbv1.AerospikeConfigSpec{ Value: aerospikeConfSpec.getSpec(), diff --git a/test/aero_info.go b/test/aero_info.go index 4156a99a6..fafdbfc92 100644 --- a/test/aero_info.go +++ b/test/aero_info.go @@ -14,6 +14,7 @@ import ( corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/types" + "k8s.io/utils/ptr" "sigs.k8s.io/controller-runtime/pkg/client" as "github.com/aerospike/aerospike-client-go/v6" @@ -61,7 +62,7 @@ func newAsConn( tlsName := getServiceTLSName(aeroCluster) networkType := asdbv1.AerospikeNetworkType(*defaultNetworkType) - if aeroCluster.Spec.PodSpec.MultiPodPerHost && networkType != asdbv1.AerospikeNetworkTypePod && + if ptr.Deref(aeroCluster.Spec.PodSpec.MultiPodPerHost, false) && networkType != asdbv1.AerospikeNetworkTypePod && networkType != asdbv1.AerospikeNetworkTypeCustomInterface { svc, err := getServiceForPod(pod, k8sClient) if err != nil { diff --git a/test/cluster_helper.go b/test/cluster_helper.go index 5ea880937..ee3f89d67 100644 --- a/test/cluster_helper.go +++ b/test/cluster_helper.go @@ -18,6 +18,7 @@ import ( "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/util/wait" + "k8s.io/utils/ptr" "sigs.k8s.io/controller-runtime/pkg/client" asdbv1 "github.com/aerospike/aerospike-kubernetes-operator/api/v1" @@ -778,7 +779,7 @@ func createAerospikeClusterPost460( }, PodSpec: asdbv1.AerospikePodSpec{ - MultiPodPerHost: true, + MultiPodPerHost: ptr.To(true), }, OperatorClientCertSpec: &asdbv1.AerospikeOperatorClientCertSpec{ AerospikeOperatorCertSource: asdbv1.AerospikeOperatorCertSource{ @@ -841,7 +842,7 @@ func createAerospikeClusterPost560( }, PodSpec: asdbv1.AerospikePodSpec{ - MultiPodPerHost: true, + MultiPodPerHost: ptr.To(true), }, OperatorClientCertSpec: &asdbv1.AerospikeOperatorClientCertSpec{ AerospikeOperatorCertSource: asdbv1.AerospikeOperatorCertSource{ @@ -965,7 +966,7 @@ func createDummyAerospikeClusterWithRFAndStorage( }, PodSpec: asdbv1.AerospikePodSpec{ - MultiPodPerHost: true, + MultiPodPerHost: ptr.To(true), AerospikeInitContainerSpec: &asdbv1.AerospikeInitContainerSpec{}, }, @@ -1033,7 +1034,7 @@ func createDummyAerospikeCluster( }, PodSpec: asdbv1.AerospikePodSpec{ - MultiPodPerHost: true, + MultiPodPerHost: ptr.To(true), AerospikeInitContainerSpec: &asdbv1.AerospikeInitContainerSpec{}, }, @@ -1224,7 +1225,7 @@ func createBasicTLSCluster( }, PodSpec: asdbv1.AerospikePodSpec{ - MultiPodPerHost: true, + MultiPodPerHost: ptr.To(true), }, OperatorClientCertSpec: &asdbv1.AerospikeOperatorClientCertSpec{ @@ -1258,7 +1259,7 @@ func createSSDStorageCluster( multiPodPerHost bool, ) *asdbv1.AerospikeCluster { aeroCluster := createBasicTLSCluster(clusterNamespacedName, size) - aeroCluster.Spec.PodSpec.MultiPodPerHost = multiPodPerHost + aeroCluster.Spec.PodSpec.MultiPodPerHost = &multiPodPerHost aeroCluster.Spec.Storage.Volumes = append( aeroCluster.Spec.Storage.Volumes, []asdbv1.VolumeSpec{ { @@ -1289,7 +1290,7 @@ func createHDDAndDataInMemStorageCluster( multiPodPerHost bool, ) *asdbv1.AerospikeCluster { aeroCluster := createBasicTLSCluster(clusterNamespacedName, size) - aeroCluster.Spec.PodSpec.MultiPodPerHost = multiPodPerHost + aeroCluster.Spec.PodSpec.MultiPodPerHost = &multiPodPerHost aeroCluster.Spec.Storage.Volumes = append( aeroCluster.Spec.Storage.Volumes, []asdbv1.VolumeSpec{ { @@ -1328,7 +1329,7 @@ func createDataInMemWithoutPersistentStorageCluster( multiPodPerHost bool, ) *asdbv1.AerospikeCluster { aeroCluster := createBasicTLSCluster(clusterNamespacedName, size) - aeroCluster.Spec.PodSpec.MultiPodPerHost = multiPodPerHost + aeroCluster.Spec.PodSpec.MultiPodPerHost = &multiPodPerHost aeroCluster.Spec.AerospikeConfig.Value["namespaces"] = []interface{}{ map[string]interface{}{ "name": "test", @@ -1528,7 +1529,7 @@ func getNonRootPodSpec() asdbv1.AerospikePodSpec { return asdbv1.AerospikePodSpec{ HostNetwork: false, - MultiPodPerHost: true, + MultiPodPerHost: ptr.To(true), SecurityContext: &corev1.PodSecurityContext{ RunAsUser: &id, RunAsGroup: &id, diff --git a/test/cluster_test.go b/test/cluster_test.go index ff5997c95..2255c3c23 100644 --- a/test/cluster_test.go +++ b/test/cluster_test.go @@ -11,6 +11,7 @@ import ( "k8s.io/apimachinery/pkg/api/resource" "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/intstr" + "k8s.io/utils/ptr" asdbv1 "github.com/aerospike/aerospike-kubernetes-operator/api/v1" "github.com/aerospike/aerospike-kubernetes-operator/pkg/utils" @@ -175,7 +176,7 @@ func clusterWithMaxIgnorablePod(ctx goctx.Context) { By("Set MaxIgnorablePod and Rolling restart cluster") aeroCluster, err = getCluster(k8sClient, ctx, clusterNamespacedName) Expect(err).ToNot(HaveOccurred()) - val := intstr.FromInt(1) + val := intstr.FromInt32(1) aeroCluster.Spec.RackConfig.MaxIgnorablePods = &val aeroCluster.Spec.AerospikeConfig.Value["service"].(map[string]interface{})["proto-fd-max"] = int64(18000) err = updateCluster(k8sClient, ctx, aeroCluster) @@ -250,7 +251,7 @@ func clusterWithMaxIgnorablePod(ctx goctx.Context) { By("Delete rack with id 2") aeroCluster, err = getCluster(k8sClient, ctx, clusterNamespacedName) Expect(err).ToNot(HaveOccurred()) - val := intstr.FromInt(1) + val := intstr.FromInt32(1) aeroCluster.Spec.RackConfig.MaxIgnorablePods = &val aeroCluster.Spec.RackConfig.Racks = getDummyRackConf(1) err = updateCluster(k8sClient, ctx, aeroCluster) @@ -290,7 +291,7 @@ func clusterWithMaxIgnorablePod(ctx goctx.Context) { By("Set MaxIgnorablePod and Rolling restart by removing namespace") aeroCluster, err = getCluster(k8sClient, ctx, clusterNamespacedName) Expect(err).ToNot(HaveOccurred()) - val := intstr.FromInt(1) + val := intstr.FromInt32(1) aeroCluster.Spec.RackConfig.MaxIgnorablePods = &val nsList := aeroCluster.Spec.AerospikeConfig.Value["namespaces"].([]interface{}) nsList = nsList[:len(nsList)-1] @@ -344,7 +345,7 @@ func deployClusterForMaxIgnorablePods(ctx goctx.Context, clusterNamespacedName t racks := getDummyRackConf(1, 2) aeroCluster.Spec.RackConfig = asdbv1.RackConfig{ Namespaces: []string{scNamespace}, Racks: racks} - aeroCluster.Spec.PodSpec.MultiPodPerHost = false + aeroCluster.Spec.PodSpec.MultiPodPerHost = ptr.To(false) err := deployCluster(k8sClient, ctx, aeroCluster) Expect(err).ToNot(HaveOccurred()) } @@ -979,7 +980,8 @@ func UpdateClusterTest(ctx goctx.Context) { ) Expect(err).ToNot(HaveOccurred()) - aeroCluster.Spec.PodSpec.MultiPodPerHost = !aeroCluster.Spec.PodSpec.MultiPodPerHost + multiPodPerHost := !*aeroCluster.Spec.PodSpec.MultiPodPerHost + aeroCluster.Spec.PodSpec.MultiPodPerHost = &multiPodPerHost err = k8sClient.Update(ctx, aeroCluster) Expect(err).Should(HaveOccurred()) diff --git a/test/host_network_test.go b/test/host_network_test.go index 5c1b5315d..136c74a1c 100644 --- a/test/host_network_test.go +++ b/test/host_network_test.go @@ -9,6 +9,7 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" corev1 "k8s.io/api/core/v1" + "k8s.io/utils/ptr" asdbv1 "github.com/aerospike/aerospike-kubernetes-operator/api/v1" ) @@ -26,7 +27,7 @@ var _ = Describe( clusterNamespacedName, 2, latestImage, ) aeroCluster.Spec.PodSpec.HostNetwork = true - aeroCluster.Spec.PodSpec.MultiPodPerHost = true + aeroCluster.Spec.PodSpec.MultiPodPerHost = ptr.To(true) It( "Should not work with MultiPodPerHost enabled", func() { @@ -38,7 +39,7 @@ var _ = Describe( It( "Should verify hostNetwork flag updates", func() { By("Deploying cluster, Should not advertise node address when off") - aeroCluster.Spec.PodSpec.MultiPodPerHost = false + aeroCluster.Spec.PodSpec.MultiPodPerHost = ptr.To(false) aeroCluster.Spec.PodSpec.HostNetwork = false err := deployCluster(k8sClient, ctx, aeroCluster) diff --git a/test/ldap_auth_test.go b/test/ldap_auth_test.go index 52f4d16b3..f320064fd 100644 --- a/test/ldap_auth_test.go +++ b/test/ldap_auth_test.go @@ -8,14 +8,15 @@ import ( goctx "context" "time" - as "github.com/aerospike/aerospike-client-go/v6" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" + "k8s.io/utils/ptr" + as "github.com/aerospike/aerospike-client-go/v6" asdbv1 "github.com/aerospike/aerospike-kubernetes-operator/api/v1" ) @@ -146,7 +147,7 @@ func getAerospikeClusterSpecWithLDAP( }, }, PodSpec: asdbv1.AerospikePodSpec{ - MultiPodPerHost: true, + MultiPodPerHost: ptr.To(true), }, AerospikeConfig: &asdbv1.AerospikeConfigSpec{ Value: map[string]interface{}{ diff --git a/test/network_policy_test.go b/test/network_policy_test.go index 82f725484..efc46a2ea 100644 --- a/test/network_policy_test.go +++ b/test/network_policy_test.go @@ -19,6 +19,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/util/retry" + "k8s.io/utils/ptr" asdbv1 "github.com/aerospike/aerospike-kubernetes-operator/api/v1" aerospikecluster "github.com/aerospike/aerospike-kubernetes-operator/controllers" @@ -1205,8 +1206,8 @@ func getExpectedServicePortForPod( ) (int32, error) { var port int32 - if (networkType != asdbv1.AerospikeNetworkTypePod && - networkType != asdbv1.AerospikeNetworkTypeCustomInterface) && aeroCluster.Spec.PodSpec.MultiPodPerHost { + if (networkType != asdbv1.AerospikeNetworkTypePod && networkType != asdbv1.AerospikeNetworkTypeCustomInterface) && + ptr.Deref(aeroCluster.Spec.PodSpec.MultiPodPerHost, false) { svc, err := getServiceForPod(pod, k8sClient) if err != nil { return 0, fmt.Errorf("error getting service port: %v", err) @@ -1346,7 +1347,7 @@ func getAerospikeClusterSpecWithNetworkPolicy( }, }, PodSpec: asdbv1.AerospikePodSpec{ - MultiPodPerHost: multiPodPerHost, + MultiPodPerHost: ptr.To(multiPodPerHost), }, OperatorClientCertSpec: operatorClientCertSpec, AerospikeConfig: &asdbv1.AerospikeConfigSpec{ diff --git a/test/rack_management_test.go b/test/rack_management_test.go index 7edd0b93b..5d36c0dfc 100644 --- a/test/rack_management_test.go +++ b/test/rack_management_test.go @@ -8,6 +8,7 @@ import ( . "github.com/onsi/gomega" v1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" + "k8s.io/utils/ptr" asdbv1 "github.com/aerospike/aerospike-kubernetes-operator/api/v1" ) @@ -810,7 +811,7 @@ var _ = Describe( aeroCluster := createDummyAerospikeCluster(clusterNamespacedName, int32(len(nodes.Items))) racks := getDummyRackConf(1, 2) aeroCluster.Spec.RackConfig = asdbv1.RackConfig{Racks: racks} - aeroCluster.Spec.PodSpec.MultiPodPerHost = false + aeroCluster.Spec.PodSpec.MultiPodPerHost = ptr.To(false) By("Deploying cluster") err = deployCluster(k8sClient, ctx, aeroCluster) diff --git a/test/storage_init_test.go b/test/storage_init_test.go index bc00d7a24..f5a28bc4d 100644 --- a/test/storage_init_test.go +++ b/test/storage_init_test.go @@ -15,6 +15,7 @@ import ( "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" + "k8s.io/utils/ptr" crClient "sigs.k8s.io/controller-runtime/pkg/client" asdbv1 "github.com/aerospike/aerospike-kubernetes-operator/api/v1" @@ -792,7 +793,7 @@ func getStorageInitAerospikeCluster( SkipXdrDlogFileValidate: true, }, PodSpec: asdbv1.AerospikePodSpec{ - MultiPodPerHost: true, + MultiPodPerHost: ptr.To(true), }, AerospikeConfig: &asdbv1.AerospikeConfigSpec{ Value: map[string]interface{}{ diff --git a/test/storage_wipe_test.go b/test/storage_wipe_test.go index feef30681..537572192 100644 --- a/test/storage_wipe_test.go +++ b/test/storage_wipe_test.go @@ -11,6 +11,7 @@ import ( "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" + "k8s.io/utils/ptr" "sigs.k8s.io/controller-runtime/pkg/client" as "github.com/aerospike/aerospike-client-go/v6" @@ -648,7 +649,7 @@ func getStorageWipeAerospikeCluster( SkipXdrDlogFileValidate: true, }, PodSpec: asdbv1.AerospikePodSpec{ - MultiPodPerHost: true, + MultiPodPerHost: ptr.To(true), }, AerospikeConfig: aerospikeConfigSpec, },