diff --git a/pkg/operator/ceph/cluster/mgr/config.go b/pkg/operator/ceph/cluster/mgr/config.go index 52ab6d25d..548fc3970 100644 --- a/pkg/operator/ceph/cluster/mgr/config.go +++ b/pkg/operator/ceph/cluster/mgr/config.go @@ -45,8 +45,12 @@ type mgrConfig struct { func (c *Cluster) dashboardPort() int { if c.dashboard.Port == 0 { - // select default port - return dashboardPortHTTPS + // default port for HTTP/HTTPS + if c.dashboard.SSL { + return dashboardPortHTTPS + } else { + return dashboardPortHTTP + } } // crd validates port >= 0 return c.dashboard.Port diff --git a/pkg/operator/ceph/cluster/mgr/mgr_test.go b/pkg/operator/ceph/cluster/mgr/mgr_test.go index ff947003f..85cc0a927 100755 --- a/pkg/operator/ceph/cluster/mgr/mgr_test.go +++ b/pkg/operator/ceph/cluster/mgr/mgr_test.go @@ -63,7 +63,7 @@ func TestStartMGR(t *testing.T) { rookalpha.Placement{}, rookalpha.Annotations{}, cephv1.NetworkSpec{}, - cephv1.DashboardSpec{Enabled: true}, + cephv1.DashboardSpec{Enabled: true, SSL: true}, cephv1.MonitoringSpec{Enabled: true, RulesNamespace: ""}, cephv1.MgrSpec{}, v1.ResourceRequirements{}, diff --git a/pkg/operator/ceph/cluster/mgr/spec.go b/pkg/operator/ceph/cluster/mgr/spec.go index d9d85ae5d..d7274ce1d 100644 --- a/pkg/operator/ceph/cluster/mgr/spec.go +++ b/pkg/operator/ceph/cluster/mgr/spec.go @@ -309,6 +309,10 @@ func (c *Cluster) makeMetricsService(name string) *v1.Service { func (c *Cluster) makeDashboardService(name string, port int) *v1.Service { labels := opspec.AppLabels(appName, c.Namespace) + portName := "https-dashboard" + if !c.dashboard.SSL { + portName = "dashboard" + } svc := &v1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: fmt.Sprintf("%s-dashboard", name), @@ -320,7 +324,7 @@ func (c *Cluster) makeDashboardService(name string, port int) *v1.Service { Type: v1.ServiceTypeClusterIP, Ports: []v1.ServicePort{ { - Name: "https-dashboard", + Name: portName, Port: int32(port), Protocol: v1.ProtocolTCP, },