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 <tnielsen@redhat.com>
This commit is contained in:
Travis Nielsen committed 2021-01-12 16:00:13 -07:00
1 parent 28a7d8fd87
commit 4ad432ffcf
2 files changed
+6 -7

No files matched your search

+1 -1
View File
@@ -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) {
@@ -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)