Skip to content

Commit 7c4dc31

Browse files
committed
frontend: node: Display taint value in status
This change adds the 'value' field to the taint spec, allowing us to display the taint value in the node status on the list page. Fixes: #2975 Signed-off-by: Evangelos Skopelitis <[email protected]>
1 parent 2bac367 commit 7c4dc31

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

frontend/src/components/node/List.tsx

+2-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { HoverInfoLabel } from '../common';
55
import ResourceListView from '../common/Resource/ResourceListView';
66
import { UsageBarChart } from './Charts';
77
import { NodeReadyLabel } from './Details';
8-
import { NodeTaintsLabel } from './utils';
8+
import { formatTaint, NodeTaintsLabel } from './utils';
99

1010
export default function NodeList() {
1111
const [nodeMetrics, metricsError] = Node.useMetrics();
@@ -70,8 +70,7 @@ export default function NodeList() {
7070
{
7171
id: 'taints',
7272
label: t('translation|Taints'),
73-
getValue: node =>
74-
node.spec?.taints?.map(taint => `${taint.key}:${taint.effect}`)?.join(', '),
73+
getValue: node => node.spec?.taints?.map(taint => formatTaint(taint))?.join(', '),
7574
render: (item: Node) => <NodeTaintsLabel node={item} />,
7675
},
7776
{

frontend/src/components/node/utils.tsx

+7-2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ const PaddedChip = styled(Chip)({
1818
paddingBottom: '2px',
1919
});
2020

21+
export function formatTaint(taint: { key: string; value?: string; effect: string }) {
22+
return `${taint.key}${taint.value ? '=' + taint.value : ''}:${taint.effect}`;
23+
}
24+
2125
export function NodeTaintsLabel(props: { node: Node }) {
2226
const { node } = props;
2327
const { t } = useTranslation(['glossary', 'translation']);
@@ -26,9 +30,10 @@ export function NodeTaintsLabel(props: { node: Node }) {
2630
}
2731
const limits: ReactNode[] = [];
2832
node.spec.taints.forEach(taint => {
33+
const format = formatTaint(taint);
2934
limits.push(
30-
<Tooltip title={`${taint.key}:${taint.effect}`} key={taint.key}>
31-
<PaddedChip label={`${taint.key}:${taint.effect}`} variant="outlined" size="small" />
35+
<Tooltip title={format} key={taint.key}>
36+
<PaddedChip label={format} variant="outlined" size="small" />
3237
</Tooltip>
3338
);
3439
});

frontend/src/lib/k8s/node.ts

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ export interface KubeNode extends KubeObjectInterface {
4747
podCIDR: string;
4848
taints: {
4949
key: string;
50+
value?: string;
5051
effect: string;
5152
}[];
5253
[otherProps: string]: any;

0 commit comments

Comments
 (0)