From 78710fe5e69b954cebc8e5754abc7b3f7194efcf Mon Sep 17 00:00:00 2001 From: Simon Gerber Date: Tue, 6 Aug 2024 15:20:05 +0200 Subject: [PATCH 1/2] Fix cloudscale remove a node how-to --- docs/modules/ROOT/pages/how-tos/cloudscale/remove_node.adoc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/modules/ROOT/pages/how-tos/cloudscale/remove_node.adoc b/docs/modules/ROOT/pages/how-tos/cloudscale/remove_node.adoc index 89d5fd03..bc09394e 100644 --- a/docs/modules/ROOT/pages/how-tos/cloudscale/remove_node.adoc +++ b/docs/modules/ROOT/pages/how-tos/cloudscale/remove_node.adoc @@ -4,7 +4,7 @@ :kubectl_extra_args: --as=cluster-admin :delabel_app_nodes: yes -:node-delete-list: ${NODE_TO_REPLACE} +:node-delete-list: ${NODE_TO_REMOVE} :delete-nodes-manually: no [abstract] @@ -48,10 +48,10 @@ It has to be the one with the highest terraform index. # Grab JSON copy of current Terraform state terraform state pull > .tfstate.json -export NODE_TO_REMOVE=$(jq --arg index "$node_count" -r \ +export NODE_TO_REMOVE=$(jq -r \ '.resources[] | select(.module=="module.cluster.module.worker" and .type=="cloudscale_server") | - .instances[$index|tonumber-1] | + .instances[.instances|length-1] | .attributes.name | split(".") | first' \ .tfstate.json) echo $NODE_TO_REMOVE From 9cb029d1d911e5d24afebba9bd0c76be3601aba8 Mon Sep 17 00:00:00 2001 From: Simon Gerber Date: Tue, 6 Aug 2024 15:20:55 +0200 Subject: [PATCH 2/2] Fix Exoscale remove node how-to --- docs/modules/ROOT/pages/how-tos/exoscale/remove_node.adoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/modules/ROOT/pages/how-tos/exoscale/remove_node.adoc b/docs/modules/ROOT/pages/how-tos/exoscale/remove_node.adoc index f6674d64..aae8999d 100644 --- a/docs/modules/ROOT/pages/how-tos/exoscale/remove_node.adoc +++ b/docs/modules/ROOT/pages/how-tos/exoscale/remove_node.adoc @@ -49,10 +49,10 @@ It has to be the one with the highest terraform index. # Grab JSON copy of current Terraform state terraform state pull > .tfstate.json -export NODE_TO_REMOVE=$(jq --arg index "$node_count" -r \ +export NODE_TO_REMOVE=$(jq -r \ '.resources[] | select(.module=="module.cluster.module.worker" and .type=="exoscale_compute") | - .instances[$index|tonumber-1] | + .instances[.instances|length-1] | .attributes.hostname' \ .tfstate.json) echo $NODE_TO_REMOVE