-
Notifications
You must be signed in to change notification settings - Fork 302
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from ContainerSolutions/api_check_script
really simple and inefficient script for checking api deprecation
- Loading branch information
Showing
4 changed files
with
60 additions
and
0 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,5 @@ | ||
v1.19.0 | ||
v1.18.0 | ||
v1.17.0 | ||
v1.16.0 | ||
v1.15.0 |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Kubernetes Examples Tests | ||
|
||
`api_check.sh` - Checks yaml against API definitions |
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,50 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Move to parent folder | ||
SOURCE="${BASH_SOURCE[0]}" | ||
while [ -h "${SOURCE}" ]; do # resolve $SOURCE until the file is no longer a symlink | ||
readonly BIN_DIR="$(cd -P "$(dirname "$SOURCE}")" && pwd)" | ||
SOURCE="$(readlink "${SOURCE}")" | ||
[[ ${SOURCE} != /* ]] && SOURCE="${BIN_DIR}/${SOURCE}" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located | ||
done | ||
readonly DIR="$(cd -P "$(dirname "${SOURCE}")" && pwd)" | ||
# Move to this directory's parent | ||
cd "${DIR}/.." | ||
|
||
if ! RES=$(kubectl deprecations --input-file Pod/simple.yaml 2>&1) | ||
then | ||
echo '`kubectl deprecations` did not run ok. You may need to install the krew 'deprecations' package. See https://krew.sigs.k8s.io/' | ||
echo 'OUTPUT:' | ||
echo "${RES}" | ||
exit 1 | ||
fi | ||
|
||
if [[ $# -eq 0 ]] | ||
then | ||
while IFS= read -r line | ||
do | ||
echo "================================================================================" | ||
echo "Looking at k8s version: ${line}" | ||
echo "================================================================================" | ||
echo | ||
for f in $(find . -type f -name "*.yaml") | ||
do | ||
echo -n "${f} " | ||
if RES=$(kubectl deprecations --error-on-deleted --error-on-deprecated --k8s-version="$line" --input-file "${f}" 2>&1) | ||
then | ||
echo '....OK' | ||
else | ||
echo | ||
echo "================================================================================" | ||
echo "Problem with file: ${f} on k8s version ${line}" | ||
echo "================================================================================" | ||
echo "Output was: ${RES}" | ||
echo "================================================================================" | ||
echo | ||
echo "Checking files... " | ||
fi | ||
done | ||
done < .supported-k8s-versions | ||
else | ||
find . -type f -name "*.yaml" -exec echo {} \; -exec kubectl deprecations --error-on-deleted --error-on-deprecated --k8s-version="v$1" --input-file {} \; | ||
fi |