mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Merge pull request #27522 from adityakali/gci53
Automatic merge from submit-queue make GCI image detection robust This change makes sure that in case we roll back a released GCI image, the image detection logic picks a correct active image. @kubernetes/goog-image @Amey-D @wonderfly @dchen1107
This commit is contained in:
commit
b442ba72e5
@ -30,13 +30,29 @@ else
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "${OS_DISTRIBUTION}" == "gci" ]]; then
|
function get_latest_gci_image() {
|
||||||
# If the master image is not set, we use the latest GCI dev image.
|
# GCI milestone to use
|
||||||
# Otherwise, we respect whatever is set by the user.
|
GCI_MILESTONE="53"
|
||||||
|
|
||||||
|
# First try to find an active (non-deprecated) image on this milestone.
|
||||||
gci_images=( $(gcloud compute images list --project google-containers \
|
gci_images=( $(gcloud compute images list --project google-containers \
|
||||||
--show-deprecated --no-standard-images --sort-by='~creationTimestamp' \
|
--no-standard-images --sort-by="~creationTimestamp" \
|
||||||
--regexp='gci-[a-z]+-53-.*' --format='table[no-heading](name)') )
|
--regexp="gci-[a-z]+-${GCI_MILESTONE}-.*" --format="table[no-heading](name)") )
|
||||||
MASTER_IMAGE=${KUBE_GCE_MASTER_IMAGE:-"${gci_images[0]}"}
|
|
||||||
|
# If no active image is available, search across all deprecated images.
|
||||||
|
if [[ ${#gci_images[@]} == 0 ]] ; then
|
||||||
|
gci_images=( $(gcloud compute images list --project google-containers \
|
||||||
|
--no-standard-images --show-deprecated --sort-by="~creationTimestamp" \
|
||||||
|
--regexp="gci-[a-z]+-${GCI_MILESTONE}-.*" --format="table[no-heading](name)") )
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "${gci_images[0]}"
|
||||||
|
}
|
||||||
|
|
||||||
|
if [[ "${OS_DISTRIBUTION}" == "gci" ]]; then
|
||||||
|
# If the master image is not set, we use the pinned GCI image.
|
||||||
|
# Otherwise, we respect whatever is set by the user.
|
||||||
|
MASTER_IMAGE=${KUBE_GCE_MASTER_IMAGE:-"$(get_latest_gci_image)"}
|
||||||
MASTER_IMAGE_PROJECT=${KUBE_GCE_MASTER_PROJECT:-google-containers}
|
MASTER_IMAGE_PROJECT=${KUBE_GCE_MASTER_PROJECT:-google-containers}
|
||||||
# The default node image when using GCI is still the Debian based ContainerVM
|
# The default node image when using GCI is still the Debian based ContainerVM
|
||||||
# until GCI gets validated for node usage.
|
# until GCI gets validated for node usage.
|
||||||
|
Loading…
Reference in New Issue
Block a user