From 01576e5db4eb80c65151d8f23e8ff94d5a774647 Mon Sep 17 00:00:00 2001 From: zhucan Date: Wed, 31 Aug 2022 10:19:22 +0800 Subject: [PATCH] object: gateway.port partially ignored when hostNetwork disabled Signed-off-by: zhucan (cherry picked from commit b94f0805485e5523126c5367313547668b195fc9) --- pkg/operator/ceph/object/spec.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/operator/ceph/object/spec.go b/pkg/operator/ceph/object/spec.go index 950295bf8..5c12f1daa 100644 --- a/pkg/operator/ceph/object/spec.go +++ b/pkg/operator/ceph/object/spec.go @@ -189,7 +189,7 @@ func (c *clusterConfig) makeRGWPodSpec(rgwConfig *rgwConfig) (v1.PodTemplateSpec // If host networking is not enabled, preferred pod anti-affinity is added to the rgw daemons labels := getLabels(c.store.Name, c.store.Namespace, false) - k8sutil.SetNodeAntiAffinityForPod(&podSpec, c.clusterSpec.Network.IsHost(), v1.LabelHostname, labels, nil) + k8sutil.SetNodeAntiAffinityForPod(&podSpec, c.store.Spec.IsHostNetwork(c.clusterSpec), v1.LabelHostname, labels, nil) podTemplateSpec := v1.PodTemplateSpec{ ObjectMeta: metav1.ObjectMeta{ @@ -426,7 +426,7 @@ func (c *clusterConfig) generateProbePort() intstr.IntOrString { port := intstr.FromInt(int(rgwPortInternalPort)) // If Host Networking is enabled, the port from the spec must be reflected - if c.clusterSpec.Network.IsHost() { + if c.store.Spec.IsHostNetwork(c.clusterSpec) { port = intstr.FromInt(int(c.store.Spec.Gateway.Port)) } @@ -448,7 +448,7 @@ func (c *clusterConfig) generateService(cephObjectStore *cephv1.CephObjectStore) if c.store.Spec.Gateway.Service != nil { c.store.Spec.Gateway.Service.Annotations.ApplyToObjectMeta(&svc.ObjectMeta) } - if c.clusterSpec.Network.IsHost() { + if c.store.Spec.IsHostNetwork(c.clusterSpec) { svc.Spec.ClusterIP = v1.ClusterIPNone }