From 947e72600bc25a84146740f9a0b4b1e47dd6af72 Mon Sep 17 00:00:00 2001 From: alegrey91 Date: Mon, 5 Jul 2021 10:48:38 +0200 Subject: [PATCH] fix(velero): replace awk filtering with native kubectl parameters --- hack/velero-restore.sh | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/hack/velero-restore.sh b/hack/velero-restore.sh index dfc70b678..3f59fa177 100755 --- a/hack/velero-restore.sh +++ b/hack/velero-restore.sh @@ -59,10 +59,8 @@ check_prerequisite () { # Outputs: # list of the tenants. get_tenant_list () { - tenants=$(kubectl "$KUBEOPTIONS" get tnt | \ - awk '{if(NR>1)print}' | \ - awk '{print $1}' | \ - tr '\n' ' ') + tenants=$(kubectl "$KUBEOPTIONS" get tnt \ + --no-headers -o custom-columns=":.metadata.name") echo $tenants } @@ -75,10 +73,8 @@ get_tenant_list () { # get_namespace_list "oil" get_namespace_list () { tnt="$1" - namespaces=$(kubectl "$KUBEOPTIONS" get ns -l capsule.clastix.io/tenant="$tnt" | \ - awk '{if(NR>1)print}' | \ - awk '{print $1}' | \ - tr '\n' ' ') + namespaces=$(kubectl "$KUBEOPTIONS" get ns -l capsule.clastix.io/tenant="$tnt" \ + --no-headers -o custom-columns=":metadata.name") echo $namespaces }