Skip to content

Commit

Permalink
fix validate-chart scripts:
Browse files Browse the repository at this point in the history
- clean-up temp yaml file
- fix k8s version check
- fix rke2-coredns templating
- test for busybox image normally
- fix missing airgap image in multus

Signed-off-by: Thomas Ferrandiz <[email protected]>
  • Loading branch information
thomasferrandiz committed Feb 8, 2024
1 parent 572f367 commit 8d30c9c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
4 changes: 2 additions & 2 deletions charts/chart_versions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ charts:
- version: 4.8.200
filename: /charts/rke2-ingress-nginx.yaml
bootstrap: false
- version: 2.11.100-build2023051511
- version: 2.11.100-build2023051513
filename: /charts/rke2-metrics-server.yaml
bootstrap: false
- version: v4.0.2-build2023081107
- version: v4.0.2-build2023081108
filename: /charts/rke2-multus.yaml
bootstrap: true
- version: 1.5.100
Expand Down
15 changes: 10 additions & 5 deletions scripts/validate-charts
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,18 @@ check_system_registry() {
chart_tmp=$3

yaml_tmp=$(mktemp --suffix .yaml)
values="global.systemDefaultRegistry=my-registry,global.cattle.systemDefaultRegistry=my-registry,vCenter.clusterId=test-id,rke2-whereabouts.enabled=true"
values="global.systemDefaultRegistry=my-registry,global.cattle.systemDefaultRegistry=my-registry,vCenter.clusterId=test-id,global.clusterDNS=10.43.0.10\,2001:cafe:43::a,rke2-whereabouts.enabled=true"
helm template test-chart --kube-version ${KUBERNETES_VERSION} --set $values $chart_tmp > $yaml_tmp;

awk '$1 ~ /^image:/ {
if( $2 !~ /my-registry/ && $2 !~ busybox) {
if( $2 !~ /my-registry/ ) {
print $2
}
}
' $yaml_tmp

#clean-up
rm -f $yaml_tmp
}

is_supported() {
Expand Down Expand Up @@ -110,7 +113,7 @@ check_airgap() {
chart_tmp=$3

yaml_tmp=$(mktemp --suffix .yaml)
values="vCenter.clusterId=test-id,rke2-whereabouts.enabled=true"
values="vCenter.clusterId=test-id,global.clusterDNS=10.43.0.10\,2001:cafe:43::a,rke2-whereabouts.enabled=true"
helm template test-chart --kube-version ${KUBERNETES_VERSION} --set $values $chart_tmp > $yaml_tmp;

chart_folder=$(mktemp -d)
Expand All @@ -120,7 +123,7 @@ check_airgap() {
print $3 " " $5
}
' $chart_folder/$chart_name/Chart.yaml `
if ! [ -z ${version_annotation} ]; then
if ! [[ -z ${version_annotation} ]]; then
version_annotation=${version_annotation:0:-1}
read lower_bound upper_bound <<< $version_annotation

Expand All @@ -138,11 +141,13 @@ check_airgap() {
' $yaml_tmp | \
while read image
do
[ "$image" = "busybox" ] && continue
if ! grep -q $image scripts/build-images; then
echo $image
fi
done

#clean-up
rm -f $yaml_tmp
}

declare -A NO_SYSTEM_REGISTRY
Expand Down

0 comments on commit 8d30c9c

Please sign in to comment.