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