From 979af5301ef744fea43ea9bac316b314d7a8476e Mon Sep 17 00:00:00 2001 From: Matt Hook Date: Tue, 11 Jul 2023 10:22:06 +1200 Subject: [PATCH] correctly identify master nodes (#9064) --- app/kubernetes/node/converter.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/kubernetes/node/converter.js b/app/kubernetes/node/converter.js index 2e2b77e57..eda1f19ff 100644 --- a/app/kubernetes/node/converter.js +++ b/app/kubernetes/node/converter.js @@ -15,7 +15,9 @@ class KubernetesNodeConverter { const hostName = _.find(data.status.addresses, { type: 'Hostname' }); res.Name = data.metadata.name ? data.metadata.name : hostName.address; res.Labels = data.metadata.labels; - res.Role = _.has(data.metadata.labels, 'node-role.kubernetes.io/master') ? 'Master' : 'Worker'; + // most kube clusters set control-plane label, older clusters set master, microk8s doesn't have either but instead sets microk8s-controlplane + let masters = ['node-role.kubernetes.io/control-plane', 'node-role.kubernetes.io/master', 'node.kubernetes.io/microk8s-controlplane']; + res.Role = _.some(masters, (master) => _.has(data.metadata.labels, master)) ? 'Master' : 'Worker'; const ready = _.find(data.status.conditions, { type: KubernetesNodeConditionTypes.READY }); const memoryPressure = _.find(data.status.conditions, { type: KubernetesNodeConditionTypes.MEMORY_PRESSURE });