Merge pull request #3822 from krig/ceph-dashboard-port

Ceph: Use HTTP port if SSL is disabled
This commit is contained in:
Sébastien Han
2019-09-18 11:29:56 +02:00
committed by GitHub
3 changed files with 12 additions and 4 deletions
+6 -2
View File
@@ -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
+1 -1
View File
@@ -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{},
+5 -1
View File
@@ -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,
},