From 101ae734e84c8a66a789e3af6239e85c675de78b Mon Sep 17 00:00:00 2001 From: Tim Gross Date: Wed, 25 Nov 2020 14:50:33 -0500 Subject: [PATCH] csi/ui: show Node Only for volumes when controllers aren't required (#9416) Plugin health for controllers should show "Node Only" in the UI only when both conditions are true: controllers are not required, and no controllers have registered themselves (0 expected controllers). This accounts for "monolith" plugins which might register as both controllers and nodes but not necessarily have `ControllerRequired = true` because they don't implement the Controller RPC endpoints we need (this requirement was added in #7844) This changeset includes the following fixes: * Update the Plugins tab of the UI so that monolith plugins don't show "Node Only" once they've registered. * Add the missing "Node Only" logic to the Volumes tab of the UI. --- ui/app/templates/csi/plugins/index.hbs | 7 ++++++- ui/app/templates/csi/volumes/index.hbs | 13 +++++++++++-- ui/tests/acceptance/volumes-list-test.js | 14 +++++++++----- 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/ui/app/templates/csi/plugins/index.hbs b/ui/app/templates/csi/plugins/index.hbs index 7953463bedc..5e3f7c6524f 100644 --- a/ui/app/templates/csi/plugins/index.hbs +++ b/ui/app/templates/csi/plugins/index.hbs @@ -46,7 +46,12 @@ {{if (gt row.model.controllersHealthy 0) "Healthy" "Unhealthy"}} ({{row.model.controllersHealthy}}/{{row.model.controllersExpected}}) {{else}} - Node Only + {{#if (gt row.model.controllersExpected 0)}} + {{if (gt row.model.controllersHealthy 0) "Healthy" "Unhealthy"}} + ({{row.model.controllersHealthy}}/{{row.model.controllersExpected}}) + {{else}} + Node Only + {{/if}} {{/if}} diff --git a/ui/app/templates/csi/volumes/index.hbs b/ui/app/templates/csi/volumes/index.hbs index 9290c59565b..deb649a5f9a 100644 --- a/ui/app/templates/csi/volumes/index.hbs +++ b/ui/app/templates/csi/volumes/index.hbs @@ -45,8 +45,17 @@ {{if row.model.schedulable "Schedulable" "Unschedulable"}} - {{if (gt row.model.controllersHealthy 0) "Healthy" "Unhealthy"}} - ({{row.model.controllersHealthy}}/{{row.model.controllersExpected}}) + {{#if row.model.controllerRequired}} + {{if (gt row.model.controllersHealthy 0) "Healthy" "Unhealthy"}} + ({{row.model.controllersHealthy}}/{{row.model.controllersExpected}}) + {{else}} + {{#if (gt row.model.controllersExpected 0)}} + {{if (gt row.model.controllersHealthy 0) "Healthy" "Unhealthy"}} + ({{row.model.controllersHealthy}}/{{row.model.controllersExpected}}) + {{else}} + Node Only + {{/if}} + {{/if}} {{if (gt row.model.nodesHealthy 0) "Healthy" "Unhealthy"}} diff --git a/ui/tests/acceptance/volumes-list-test.js b/ui/tests/acceptance/volumes-list-test.js index 7adf7736474..e6e18586f2e 100644 --- a/ui/tests/acceptance/volumes-list-test.js +++ b/ui/tests/acceptance/volumes-list-test.js @@ -69,15 +69,19 @@ module('Acceptance | volumes list', function(hooks) { const volumeRow = VolumesList.volumes.objectAt(0); - const controllerHealthStr = volume.controllersHealthy > 0 ? 'Healthy' : 'Unhealthy'; + let controllerHealthStr = 'Node Only'; + if (volume.controllerRequired || volume.controllersExpected > 0) { + const healthy = volume.controllersHealthy; + const expected = volume.controllersExpected; + const isHealthy = healthy > 0; + controllerHealthStr = `${isHealthy ? 'Healthy' : 'Unhealthy'} (${healthy}/${expected})`; + } + const nodeHealthStr = volume.nodesHealthy > 0 ? 'Healthy' : 'Unhealthy'; assert.equal(volumeRow.name, volume.id); assert.equal(volumeRow.schedulable, volume.schedulable ? 'Schedulable' : 'Unschedulable'); - assert.equal( - volumeRow.controllerHealth, - `${controllerHealthStr} (${volume.controllersHealthy}/${volume.controllersExpected})` - ); + assert.equal(volumeRow.controllerHealth, controllerHealthStr); assert.equal( volumeRow.nodeHealth, `${nodeHealthStr} (${volume.nodesHealthy}/${volume.nodesExpected})`