port 7000 for the luminous dashboard and 8443 for mimic and above

Signed-off-by: travisn <tnielsen@redhat.com>
This commit is contained in:
travisn committed 2018-11-01 11:49:37 -06:00
1 parent 906add05ce
commit 6cfd2ee11a
8 files changed
+63 -32

No files matched your search

+4 -3
View File
@@ -34,7 +34,8 @@ import (
const (
dashboardModuleName = "dashboard"
dashboardPort = 8443
dashboardPortHttps = 8443
dashboardPortHttp = 7000
dashboardUsername = "admin"
dashboardPasswordName = "rook-ceph-dashboard-password"
passwordLength = 10
@@ -50,13 +51,13 @@ func init() {
rand.Seed(time.Now().UnixNano())
}
func (c *Cluster) configureDashboard() error {
func (c *Cluster) configureDashboard(port int) error {
// enable or disable the dashboard module
if err := c.configureDashboardModule(); err != nil {
return fmt.Errorf("failed to enable mgr dashboard module. %+v", err)
}
dashboardService := c.makeDashboardService(appName)
dashboardService := c.makeDashboardService(appName, port)
if c.dashboard.Enabled {
// expose the dashboard service
if _, err := c.context.Clientset.CoreV1().Services(c.Namespace).Create(dashboardService); err != nil {
@@ -82,7 +82,7 @@ func TestStartSecureDashboard(t *testing.T) {
c := &Cluster{context: &clusterd.Context{Clientset: test.New(3), Executor: executor}, Namespace: "myns",
dashboard: cephv1beta1.DashboardSpec{Enabled: true}, cephVersion: cephv1beta1.CephVersionSpec{Name: cephv1beta1.Mimic, Image: "ceph/ceph:v13.2.2"}}
dashboardInitWaitTime = 0
err := c.configureDashboard()
err := c.configureDashboard(dashboardPortHttp)
assert.Nil(t, err)
// the dashboard is enabled, then disabled and enabled again to restart it with the cert
assert.Equal(t, 2, enables)
@@ -94,7 +94,7 @@ func TestStartSecureDashboard(t *testing.T) {
// disable the dashboard
c.dashboard.Enabled = false
err = c.configureDashboard()
err = c.configureDashboard(dashboardPortHttp)
assert.Nil(t, err)
assert.Equal(t, 2, enables)
assert.Equal(t, 2, disables)
+7 -2
View File
@@ -85,6 +85,11 @@ func New(context *clusterd.Context, namespace, rookVersion string, cephVersion c
func (c *Cluster) Start() error {
logger.Infof("start running mgr")
dashboardPort := dashboardPortHttps
if c.cephVersion.Name == cephv1beta1.Luminous {
dashboardPort = dashboardPortHttp
}
for i := 0; i < c.Replicas; i++ {
if i >= len(mgrNames) {
logger.Errorf("cannot have more than %d mgrs", len(mgrNames))
@@ -103,7 +108,7 @@ func (c *Cluster) Start() error {
}
// start the deployment
deployment := c.makeDeployment(mgrConfig)
deployment := c.makeDeployment(mgrConfig, dashboardPort)
if _, err := c.context.Clientset.ExtensionsV1beta1().Deployments(c.Namespace).Create(deployment); err != nil {
if !errors.IsAlreadyExists(err) {
return fmt.Errorf("failed to create %s deployment. %+v", resourceName, err)
@@ -122,7 +127,7 @@ func (c *Cluster) Start() error {
logger.Errorf("failed to enable mgr prometheus module. %+v", err)
}
if err := c.configureDashboard(); err != nil {
if err := c.configureDashboard(dashboardPort); err != nil {
logger.Errorf("failed to enable mgr dashboard. %+v", err)
}
+6 -6
View File
@@ -33,7 +33,7 @@ const (
mgrDaemonCommand = "ceph-mgr"
)
func (c *Cluster) makeDeployment(mgrConfig *mgrConfig) *extensions.Deployment {
func (c *Cluster) makeDeployment(mgrConfig *mgrConfig, port int) *extensions.Deployment {
podSpec := v1.PodTemplateSpec{
ObjectMeta: metav1.ObjectMeta{
Name: mgrConfig.ResourceName,
@@ -47,7 +47,7 @@ func (c *Cluster) makeDeployment(mgrConfig *mgrConfig) *extensions.Deployment {
c.makeConfigInitContainer(mgrConfig),
},
Containers: []v1.Container{
c.makeMgrDaemonContainer(mgrConfig),
c.makeMgrDaemonContainer(mgrConfig, port),
},
RestartPolicy: v1.RestartPolicyAlways,
Volumes: opspec.PodVolumes(""),
@@ -102,7 +102,7 @@ func (c *Cluster) makeConfigInitContainer(mgrConfig *mgrConfig) v1.Container {
}
}
func (c *Cluster) makeMgrDaemonContainer(mgrConfig *mgrConfig) v1.Container {
func (c *Cluster) makeMgrDaemonContainer(mgrConfig *mgrConfig, port int) v1.Container {
container := v1.Container{
Name: "mgr",
Command: []string{
@@ -128,7 +128,7 @@ func (c *Cluster) makeMgrDaemonContainer(mgrConfig *mgrConfig) v1.Container {
},
{
Name: "dashboard",
ContainerPort: int32(dashboardPort),
ContainerPort: int32(port),
Protocol: v1.ProtocolTCP,
},
},
@@ -164,7 +164,7 @@ func (c *Cluster) makeMetricsService(name string) *v1.Service {
return svc
}
func (c *Cluster) makeDashboardService(name string) *v1.Service {
func (c *Cluster) makeDashboardService(name string, port int) *v1.Service {
labels := opspec.AppLabels(appName, c.Namespace)
svc := &v1.Service{
ObjectMeta: metav1.ObjectMeta{
@@ -178,7 +178,7 @@ func (c *Cluster) makeDashboardService(name string) *v1.Service {
Ports: []v1.ServicePort{
{
Name: "https-dashboard",
Port: int32(dashboardPort),
Port: int32(port),
Protocol: v1.ProtocolTCP,
},
},
+3 -3
View File
@@ -61,7 +61,7 @@ func TestPodSpec(t *testing.T) {
ResourceName: "mgr-a",
}
d := c.makeDeployment(&mgrTestConfig)
d := c.makeDeployment(&mgrTestConfig, dashboardPortHttp)
assert.NotNil(t, d)
assert.Equal(t, "mgr-a", d.Name)
@@ -126,7 +126,7 @@ func TestPodSpec(t *testing.T) {
Protocol: v1.ProtocolTCP},
{ContainerPort: int32(metricsPort),
Protocol: v1.ProtocolTCP},
{ContainerPort: int32(dashboardPort),
{ContainerPort: int32(dashboardPortHttp),
Protocol: v1.ProtocolTCP}},
IsPrivileged: nil, // not set in spec
}
@@ -172,7 +172,7 @@ func TestHostNetwork(t *testing.T) {
ResourceName: "mgr-a",
}
d := c.makeDeployment(&mgrTestConfig)
d := c.makeDeployment(&mgrTestConfig, dashboardPortHttp)
assert.NotNil(t, d)
assert.Equal(t, true, d.Spec.Template.Spec.HostNetwork)