mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-08 11:38:15 +00:00
kube-up: Only upgrade if AUTO_UPGRADE set, but set it on AWS
Installing upgrades is kind of dangerous, so make it not the default. But also set AUTO_UPGRADE=true on AWS.
This commit is contained in:
parent
b70f1c1220
commit
8b122b102f
@ -996,6 +996,7 @@ function start-master() {
|
|||||||
|
|
||||||
echo "cat > kube_env.yaml << __EOF_MASTER_KUBE_ENV_YAML"
|
echo "cat > kube_env.yaml << __EOF_MASTER_KUBE_ENV_YAML"
|
||||||
cat ${KUBE_TEMP}/master-kube-env.yaml
|
cat ${KUBE_TEMP}/master-kube-env.yaml
|
||||||
|
echo "AUTO_UPGRADE: 'true'"
|
||||||
# TODO: get rid of these exceptions / harmonize with common or GCE
|
# TODO: get rid of these exceptions / harmonize with common or GCE
|
||||||
echo "DOCKER_STORAGE: $(yaml-quote ${DOCKER_STORAGE:-})"
|
echo "DOCKER_STORAGE: $(yaml-quote ${DOCKER_STORAGE:-})"
|
||||||
echo "API_SERVERS: $(yaml-quote ${MASTER_INTERNAL_IP:-})"
|
echo "API_SERVERS: $(yaml-quote ${MASTER_INTERNAL_IP:-})"
|
||||||
@ -1090,6 +1091,7 @@ function start-minions() {
|
|||||||
echo "cd /var/cache/kubernetes-install"
|
echo "cd /var/cache/kubernetes-install"
|
||||||
echo "cat > kube_env.yaml << __EOF_KUBE_ENV_YAML"
|
echo "cat > kube_env.yaml << __EOF_KUBE_ENV_YAML"
|
||||||
cat ${KUBE_TEMP}/node-kube-env.yaml
|
cat ${KUBE_TEMP}/node-kube-env.yaml
|
||||||
|
echo "AUTO_UPGRADE: 'true'"
|
||||||
# TODO: get rid of these exceptions / harmonize with common or GCE
|
# TODO: get rid of these exceptions / harmonize with common or GCE
|
||||||
echo "DOCKER_STORAGE: $(yaml-quote ${DOCKER_STORAGE:-})"
|
echo "DOCKER_STORAGE: $(yaml-quote ${DOCKER_STORAGE:-})"
|
||||||
echo "API_SERVERS: $(yaml-quote ${MASTER_INTERNAL_IP:-})"
|
echo "API_SERVERS: $(yaml-quote ${MASTER_INTERNAL_IP:-})"
|
||||||
|
@ -183,7 +183,8 @@ apt-get-update() {
|
|||||||
# Restart any services that need restarting due to a library upgrade
|
# Restart any services that need restarting due to a library upgrade
|
||||||
# Uses needrestart
|
# Uses needrestart
|
||||||
restart-updated-services() {
|
restart-updated-services() {
|
||||||
if [[ "${AUTO_RESTART_SERVICES:-auto}" == "no" ]]; then
|
# We default to restarting services, because this is only done as part of an update
|
||||||
|
if [[ "${AUTO_RESTART_SERVICES:-true}" != "true" ]]; then
|
||||||
echo "Auto restart of services prevented by AUTO_RESTART_SERVICES=${AUTO_RESTART_SERVICES}"
|
echo "Auto restart of services prevented by AUTO_RESTART_SERVICES=${AUTO_RESTART_SERVICES}"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
@ -205,7 +206,8 @@ reboot-if-required() {
|
|||||||
cat /var/run/reboot-required.pkgs
|
cat /var/run/reboot-required.pkgs
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "${AUTO_REBOOT:-auto}" == "no" ]]; then
|
# We default to rebooting the machine because this is only done as part of an update
|
||||||
|
if [[ "${AUTO_REBOOT:-true}" != "true" ]]; then
|
||||||
echo "Reboot prevented by AUTO_REBOOT=${AUTO_REBOOT}"
|
echo "Reboot prevented by AUTO_REBOOT=${AUTO_REBOOT}"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
@ -218,6 +220,11 @@ reboot-if-required() {
|
|||||||
|
|
||||||
# Install upgrades using unattended-upgrades, then reboot or restart services
|
# Install upgrades using unattended-upgrades, then reboot or restart services
|
||||||
auto-upgrade() {
|
auto-upgrade() {
|
||||||
|
# We default to not installing upgrades
|
||||||
|
if [[ "${AUTO_UPGRADE:-false}" != "true" ]]; then
|
||||||
|
echo "AUTO_UPGRADE not set to true; won't auto-upgrade"
|
||||||
|
return
|
||||||
|
fi
|
||||||
apt-get-install unattended-upgrades needrestart
|
apt-get-install unattended-upgrades needrestart
|
||||||
unattended-upgrade --debug
|
unattended-upgrade --debug
|
||||||
reboot-if-required # We may reboot the machine right here
|
reboot-if-required # We may reboot the machine right here
|
||||||
@ -838,9 +845,7 @@ if [[ -z "${is_push}" ]]; then
|
|||||||
ensure-install-dir
|
ensure-install-dir
|
||||||
ensure-packages
|
ensure-packages
|
||||||
set-kube-env
|
set-kube-env
|
||||||
if [[ "${AUTO_UPGRADE:-auto}" != "no" ]]; then
|
|
||||||
auto-upgrade
|
auto-upgrade
|
||||||
fi
|
|
||||||
ensure-local-disks
|
ensure-local-disks
|
||||||
[[ "${KUBERNETES_MASTER}" == "true" ]] && mount-master-pd
|
[[ "${KUBERNETES_MASTER}" == "true" ]] && mount-master-pd
|
||||||
create-salt-pillar
|
create-salt-pillar
|
||||||
|
Loading…
Reference in New Issue
Block a user