mirror of
https://github.com/skooner-k8s/skooner.git
synced 2026-05-05 23:36:38 +00:00
using Prometheus to add time axis for node count
Signed-off-by: salvadorac <salvadorac@indeed.com>
This commit is contained in:
@@ -1,16 +1,24 @@
|
||||
import _ from 'lodash';
|
||||
import React from 'react';
|
||||
import Chart from './chart';
|
||||
import LoadingChart from './loadingChart';
|
||||
import {Node} from '../utils/types';
|
||||
import PrometheusGraph from '../views/prometheusgraph';
|
||||
|
||||
export default function NodeStatusChart({items}: {items?: Node[]}) {
|
||||
const readyCount = _.sumBy(items, x => getReadyStatus(x) === 'True' ? 1 : 0); // eslint-disable-line no-confusing-arrow
|
||||
|
||||
const query = {
|
||||
queryString: 'sum(kube_node_info)',
|
||||
title: 'Node Count',
|
||||
yAxisMin: 0,
|
||||
yAxisUnit: 'Nodes',
|
||||
};
|
||||
return (
|
||||
<div className='charts_item'>
|
||||
{items ? (
|
||||
<Chart used={readyCount} available={items.length} />
|
||||
<PrometheusGraph
|
||||
queryString={query.queryString}
|
||||
title={query.title}
|
||||
yAxisMin={query.yAxisMin}
|
||||
yAxisUnit={query.yAxisUnit}
|
||||
/>
|
||||
) : (
|
||||
<LoadingChart />
|
||||
)}
|
||||
@@ -19,10 +27,3 @@ export default function NodeStatusChart({items}: {items?: Node[]}) {
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function getReadyStatus({status}: Node) {
|
||||
if (!status.conditions) return null;
|
||||
|
||||
const ready = status.conditions.find(y => y.type === 'Ready');
|
||||
return ready && ready.status;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user