feat: add option to overwrite KUBECONFORM_CONFIG
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
3931742f41
commit
6e6cb9e027
@ -35,22 +35,24 @@ find "${FLUX_PATH%/}" -type f -name '*.yaml' -print0 | while IFS= read -r -d $'\
|
|||||||
yq e 'true' "$file" >/dev/null
|
yq e 'true' "$file" >/dev/null
|
||||||
done
|
done
|
||||||
|
|
||||||
kubeconform_config=(
|
if [ -z "$KUBECONFORM_CONFIG" ]; then
|
||||||
|
KUBECONFORM_CONFIG=(
|
||||||
"-strict"
|
"-strict"
|
||||||
"-schema-location" "default"
|
"-schema-location" "default"
|
||||||
"-schema-location" "/etc/kube-tools/schemas/flux"
|
"-schema-location" "https://gitea.rknet.org/infra/crds-catalog/raw/branch/catalog/{{.Group}}/{{.ResourceKind}}_{{.ResourceAPIVersion}}.json"
|
||||||
"-schema-location" "/etc/kube-tools/schemas/calico/master-standalone-strict/{{ .ResourceKind }}_{{ .ResourceAPIVersion }}.json"
|
|
||||||
"-schema-location" "/etc/kube-tools/schemas/cert-manager/master-standalone-strict/{{ .ResourceKind }}_{{ .ResourceAPIVersion }}.json"
|
|
||||||
"-schema-location" "/etc/kube-tools/schemas/cloudnative-pg/master-standalone-strict/{{ .ResourceKind }}_{{ .ResourceAPIVersion }}.json"
|
|
||||||
"-exit-on-error"
|
"-exit-on-error"
|
||||||
"-summary"
|
"-summary"
|
||||||
"-skip" "Secret,CustomResourceDefinition"
|
"-skip" "Secret,CustomResourceDefinition"
|
||||||
)
|
)
|
||||||
|
else
|
||||||
|
# shellcheck disable=SC2128
|
||||||
|
IFS=', ' read -r -a KUBECONFORM_CONFIG <<<"$KUBECONFORM_CONFIG"
|
||||||
|
fi
|
||||||
|
|
||||||
printf "\nINFO - Validating clusters\n"
|
printf "\nINFO - Validating clusters\n"
|
||||||
find "${FLUX_PATH%/}/clusters" -maxdepth 2 -type f -name '*.yaml' -print0 | while IFS= read -r -d $'\0' file; do
|
find "${FLUX_PATH%/}/clusters" -maxdepth 2 -type f -name '*.yaml' -print0 | while IFS= read -r -d $'\0' file; do
|
||||||
printf "INFO - Validating cluster file %s\n" "${file}"
|
printf "INFO - Validating cluster file %s\n" "${file}"
|
||||||
kubeconform "${kubeconform_config[@]}" "${file}"
|
kubeconform "${KUBECONFORM_CONFIG[@]}" "${file}"
|
||||||
if [[ ${PIPESTATUS[0]} != 0 ]]; then
|
if [[ ${PIPESTATUS[0]} != 0 ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@ -60,7 +62,7 @@ printf "\nINFO - Validating kustomize overlays\n"
|
|||||||
find "${FLUX_PATH%/}" -type f -name $KUSTOMIZE_CONFIG -print0 | while IFS= read -r -d $'\0' file; do
|
find "${FLUX_PATH%/}" -type f -name $KUSTOMIZE_CONFIG -print0 | while IFS= read -r -d $'\0' file; do
|
||||||
printf "INFO - Validating kustomization %s\n" "${file/%$KUSTOMIZE_CONFIG/}"
|
printf "INFO - Validating kustomization %s\n" "${file/%$KUSTOMIZE_CONFIG/}"
|
||||||
kustomize build "${file/%$KUSTOMIZE_CONFIG/}" "${KUSTOMIZE_FLAGS[@]}" |
|
kustomize build "${file/%$KUSTOMIZE_CONFIG/}" "${KUSTOMIZE_FLAGS[@]}" |
|
||||||
kubeconform "${kubeconform_config[@]}"
|
kubeconform "${KUBECONFORM_CONFIG[@]}"
|
||||||
echo
|
echo
|
||||||
if [[ ${PIPESTATUS[0]} != 0 ]]; then
|
if [[ ${PIPESTATUS[0]} != 0 ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
|
Loading…
Reference in New Issue
Block a user