parent
e7c8560908
commit
6c81e20190
1 changed files with 4 additions and 2 deletions
|
@ -76,6 +76,7 @@ jobs:
|
|||
# Array creation failed, signal to skip organization by group
|
||||
ORGANIZE_BY_GROUP=false
|
||||
fi
|
||||
|
||||
# Extract CRDs from cluster
|
||||
NUM_OF_CRDS=0
|
||||
while read -r crd
|
||||
|
@ -89,15 +90,15 @@ jobs:
|
|||
|
||||
# Save name and group for later directory organization
|
||||
CRD_GROUPS["$resourceKind"]="$resourceGroup"
|
||||
echo CRD_GROUPS: ${CRD_GROUPS[@]}
|
||||
|
||||
let ++NUM_OF_CRDS
|
||||
done < <(kubectl get crds 2>&1 | sed -n '/NAME/,$p' | tail -n +2)
|
||||
echo numCRDs: $NUM_OF_CRDS
|
||||
|
||||
cd $SCHEMAS_DIR
|
||||
# Download converter script
|
||||
curl https://raw.githubusercontent.com/yannh/kubeconform/master/scripts/openapi2jsonschema.py --output $TMP_CRD_DIR/openapi2jsonschema.py 2>/dev/null
|
||||
|
||||
cd $SCHEMAS_DIR
|
||||
# Convert crds to jsonSchema
|
||||
python3 $TMP_CRD_DIR/openapi2jsonschema.py $TMP_CRD_DIR/*.yaml
|
||||
conversionResult=$?
|
||||
|
@ -115,6 +116,7 @@ jobs:
|
|||
crdFileName=$(basename $schema .json)
|
||||
crdKind=${crdFileName%%_*}
|
||||
crdGroup=${CRD_GROUPS[$crdKind]}
|
||||
echo making directory $crdGroup
|
||||
mkdir -p $crdGroup
|
||||
mv $schema ./$crdGroup
|
||||
done
|
||||
|
|
Loading…
Reference in a new issue