From 9142970a43ea89d36d106618df884b7b69485dc4 Mon Sep 17 00:00:00 2001 From: Yury Shchetinin Date: Tue, 3 Dec 2024 21:02:12 +0300 Subject: [PATCH] [PLAT-14315] [k8s] Make disk increase task independent of the universe health Summary: Added logic to skip prechecks for k8s universe disk update task (as there is no other way to fix broken universe) Test Plan: 1) run disk update on k8s universe verify no precheck tasks created 2) Stop tserver manually in k8s universe run resize node and verify it is successful Reviewers: hzare, anijhawan Reviewed By: anijhawan Subscribers: anijhawan, yugaware Differential Revision: https://phorge.dev.yugabyte.com/D40509 --- .../yw/commissioner/KubernetesUpgradeTaskBase.java | 10 ++++++++-- .../yw/commissioner/tasks/KubernetesTaskBase.java | 12 +++++++++--- .../commissioner/tasks/UpdateKubernetesDiskSize.java | 6 +++++- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/KubernetesUpgradeTaskBase.java b/managed/src/main/java/com/yugabyte/yw/commissioner/KubernetesUpgradeTaskBase.java index d988486b9aaf..1acec1460436 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/KubernetesUpgradeTaskBase.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/KubernetesUpgradeTaskBase.java @@ -63,13 +63,19 @@ protected boolean isBlacklistLeaders() { return getOrCreateExecutionContext().isBlacklistLeaders(); } + @Override + protected boolean isSkipPrechecks() { + return taskParams().skipNodeChecks; + } + @Override protected void createPrecheckTasks(Universe universe) { MastersAndTservers nodesToBeRestarted = getNodesToBeRestarted(); log.debug("Nodes to be restarted {}", nodesToBeRestarted); if (taskParams().upgradeOption == UpgradeOption.ROLLING_UPGRADE && nodesToBeRestarted != null - && !nodesToBeRestarted.isEmpty()) { + && !nodesToBeRestarted.isEmpty() + && !isSkipPrechecks()) { Optional nonLive = nodesToBeRestarted.getAllNodes().stream() .filter(n -> n.state != NodeDetails.NodeState.Live) @@ -92,7 +98,7 @@ protected void createPrecheckTasks(Universe universe) { @Override protected void addBasicPrecheckTasks() { - if (isFirstTry()) { + if (isFirstTry() && !isSkipPrechecks()) { verifyClustersConsistency(); } } diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/KubernetesTaskBase.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/KubernetesTaskBase.java index 2a490bee2acb..fd6df2eb9e19 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/KubernetesTaskBase.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/KubernetesTaskBase.java @@ -86,6 +86,10 @@ protected boolean isBlacklistLeaders() { return false; // TODO: Modify blacklist is disabled by default for k8s now for some reason. } + protected boolean isSkipPrechecks() { + return false; + } + public static class KubernetesPlacement { public PlacementInfo placementInfo; public Map masters; @@ -1035,10 +1039,12 @@ public void upgradePodsTask( final List nodeList = partition.nodeList; final List podNames = partition.podNames; for (NodeDetails node : nodeList) { - createNodePrecheckTasks( - node, serverTypes, SubTaskGroupType.ConfigureUniverse, true, softwareVersion); + if (!isSkipPrechecks()) { + createNodePrecheckTasks( + node, serverTypes, SubTaskGroupType.ConfigureUniverse, true, softwareVersion); + } } - if (!isReadOnlyCluster) { + if (!isReadOnlyCluster && !isSkipPrechecks()) { createCheckNodesAreSafeToTakeDownTask( Collections.singletonList( UpgradeTaskBase.MastersAndTservers.from(nodeList, serverTypes)), diff --git a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/UpdateKubernetesDiskSize.java b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/UpdateKubernetesDiskSize.java index 865efb80f007..09172182c9f3 100644 --- a/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/UpdateKubernetesDiskSize.java +++ b/managed/src/main/java/com/yugabyte/yw/commissioner/tasks/UpdateKubernetesDiskSize.java @@ -47,6 +47,11 @@ protected ResizeNodeParams taskParams() { return (ResizeNodeParams) taskParams; } + @Override + protected boolean isSkipPrechecks() { + return true; + } + @Override public void run() { try { @@ -59,7 +64,6 @@ public void run() { taskParams().expectedUniverseVersion, null /* Txn callback */); taskParams().useNewHelmNamingStyle = universe.getUniverseDetails().useNewHelmNamingStyle; preTaskActions(); - addBasicPrecheckTasks(); // String softwareVersion = userIntent.ybSoftwareVersion; // primary and readonly clusters disk resize