Add validation for catalogues
This change ensures that catalogue CRs (i.e. networking, versions) are validated when running validate_docs script. Also fixes: * problem encountered with the creation of the ironic-vars ConfigMap when a non-string data type was used as the replacement target value. * amends VersionsCatalogue schema to allow an optional 'ipam-manager' object in capi_images, necessitated by a change to the capm3 function[0]. [0] https://review.opendev.org/c/airship/airshipctl/+/780297 Closes: #476 Change-Id: Idd05eb046e411b757b7d4f7b21a9b89b6cc51bb6
This commit is contained in:
parent
bba25054b0
commit
7222467df3
@ -120,12 +120,11 @@ spec:
|
|||||||
# TODO(mfuller): should this be enforced with a pattern?
|
# TODO(mfuller): should this be enforced with a pattern?
|
||||||
type: string
|
type: string
|
||||||
ironicAutomatedClean:
|
ironicAutomatedClean:
|
||||||
type: boolean
|
type: string
|
||||||
httpPort:
|
httpPort:
|
||||||
type: integer
|
type: string
|
||||||
maximum: 65535
|
|
||||||
ironicFastTrack:
|
ironicFastTrack:
|
||||||
type: boolean
|
type: string
|
||||||
deployKernelUrl:
|
deployKernelUrl:
|
||||||
type: string
|
type: string
|
||||||
deployRamdiskUrl:
|
deployRamdiskUrl:
|
||||||
|
@ -51,6 +51,7 @@ spec:
|
|||||||
type: object
|
type: object
|
||||||
additionalProperties:
|
additionalProperties:
|
||||||
type: object
|
type: object
|
||||||
|
required: [manager, auth_proxy]
|
||||||
properties:
|
properties:
|
||||||
manager:
|
manager:
|
||||||
type: object
|
type: object
|
||||||
@ -66,6 +67,13 @@ spec:
|
|||||||
type: string
|
type: string
|
||||||
tag:
|
tag:
|
||||||
type: string
|
type: string
|
||||||
|
ipam-manager:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
repository:
|
||||||
|
type: string
|
||||||
|
tag:
|
||||||
|
type: string
|
||||||
images:
|
images:
|
||||||
type: object
|
type: object
|
||||||
additionalProperties: # image groups
|
additionalProperties: # image groups
|
||||||
|
@ -20,6 +20,7 @@ set -xe
|
|||||||
# The location of sites whose manifests should be validated.
|
# The location of sites whose manifests should be validated.
|
||||||
# This are relative to MANIFEST_ROOT above
|
# This are relative to MANIFEST_ROOT above
|
||||||
: ${SITE_ROOT:="$(basename "${PWD}")/manifests/site"}
|
: ${SITE_ROOT:="$(basename "${PWD}")/manifests/site"}
|
||||||
|
: ${SCHEMAS_ROOT:="${PWD}/manifests/function/airshipctl-schemas"}
|
||||||
: ${MANIFEST_REPO_URL:="https://review.opendev.org/airship/airshipctl"}
|
: ${MANIFEST_REPO_URL:="https://review.opendev.org/airship/airshipctl"}
|
||||||
: ${SITE:="test-workload"}
|
: ${SITE:="test-workload"}
|
||||||
: ${CONTEXT:="kind-airship"}
|
: ${CONTEXT:="kind-airship"}
|
||||||
@ -99,6 +100,8 @@ fi
|
|||||||
|
|
||||||
generate_airshipconf "default"
|
generate_airshipconf "default"
|
||||||
|
|
||||||
|
catalogues=("versions" "networking")
|
||||||
|
|
||||||
phase_plans=$(airshipctl --airshipconf ${AIRSHIPCONFIG} plan list | grep "PhasePlan" | awk -F '/' '{print $2}' | awk '{print $1}')
|
phase_plans=$(airshipctl --airshipconf ${AIRSHIPCONFIG} plan list | grep "PhasePlan" | awk -F '/' '{print $2}' | awk '{print $1}')
|
||||||
for plan in $phase_plans; do
|
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.
|
# 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)
|
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
|
for phase in $phases; do
|
||||||
# Guard against bootstrap or initinfra being missing, which could be the case for some configs
|
# Guard against bootstrap or initinfra being missing, which could be the case for some configs
|
||||||
echo -e "\n*** Rendering ${cluster}/${phase}"
|
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
|
# 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
|
# 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
|
${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
|
if [ -s ${TMP}/${phase}-crds.yaml ]; then
|
||||||
${KUBECTL} --context ${CLUSTER} apply -f ${TMP}/${phase}-crds.yaml
|
${KUBECTL} --context ${CLUSTER} apply -f ${TMP}/${phase}-crds.yaml
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# step 2: dry-run the entire phase
|
# step 2: dry-run the entire phase
|
||||||
${ACTL} phase run --dry-run ${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
|
done
|
||||||
# Delete cluster kubeconfig
|
# Delete cluster kubeconfig
|
||||||
rm ${KUBECONFIG}
|
rm ${KUBECONFIG}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user