Skip to content

Commit

Permalink
Merge pull request #6816 from spadgett/node-cores
Browse files Browse the repository at this point in the history
Bug 1852743: Show total cores in node list
  • Loading branch information
openshift-merge-robot committed Oct 6, 2020
2 parents 6d58f8f + bf365a1 commit ec399f2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
11 changes: 10 additions & 1 deletion frontend/packages/console-app/src/components/nodes/NodesPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,11 @@ const NodesTableRow = connect<NodesRowMapFromStateProps, null, NodesTableRowProp
? `${humanizeBinaryBytes(usedMem).string} / ${humanizeBinaryBytes(totalMem).string}`
: '-';
const cores = metrics?.cpu?.[nodeName];
const totalCores = metrics?.totalCPU?.[nodeName];
const cpu =
Number.isFinite(cores) && Number.isFinite(totalCores)
? `${formatCores(cores)} / ${totalCores} cores`
: '-';
const usedStrg = metrics?.usedStorage?.[nodeName];
const totalStrg = metrics?.totalStorage?.[nodeName];
const storage =
Expand Down Expand Up @@ -292,7 +297,7 @@ const NodesTableRow = connect<NodesRowMapFromStateProps, null, NodesTableRowProp
columns={columns}
columnID={nodeColumnInfo.cpu.id}
>
{cores ? `${formatCores(cores)} cores` : '-'}
{cpu}
</TableData>
<TableData
className={nodeColumnInfo.filesystem.classes}
Expand Down Expand Up @@ -443,6 +448,10 @@ const fetchNodeMetrics = (): Promise<NodeMetrics> => {
key: 'cpu',
query: 'sum by(instance) (instance:node_cpu:rate:sum)',
},
{
key: 'totalCPU',
query: 'sum by(instance) (instance:node_num_cpu:sum)',
},
{
key: 'pods',
query: 'sum by(node)(kubelet_running_pods)',
Expand Down
1 change: 1 addition & 0 deletions frontend/public/actions/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export type PodMetrics = {

export type NodeMetrics = {
cpu: MetricValuesByName;
totalCPU: MetricValuesByName;
pods: MetricValuesByName;
usedMemory: MetricValuesByName;
totalMemory: MetricValuesByName;
Expand Down

0 comments on commit ec399f2

Please sign in to comment.