From caf5e4fc3e235b94a3838ae1eaf0ed1bfce52002 Mon Sep 17 00:00:00 2001 From: hadar-co Date: Wed, 17 Aug 2022 16:00:06 +0300 Subject: [PATCH 1/3] ignore warnings in get crd output --- Utilities/crd-extractor.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Utilities/crd-extractor.sh b/Utilities/crd-extractor.sh index 9505d347..d28920f3 100755 --- a/Utilities/crd-extractor.sh +++ b/Utilities/crd-extractor.sh @@ -40,7 +40,7 @@ do ResourceKind=${crd%%.*} kubectl get crds ${crd} -o yaml > "$TMP_CRD_DIR/${ResourceKind}.yaml" 2>&1 let NUM_OF_CRDS++ -done < <(kubectl get crds 2>&1 | tail -n +2) +done < <(kubectl get crds 2>&1 | sed -n '/NAME/,$p' | tail -n +2) # If no CRDs exist in the cluster, exit if [ $NUM_OF_CRDS == 0 ]; then From d4fdef0e54369579739274a11c04a0ab58134ca3 Mon Sep 17 00:00:00 2001 From: hadar-co Date: Thu, 25 Aug 2022 11:47:29 +0300 Subject: [PATCH 2/3] ensure unique filename for each crd --- Utilities/crd-extractor.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Utilities/crd-extractor.sh b/Utilities/crd-extractor.sh index 24073744..29d5e07a 100755 --- a/Utilities/crd-extractor.sh +++ b/Utilities/crd-extractor.sh @@ -37,8 +37,8 @@ mkdir -p $TMP_CRD_DIR NUM_OF_CRDS=0 while read -r crd do - ResourceKind=${crd%%.*} - kubectl get crds ${crd} -o yaml > "$TMP_CRD_DIR/${ResourceKind}.yaml" 2>&1 + resourceKind=${crd%% *} + kubectl get crds "$resourceKind" -o yaml > "$TMP_CRD_DIR/$resourceKind.yaml" 2>&1 let NUM_OF_CRDS++ done < <(kubectl get crds 2>&1 | sed -n '/NAME/,$p' | tail -n +2) From 380ea55e274ac38ea32a5e0ac9162a9ea603e8f9 Mon Sep 17 00:00:00 2001 From: hadar-co Date: Thu, 25 Aug 2022 11:53:54 +0300 Subject: [PATCH 3/3] ensure unique filename for each crd --- Utilities/crd-extractor.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Utilities/crd-extractor.sh b/Utilities/crd-extractor.sh index 29d5e07a..d8c5c30d 100755 --- a/Utilities/crd-extractor.sh +++ b/Utilities/crd-extractor.sh @@ -38,7 +38,7 @@ NUM_OF_CRDS=0 while read -r crd do resourceKind=${crd%% *} - kubectl get crds "$resourceKind" -o yaml > "$TMP_CRD_DIR/$resourceKind.yaml" 2>&1 + kubectl get crds "$resourceKind" -o yaml > "$TMP_CRD_DIR/"$resourceKind".yaml" 2>&1 let NUM_OF_CRDS++ done < <(kubectl get crds 2>&1 | sed -n '/NAME/,$p' | tail -n +2)