parent
9b94c1d5b3
commit
0f3c3640f0
1 changed files with 18 additions and 1 deletions
|
@ -60,7 +60,24 @@ jobs:
|
|||
env:
|
||||
KUBECONFIG: "${{ steps.kubeconfig.outputs.filePath }}"
|
||||
run: |
|
||||
kubectl get crds 2>&1 | sed -n '/NAME/,$p' | tail -n +2
|
||||
# Extract CRDs from cluster
|
||||
NUM_OF_CRDS=0
|
||||
while read -r crd
|
||||
do
|
||||
filename=${crd%% *}
|
||||
kubectl get crds "$filename" -o yaml > "$TMP_CRD_DIR/$filename.yaml" 2>&1
|
||||
echo "Extracted CRD: $filename"
|
||||
|
||||
resourceKind=$(grep "kind:" "$TMP_CRD_DIR/$filename.yaml" | awk 'NR==2{print $2}' | tr '[:upper:]' '[:lower:]')
|
||||
resourceGroup=$(grep "group:" "$TMP_CRD_DIR/$filename.yaml" | awk 'NR==1{print $2}')
|
||||
|
||||
# Save name and group for later directory organization
|
||||
CRD_GROUPS["$resourceKind"]="$resourceGroup"
|
||||
|
||||
let ++NUM_OF_CRDS
|
||||
done < <(kubectl get crds 2>&1 | sed -n '/NAME/,$p' | tail -n +2)
|
||||
echo numCRDs: $NUM_OF_CRDS
|
||||
|
||||
- name: Download and run crd-extractor
|
||||
env:
|
||||
KUBECONFIG: "${{ steps.kubeconfig.outputs.filePath }}"
|
||||
|
|
Loading…
Reference in a new issue