From 4ad432ffcf5bae60bf5642f0eea96bdbfd0e1e44 Mon Sep 17 00:00:00 2001 From: Travis Nielsen Date: Tue, 12 Jan 2021 13:39:43 -0700 Subject: [PATCH] ceph: only restart ceph dashboard module if settings changed If ssl was not enabled, the dashboard was being restarted with every reconcile. Instead, the dashboard should only be restarted when the settings have changed in order to reduce the frequency that the dashboard is restarted. Signed-off-by: Travis Nielsen --- pkg/operator/ceph/cluster/mgr/dashboard.go | 2 +- pkg/operator/ceph/cluster/mgr/dashboard_test.go | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/pkg/operator/ceph/cluster/mgr/dashboard.go b/pkg/operator/ceph/cluster/mgr/dashboard.go index 1281f08cc..003b73e67 100755 --- a/pkg/operator/ceph/cluster/mgr/dashboard.go +++ b/pkg/operator/ceph/cluster/mgr/dashboard.go @@ -176,7 +176,7 @@ func (c *Cluster) initializeSecureDashboard() (bool, error) { return false, errors.Wrap(err, "failed to set login credentials for the ceph dashboard") } - return true, nil + return false, nil } func (c *Cluster) createSelfSignedCert() (bool, error) { diff --git a/pkg/operator/ceph/cluster/mgr/dashboard_test.go b/pkg/operator/ceph/cluster/mgr/dashboard_test.go index 6085cfcb6..f0718c589 100644 --- a/pkg/operator/ceph/cluster/mgr/dashboard_test.go +++ b/pkg/operator/ceph/cluster/mgr/dashboard_test.go @@ -131,10 +131,9 @@ func TestStartSecureDashboard(t *testing.T) { assert.NoError(t, err) err = c.configureDashboardModules() assert.NoError(t, err) - // the dashboard is enabled, then disabled and enabled again to restart - // it with the cert, and another restart when setting the dashboard port - assert.Equal(t, 2, enables) - assert.Equal(t, 1, disables) + // the dashboard is enabled once with the new dashboard and modules + assert.Equal(t, 1, enables) + assert.Equal(t, 0, disables) assert.Equal(t, 2, moduleRetries) svc, err := c.context.Clientset.CoreV1().Services(clusterInfo.Namespace).Get(ctx, "rook-ceph-mgr-dashboard", metav1.GetOptions{}) @@ -147,8 +146,8 @@ func TestStartSecureDashboard(t *testing.T) { assert.Nil(t, err) err = c.configureDashboardModules() assert.NoError(t, err) - assert.Equal(t, 2, enables) - assert.Equal(t, 2, disables) + assert.Equal(t, 1, enables) + assert.Equal(t, 1, disables) svc, err = c.context.Clientset.CoreV1().Services(clusterInfo.Namespace).Get(ctx, "rook-ceph-mgr-dashboard", metav1.GetOptions{}) assert.NotNil(t, err)