From 785aa5a322dd555e13ee4fc848d71454a8592774 Mon Sep 17 00:00:00 2001 From: Jiffin Tony Thottan Date: Tue, 2 Mar 2021 13:29:21 +0530 Subject: [PATCH] ceph: handle ssl cases for RGW's livenessprobe The livenessprobe for swift/health always check with RGW internal port if host network disabled, but won't work if only secure port is configured Signed-off-by: Jiffin Tony Thottan --- pkg/operator/ceph/object/spec.go | 9 ++++----- pkg/operator/ceph/object/spec_test.go | 8 -------- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/pkg/operator/ceph/object/spec.go b/pkg/operator/ceph/object/spec.go index 8447a49ae..6de70ca27 100644 --- a/pkg/operator/ceph/object/spec.go +++ b/pkg/operator/ceph/object/spec.go @@ -302,13 +302,12 @@ func (c *clusterConfig) generateLiveProbePort() intstr.IntOrString { // If Host Networking is enabled, the port from the spec must be reflected if c.clusterSpec.Network.IsHost() { - if c.store.Spec.Gateway.Port == 0 && c.store.Spec.Gateway.SecurePort != 0 && c.store.Spec.Gateway.SSLCertificateRef != "" { - port = intstr.FromInt(int(c.store.Spec.Gateway.SecurePort)) - } else { - port = intstr.FromInt(int(c.store.Spec.Gateway.Port)) - } + port = intstr.FromInt(int(c.store.Spec.Gateway.Port)) } + if c.store.Spec.Gateway.Port == 0 && c.store.Spec.Gateway.SecurePort != 0 && c.store.Spec.Gateway.SSLCertificateRef != "" { + port = intstr.FromInt(int(c.store.Spec.Gateway.SecurePort)) + } return port } diff --git a/pkg/operator/ceph/object/spec_test.go b/pkg/operator/ceph/object/spec_test.go index 46237879c..08974c41c 100644 --- a/pkg/operator/ceph/object/spec_test.go +++ b/pkg/operator/ceph/object/spec_test.go @@ -215,14 +215,6 @@ func TestGenerateLiveProbe(t *testing.T) { assert.Equal(t, int32(8080), p.Handler.HTTPGet.Port.IntVal) assert.Equal(t, v1.URISchemeHTTP, p.Handler.HTTPGet.Scheme) - // SSL - HostNetwork is disabled - using internal port - c.store.Spec.Gateway.Port = 0 - c.store.Spec.Gateway.SecurePort = 321 - c.store.Spec.Gateway.SSLCertificateRef = "foo" - p = c.generateLiveProbe() - assert.Equal(t, int32(8080), p.Handler.HTTPGet.Port.IntVal) - assert.Equal(t, v1.URISchemeHTTPS, p.Handler.HTTPGet.Scheme) - // No SSL - HostNetwork is enabled c.store.Spec.Gateway.Port = 123 c.store.Spec.Gateway.SecurePort = 0