Merge "Add validation for catalogues"

This commit is contained in:
Zuul 2021-03-31 12:02:56 +00:00 committed by Gerrit Code Review
commit 8cef84045b
3 changed files with 31 additions and 4 deletions

View File

@ -120,12 +120,11 @@ spec:
# TODO(mfuller): should this be enforced with a pattern?
type: string
ironicAutomatedClean:
type: boolean
type: string
httpPort:
type: integer
maximum: 65535
type: string
ironicFastTrack:
type: boolean
type: string
deployKernelUrl:
type: string
deployRamdiskUrl:

View File

@ -51,6 +51,7 @@ spec:
type: object
additionalProperties:
type: object
required: [manager, auth_proxy]
properties:
manager:
type: object
@ -66,6 +67,13 @@ spec:
type: string
tag:
type: string
ipam-manager:
type: object
properties:
repository:
type: string
tag:
type: string
images:
type: object
additionalProperties: # image groups

View File

@ -20,6 +20,7 @@ set -xe
# The location of sites whose manifests should be validated.
# This are relative to MANIFEST_ROOT above
: ${SITE_ROOT:="$(basename "${PWD}")/manifests/site"}
: ${SCHEMAS_ROOT:="${PWD}/manifests/function/airshipctl-schemas"}
: ${MANIFEST_REPO_URL:="https://review.opendev.org/airship/airshipctl"}
: ${SITE:="test-workload"}
: ${CONTEXT:="kind-airship"}
@ -99,6 +100,8 @@ fi
generate_airshipconf "default"
catalogues=("versions" "networking")
phase_plans=$(airshipctl --airshipconf ${AIRSHIPCONFIG} plan list | grep "PhasePlan" | awk -F '/' '{print $2}' | awk '{print $1}')
for plan in $phase_plans; do
@ -120,6 +123,9 @@ for plan in $phase_plans; do
# In the meantime, as new phases are added, please add them here as well.
phases=$(airshipctl --airshipconf ${AIRSHIPCONFIG} phase list --plan $plan -c $cluster | grep Phase | awk -F '/' '{print $2}' | awk '{print $1}' || true)
# apply catalogue CRDs
${KUBECTL} --context ${CLUSTER} --kubeconfig ${KUBECONFIG} apply -k ${SCHEMAS_ROOT}
for phase in $phases; do
# Guard against bootstrap or initinfra being missing, which could be the case for some configs
echo -e "\n*** Rendering ${cluster}/${phase}"
@ -128,12 +134,26 @@ for plan in $phase_plans; do
# TODO: will need to loop through phases in order, eventually
# e.g., load CRDs from initinfra first, so they're present when validating later phases
${AIRSHIPCTL} --airshipconf ${AIRSHIPCONFIG} phase render ${phase} -s executor -k CustomResourceDefinition >${TMP}/${phase}-crds.yaml
# extract rendered catalogue CRs
${AIRSHIPCTL} --airshipconf ${AIRSHIPCONFIG} phase render ${phase} -s executor -k NetworkCatalogue >${TMP}/${phase}-networking.yaml
${AIRSHIPCTL} --airshipconf ${AIRSHIPCONFIG} phase render ${phase} -s executor -k VersionsCatalogue >${TMP}/${phase}-versions.yaml
if [ -s ${TMP}/${phase}-crds.yaml ]; then
${KUBECTL} --context ${CLUSTER} apply -f ${TMP}/${phase}-crds.yaml
fi
# step 2: dry-run the entire phase
${ACTL} phase run --dry-run ${phase}
# catalogues have the label deploy-k8s: false, so they won't get applied during the dry-run
# and will have to be applied manually here
for catalogue in "${catalogues[@]}"
do
if [ -s ${TMP}/${phase}-${catalogue}.yaml ]; then
${KUBECTL} --context ${CLUSTER} --kubeconfig ${KUBECONFIG} apply -f ${TMP}/$phase-${catalogue}.yaml --dry-run=client
fi
done
done
# Delete cluster kubeconfig
rm ${KUBECONFIG}