Added support for latest tags in <platform>/latest catalog.

This commit is contained in:
Alexey Kostarev 2024-10-24 17:21:55 +05:00
parent 2a8bbe5d4d
commit f4f1bb8054
2 changed files with 14 additions and 4 deletions

View File

@ -8,3 +8,6 @@ do
mkdir -p ../$platform/$dir
../fromNativeToRegistry.sh registry.altlinux.org $platform $f > ../$platform/$dir/kube-flannel.yml
done
mkdir -p ../$platform/latest
../fromNativeToRegistry.sh registry.altlinux.org $platform $f latest > ../$platform/latest/kube-flannel.yml

View File

@ -2,11 +2,16 @@
function FlannelNameToAlt() {
image=$1
tag=$2
ifs=$IFS
IFS=:
set -- $image
image=$1
tag=$2
if [ -z "$tag" ]
then
tag=$2
fi
if [[ $1 =~ "flannel-cni-plugin" ]]
then
echo "$U7S_PLATFORM/flannel-cni-plugin:$tag"
@ -18,6 +23,7 @@ function FlannelNameToAlt() {
function kubeflannelYMLToALT() {
registry=$1
kubeFlannelFile=$2
tag=$3
initCount=$(cat $kubeFlannelFile |
yq -y 'select(.kind=="DaemonSet").spec.template.spec.initContainers' |
yq 'length')
@ -27,14 +33,14 @@ function kubeflannelYMLToALT() {
image=$(cat $kubeFlannelFile |
yq -y 'select(.kind=="DaemonSet").spec.template.spec.initContainers['$i']' |
yq -r '.image')
altImage="$registry/$(FlannelNameToAlt $image)"
altImage="$registry/$(FlannelNameToAlt $image $tag)"
q+='| select(.kind=="DaemonSet").spec.template.spec.initContainers['$i'].image="'$altImage'"'
let i=$i+1
done
image=$(cat $kubeFlannelFile |
yq -y 'select(.kind=="DaemonSet").spec.template.spec.containers[0]' |
yq -r '.image')
altImage="$registry/$(FlannelNameToAlt $image)"
altImage="$registry/$(FlannelNameToAlt $image $tag)"
q+='| select(.kind=="DaemonSet").spec.template.spec.containers[0].image="'$altImage'"'
yq -y "$q" $kubeFlannelFile
}
@ -43,4 +49,5 @@ function kubeflannelYMLToALT() {
registry=$1
export U7S_PLATFORM="k8s-$2"
file=$3
kubeflannelYMLToALT $registry $file
tag=$4
kubeflannelYMLToALT $registry $file $tag