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