From 181c1c6962e20a6930c23c6fed62f9a7b06c8d59 Mon Sep 17 00:00:00 2001 From: Tanmay Jain Date: Mon, 4 Mar 2024 12:32:20 +0530 Subject: [PATCH] addressing comments --- api/v1/zz_generated.deepcopy.go | 5 +++++ controllers/rack.go | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/api/v1/zz_generated.deepcopy.go b/api/v1/zz_generated.deepcopy.go index cf43e1878..d2a52c30c 100644 --- a/api/v1/zz_generated.deepcopy.go +++ b/api/v1/zz_generated.deepcopy.go @@ -533,6 +533,11 @@ func (in *AerospikePodSpec) DeepCopyInto(out *AerospikePodSpec) { } } in.SchedulingPolicy.DeepCopyInto(&out.SchedulingPolicy) + if in.MultiPodPerHost != nil { + in, out := &in.MultiPodPerHost, &out.MultiPodPerHost + *out = new(bool) + **out = **in + } if in.InputDNSPolicy != nil { in, out := &in.InputDNSPolicy, &out.InputDNSPolicy *out = new(corev1.DNSPolicy) diff --git a/controllers/rack.go b/controllers/rack.go index dce55200d..9fd3cbb3f 100644 --- a/controllers/rack.go +++ b/controllers/rack.go @@ -13,6 +13,7 @@ import ( "k8s.io/apimachinery/pkg/labels" "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" @@ -559,7 +560,8 @@ 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 !podServiceNeeded(r.aeroCluster.Spec.PodSpec.MultiPodPerHost, &r.aeroCluster.Spec.AerospikeNetworkPolicy) { + if ptr.Deref(r.aeroCluster.Spec.PodSpec.MultiPodPerHost, false) && + !podServiceNeeded(r.aeroCluster.Spec.PodSpec.MultiPodPerHost, &r.aeroCluster.Spec.AerospikeNetworkPolicy) { if err := r.cleanupDanglingPodServices(rackState); err != nil { return reconcileError(err) }