-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: switch from kubeval to kubeconform
- Switch from kubeval, which is unmaintained and outdated, to kubeconform - Update kubernetes versions in test matrices - Use upstream schema for CRDs, so we don't have to ignore missing schemas in validation - Switch away from deprecated output https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ - Switch CI nodeSelector examples to use disktype: ssd to avoid creating duplicates with baked in os defaults
- Loading branch information
Showing
10 changed files
with
56 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
|
||
KUBECONFORM_VERSION="v0.6.4" | ||
# https://github.com/yannh/kubeconform/issues/51 | ||
CRD_SPEC_URL="https://raw.githubusercontent.com/kubernetes/kubernetes/master/api/openapi-spec/v3/apis__apiextensions.k8s.io__v1_openapi.json" | ||
# Remove after v1.16 support / testing is dropped | ||
LEGACY_SCHEMA_URL="https://github.com/instrumenta/kubernetes-json-schema" | ||
OS=$(uname) | ||
|
||
CHANGED_CHARTS=${CHANGED_CHARTS:-${1:-}} | ||
if [ -n "$CHANGED_CHARTS" ]; | ||
then | ||
CHART_DIRS=$CHANGED_CHARTS | ||
else | ||
CHART_DIRS=$(ls -d charts/*) | ||
fi | ||
|
||
# install kubeconform | ||
curl --silent --show-error --fail --location --output /tmp/kubeconform.tar.gz "https://github.com/yannh/kubeconform/releases/download/${KUBECONFORM_VERSION}/kubeconform-${OS}-amd64.tar.gz" | ||
tar -xf /tmp/kubeconform.tar.gz kubeconform | ||
|
||
# validate charts | ||
for CHART_DIR in ${CHART_DIRS}; do | ||
echo "Running kubeconform for folder: '$CHART_DIR'" | ||
|
||
# Note: -ignore-missing-schemas could be added if needed, but not currently | ||
# needed since we have the schema necessary to validate the CRDs themselves. | ||
# | ||
# Also, if at some point we needed to validate things _using_ these CRDs, | ||
# they're available via | ||
# https://github.com/datreeio/CRDs-catalog/tree/main/datadoghq.com | ||
helm dep up "${CHART_DIR}" && helm template --kube-version "${KUBERNETES_VERSION#v}" \ | ||
--values "${CHART_DIR}/ci/kubeconform-values.yaml" "${CHART_DIR}" \ | ||
| ./kubeconform -strict -schema-location default -schema-location "$CRD_SPEC_URL" \ | ||
-schema-location $LEGACY_SCHEMA_URL -output pretty \ | ||
-verbose -kubernetes-version "${KUBERNETES_VERSION#v}" - | ||
done |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
charts/*/charts | ||
helm-docs | ||
kubeval | ||
kubeconform | ||
.idea | ||
vendor/ | ||
.vscode | ||
|
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.