2022-06-29 15:14:05 +08:00
#!/bin/bash
set -e
2024-03-06 00:36:08 +08:00
TARGET_COMPONENTS = "containerd calico cilium flannel kube-ovn kube-router weave cert-manager krew helm metallb registry cephfs-provisioner rbd-provisioner aws-ebs-csi-plugin azure-csi-plugin cinder-csi-plugin gcp-pd-csi-plugin local-path-provisioner local-volume-provisioner kube-vip ingress-nginx node-feature-discovery"
2022-06-29 15:14:05 +08:00
# cd to the root directory of kubespray
cd $( dirname $0 ) /../../
echo checking kubernetes..
2023-12-11 23:56:17 +08:00
version_from_default = $( grep "^kube_version:" ./roles/kubespray-defaults/defaults/main/main.yml | awk '{print $2}' | sed s/\" //g)
2022-06-29 15:14:05 +08:00
version_from_readme = $( grep " \[kubernetes\]" ./README.md | awk '{print $3}' )
if [ " ${ version_from_default } " != " ${ version_from_readme } " ] ; then
echo " The version of kubernetes is different between main.yml( ${ version_from_default } ) and README.md( ${ version_from_readme } ). "
2022-07-05 23:02:47 +08:00
echo "If the pull request updates kubernetes version, please update README.md also."
2022-06-29 15:14:05 +08:00
exit 1
fi
for component in $( echo ${ TARGET_COMPONENTS } ) ; do
echo checking ${ component } ..
2023-12-11 23:56:17 +08:00
version_from_default = $( grep " ^ $( echo ${ component } | sed s/"-" /"_" /g) _version: " ./roles/kubespray-defaults/defaults/main/download.yml | awk '{print $2}' | sed s/\" //g | sed s/^v//)
2022-08-06 23:26:20 +08:00
if [ " ${ version_from_default } " = "" ] ; then
version_from_default = $( grep " ^ $( echo ${ component } | sed s/"-" /"_" /g) _version: " ./roles/kubernetes/node/defaults/main.yml | awk '{print $2}' | sed s/\" //g | sed s/^v//)
fi
2022-06-29 15:14:05 +08:00
version_from_readme = $( grep " \[ ${ component } \] " ./README.md | grep "https" | awk '{print $3}' | sed s/^v//)
if [ " ${ version_from_default } " != " ${ version_from_readme } " ] ; then
echo " The version of ${ component } is different between main.yml( ${ version_from_default } ) and README.md( ${ version_from_readme } ). "
2022-07-05 23:02:47 +08:00
echo " If the pull request updates ${ component } version, please update README.md also. "
2022-06-29 15:14:05 +08:00
exit 1
fi
done
echo "Succeeded to check all components."
exit 0