From b7727def23cfcb51542a9d297458e9162478ab42 Mon Sep 17 00:00:00 2001 From: Pavan Sokke Nagaraj Date: Wed, 4 Mar 2026 21:48:46 -0500 Subject: [PATCH 1/2] refactor: Rename variable for cluster namespaces in support bundle script and enhance logging for namespace processing --- support-bundle/support-bundle-infra.sh | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/support-bundle/support-bundle-infra.sh b/support-bundle/support-bundle-infra.sh index 4a93fd2..3c3daf1 100755 --- a/support-bundle/support-bundle-infra.sh +++ b/support-bundle/support-bundle-infra.sh @@ -67,18 +67,23 @@ function spectro-k8s-defaults() { fi done - CLUSTER_NS=$(kubectl get ns --output=custom-columns="Name:.metadata.name" --no-headers -l 'spectrocloud.com/cluster-name' 2>/dev/null) - if [[ -z "${CLUSTER_NS}" ]]; then - CLUSTER_NS=$(kubectl get ns -o=name | grep '^namespace/cluster-' | sed "s/^.\{10\}//") + CLUSTER_NSS=$(kubectl get ns --output=custom-columns="Name:.metadata.name" --no-headers -l 'spectrocloud.com/cluster-name' 2>/dev/null) + if [[ -z "${CLUSTER_NSS}" ]]; then + CLUSTER_NSS=$(kubectl get ns -o=name | grep '^namespace/cluster-' | sed "s/^.\{10\}//") fi - if [[ -z "${CLUSTER_NS}" ]]; then + if [[ -z "${CLUSTER_NSS}" ]]; then techo "Palette cluster namespace is empty." else - for NS in $(echo $CLUSTER_NS | tr " " "\n"); do + for NS in $(echo $CLUSTER_NSS | tr " " "\n"); do techo "Adding namespace $NS for logs collection." SYSTEM_NAMESPACES+=("$NS") - done + + if [[ "$NS" =~ [0-9a-fA-F\-]{8,} ]]; then + CLUSTER_NS="$NS" + techo "Cluster namespace: $CLUSTER_NS" + fi + done fi SYSTEM_UPGRADE_UUID_NS=$(kubectl get ns -o=name | grep '^namespace/system-upgrade-' | sed "s/^.\{10\}//") From 86c5a4f0e72c2908d3df16ecd312feb5d38808c3 Mon Sep 17 00:00:00 2001 From: Pavan Sokke Nagaraj Date: Wed, 4 Mar 2026 21:50:50 -0500 Subject: [PATCH 2/2] refactor: Update variable naming for cluster namespaces and improve logging in support bundle script --- support-bundle/support-bundle-edge.sh | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/support-bundle/support-bundle-edge.sh b/support-bundle/support-bundle-edge.sh index 3acb391..b163f1b 100755 --- a/support-bundle/support-bundle-edge.sh +++ b/support-bundle/support-bundle-edge.sh @@ -450,18 +450,23 @@ function spectro-k8s-defaults() { fi done - CLUSTER_NS=$(kubectl get ns --output=custom-columns="Name:.metadata.name" --no-headers -l 'spectrocloud.com/cluster-name' 2>/dev/null) - if [[ -z "${CLUSTER_NS}" ]]; then - CLUSTER_NS=$(kubectl get ns -o=name | grep '^namespace/cluster-' | sed "s/^.\{10\}//") + CLUSTER_NSS=$(kubectl get ns --output=custom-columns="Name:.metadata.name" --no-headers -l 'spectrocloud.com/cluster-name' 2>/dev/null) + if [[ -z "${CLUSTER_NSS}" ]]; then + CLUSTER_NSS=$(kubectl get ns -o=name | grep '^namespace/cluster-' | sed "s/^.\{10\}//") fi - if [[ -z "${CLUSTER_NS}" ]]; then + if [[ -z "${CLUSTER_NSS}" ]]; then techo "Palette cluster namespace is empty." else - for NS in $(echo $CLUSTER_NS | tr " " "\n"); do + for NS in $(echo $CLUSTER_NSS | tr " " "\n"); do techo "Adding namespace $NS for logs collection." SYSTEM_NAMESPACES+=("$NS") - done + + if [[ "$NS" =~ [0-9a-fA-F\-]{8,} ]]; then + CLUSTER_NS="$NS" + techo "Cluster namespace: $CLUSTER_NS" + fi + done fi SYSTEM_UPGRADE_UUID_NS=$(kubectl get ns -o=name | grep '^namespace/system-upgrade-' | sed "s/^.\{10\}//") @@ -753,8 +758,6 @@ function kubeadm-etcd() { } - - function canonical-k8s-dqlite() { techo "Collecting Canonical k8s dqlite info" DQLITE_DIR="/var/snap/k8s/common/var/lib/k8s-dqlite"