Fix: support kubernetes 1.24 and newer versions
Change-Id: Ia3f737e0a857d32975cc32408c67580e21a35971
(cherry picked from commit dd31552011beb414e8afa609abd55c3c24251ba6)
diff --git a/apps/kubevirt-node/app/src/main/java/org/onosproject/kubevirtnode/util/KubevirtNodeUtil.java b/apps/kubevirt-node/app/src/main/java/org/onosproject/kubevirtnode/util/KubevirtNodeUtil.java
index a5a5157..a39f6d1 100644
--- a/apps/kubevirt-node/app/src/main/java/org/onosproject/kubevirtnode/util/KubevirtNodeUtil.java
+++ b/apps/kubevirt-node/app/src/main/java/org/onosproject/kubevirtnode/util/KubevirtNodeUtil.java
@@ -83,6 +83,7 @@
private static final String ZERO = "0";
private static final String INTERNAL_IP = "InternalIP";
private static final String K8S_ROLE = "node-role.kubernetes.io";
+ private static final String CONTROL_PLANE = "control-plane";
private static final String PHYSNET_CONFIG_KEY = SONA_PROJECT_DOMAIN + "/physnet-config";
private static final String DATA_IP_KEY = SONA_PROJECT_DOMAIN + "/data-ip";
private static final String GATEWAY_CONFIG_KEY = SONA_PROJECT_DOMAIN + "/gateway-config";
@@ -340,7 +341,7 @@
for (String roleStr : rolesFull) {
String role = roleStr.split("/")[1];
- if (MASTER.name().equalsIgnoreCase(role)) {
+ if (CONTROL_PLANE.equalsIgnoreCase(role) || MASTER.name().equalsIgnoreCase(role)) {
nodeType = MASTER;
break;
}
@@ -381,7 +382,7 @@
for (String roleStr : rolesFull) {
String role = roleStr.split("/")[1];
- if (MASTER.name().equalsIgnoreCase(role)) {
+ if (CONTROL_PLANE.equalsIgnoreCase(role) || MASTER.name().equalsIgnoreCase(role)) {
nodeType = MASTER;
break;
}