1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-20 05:49:40 +02:00

refactor(cluster): migrate nodes datatable to react [EE-4962] (#10459)

Co-authored-by: testa113 <testa113>
This commit is contained in:
Ali 2023-10-16 21:19:08 +01:00 committed by GitHub
parent b346fd7f39
commit 0e47f22c0a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 448 additions and 219 deletions

View file

@ -0,0 +1,20 @@
import { Node } from 'kubernetes-types/core/v1';
export function getInternalNodeIpAddress(node?: Node) {
return node?.status?.addresses?.find(
(address) => address.type === 'InternalIP'
)?.address;
}
// most kube clusters set control-plane label, older clusters set master, microk8s doesn't have either but instead sets microk8s-controlplane
const masterLabels = [
'node-role.kubernetes.io/control-plane',
'node-role.kubernetes.io/master',
'node.kubernetes.io/microk8s-controlplane',
];
export function getRole(node: Node): 'Control plane' | 'Worker' {
return masterLabels.some((label) => node.metadata?.labels?.[label])
? 'Control plane'
: 'Worker';
}