Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display AutoEvicting on Node tab while auto evicting #663

Merged
merged 2 commits into from
Dec 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/routes/dashboard/components/resourceOverview.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ class ResourceOverview extends React.Component {
faulted: faultedVolume(volume.data).length,
}

// We do not represent autoEvicting in the resource overview. autoEvicting nodes are also unschedulable.
const nodeInfo = {
// Total. The total number of nodes.
total: host.data.length,
Expand Down Expand Up @@ -238,6 +239,7 @@ class ResourceOverview extends React.Component {
},
}

// We do not represent autoEvicting in the resource overview. autoEvicting nodes are also unschedulable.
const nodeInfoColors = [nodeStatusColorMap.schedulable.color, nodeStatusColorMap.unschedulable.color, nodeStatusColorMap.down.color, nodeStatusColorMap.disabled.color]
const nodeInfoData = [
{ key: 'schedulable', name: 'Schedulable', value: nodeInfo.schedulable },
Expand Down
2 changes: 1 addition & 1 deletion src/routes/host/DiskList.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function diskList({ disks, node, storageOverProvisioningPercentage, minimalSched
return (<span className="disabled">Disabled</span>)
}
if (node.conditions && node.conditions.Schedulable && node.conditions.Schedulable.status && node.conditions.Schedulable.status.toLowerCase() === 'false') {
return (<span className="disabled">Unschedulable</span>)
return (<span className="unschedulable">Unschedulable</span>)
}
const status = d.conditions && d.conditions.Schedulable && d.conditions.Schedulable.status && d.conditions.Schedulable.status.toLowerCase() === 'true'
if (status) {
Expand Down
4 changes: 3 additions & 1 deletion src/routes/host/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import EditDisk from './EditDisk'
import HostReplica from './HostReplica'
import HostFilter from './HostFilter'
import BulkEditNode from './BulkEditNode'
import { filterNode, schedulableNode, unschedulableNode, schedulingDisabledNode, downNode, getNodeStatus } from '../../utils/filter'
import { filterNode, schedulableNode, unschedulableNode, schedulingDisabledNode, downNode, getNodeStatus, autoEvictingNode } from '../../utils/filter'

function Host({ host, volume, setting, loading, dispatch, location }) {
let hostList = null
Expand Down Expand Up @@ -74,6 +74,7 @@ function Host({ host, volume, setting, loading, dispatch, location }) {
const nodeFilterMap = {
schedulable: schedulableNode,
unschedulable: unschedulableNode,
autoEvicting: autoEvictingNode,
schedulingDisabled: schedulingDisabledNode,
down: downNode,
}
Expand Down Expand Up @@ -321,6 +322,7 @@ function Host({ host, volume, setting, loading, dispatch, location }) {
stateOption: [
{ value: 'schedulable', name: 'Schedulable' },
{ value: 'unschedulable', name: 'Unschedulable' },
{ value: 'autoEvicting', name: 'AutoEvicting' },
{ value: 'schedulingDisabled', name: 'Disabled' },
{ value: 'down', name: 'Down' },
],
Expand Down
22 changes: 16 additions & 6 deletions src/utils/filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,26 @@ const isSchedulable = (node) => node.conditions && node.conditions.Schedulable &
&& node.conditions.Ready && node.conditions.Ready.status.toLowerCase() === 'true'
&& node.allowScheduling === true
&& (Object.values(node.disks).some(d => d.allowScheduling === true) && Object.values(node.disks).some(d => d.conditions && d.conditions.Schedulable.status.toLowerCase() === 'true'))
const isUnschedulable = (node) => (node.conditions && node.allowScheduling === true && Object.values(node.disks).every(d => d.allowScheduling === false || (d.conditions && d.conditions.Schedulable && d.conditions.Schedulable.status.toLowerCase() === 'false') || (d.conditions && d.conditions.Ready && d.conditions.Ready.status.toLowerCase() === 'false'))) || (node.conditions && node.conditions.Schedulable && node.conditions.Schedulable.status.toLowerCase() === 'false')
const isAutoEvicting = (node) => node.conditions && node.conditions.Ready && node.conditions.Ready.status.toLowerCase() === 'true'
&& node.conditions.Schedulable && node.conditions.Schedulable.status.toLowerCase() === 'false'
&& node.allowScheduling === true
&& node.autoEvicting === true
const isDisabled = (node) => node.conditions && node.conditions.Ready && node.conditions.Ready.status.toLowerCase() === 'true'
&& (node.allowScheduling === false || Object.values(node.disks).every(d => d.allowScheduling === false))
const isUnschedulable = (node) => (node.conditions && node.allowScheduling === true && Object.values(node.disks).every(d => d.allowScheduling === false || (d.conditions && d.conditions.Schedulable && d.conditions.Schedulable.status.toLowerCase() === 'false') || (d.conditions && d.conditions.Ready && d.conditions.Ready.status.toLowerCase() === 'false'))) || (node.conditions && node.conditions.Schedulable && node.conditions.Schedulable.status.toLowerCase() === 'false')
const isDown = (node) => node.conditions && node.conditions.Ready && node.conditions.Ready.status.toLowerCase() === 'false'
export const nodeStatusColorMap = {
schedulable: { color: '#27AE5F', bg: 'rgba(39,174,95,.05)' },
unschedulable: { color: '#F1C40F', bg: 'rgba(241,196,15,.05)' },
// autoEvicting nodes are a subset of unschedulable nodes. We use the same color to represent both.
autoEvicting: { color: '#F1C40F', bg: 'rgba(241,196,15,.05)' },
down: { color: '#F15354', bg: 'rgba(241,83,84,.1)' },
disabled: { color: '#dee1e3', bg: 'rgba(222,225,227,.05)' },
unknown: { color: '#F15354', bg: 'rgba(241,83,84,.05)' },
}
export function getNodeStatus(node) {
const p = [{ key: 'down', name: 'Down', determine: isDown }, { key: 'disabled', name: 'Disabled', determine: isDisabled }, { key: 'unschedulable', name: 'Unschedulable', determine: isUnschedulable }, { key: 'schedulable', name: 'Schedulable', determine: isSchedulable }]
// autoEvicting nodes are a subset of unschedulable nodes and the autoEvicting status takes precedence for display.
const p = [{ key: 'down', name: 'Down', determine: isDown }, { key: 'disabled', name: 'Disabled', determine: isDisabled }, { key: 'autoEvicting', name: 'AutoEvicting', determine: isAutoEvicting }, { key: 'unschedulable', name: 'Unschedulable', determine: isUnschedulable }, { key: 'schedulable', name: 'Schedulable', determine: isSchedulable }]
for (let i = 0; i < p.length; i++) {
if (p[i].determine(node)) {
return { key: p[i].key, name: p[i].name }
Expand All @@ -40,16 +47,19 @@ export function getNodeStatus(node) {
}

// Schedulable (green)
// a. Node.Status == UP, and Node.AllowScheduling == true, and (ANY of the node.disk.AllowScheduling == true, and ANY of THOSE disk.state == Schedulable).
// Node is Ready and Schedulable by condition. Node is Schedulable by policy. At least one disk is schedulable by policy and condition.
export function schedulableNode(data) { return data.filter(node => isSchedulable(node)) }
// Unschedulable (yellow)
// a. Node.Status == UP, and Node.AllowScheduling == true, and (ANY of the node.disk.AllowScheduling == true, but ALL of THOSE disks.State == Unschedulable).
// Node is Ready by condition. Node is Schedulable by policy. Either node is not Schedulable by condition or all disks are not Ready or not Schedulable by condition.
export function unschedulableNode(data) { return data.filter(node => (isUnschedulable(node) && !isDisabled(node) && !isDown(node))) }
// AutoEvicting (also yellow)
// Node is Ready but not Schedulable by condition. Node is Schedulable by policy. Node is AutoEvicting.
export function autoEvictingNode(data) { return data.filter(node => (isAutoEvicting(node))) }
// Scheduling disabled (grey)
// a. Node.Status == UP, and (either node.AllowScheduling == false, or ALL of the disk.AllowScheduling == false)
// Node is Ready by condition. Either node is not Schedulable by policy or all disks are not Schedulable by policy.
export function schedulingDisabledNode(data) { return data.filter(node => isDisabled(node)) }
// Down (red)
// Node.Status == Down.
// Node is not ready by condition.
export function downNode(data) { return data.filter(node => isDown(node)) }

function filterData(data, field, value) {
Expand Down