Skip to content

Commit

Permalink
Merge pull request #939 from replicatedhq/divolgin/upgrades
Browse files Browse the repository at this point in the history
Missing arguments for upgrade.sh script
  • Loading branch information
divolgin authored Nov 25, 2020
2 parents f76d011 + efab18f commit fcbf765
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
6 changes: 5 additions & 1 deletion scripts/common/addon.sh
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,11 @@ function addon_outro() {
fi

printf "\n${YELLOW}Run this script on all remote nodes to apply changes${NC}\n"
printf "\n\t${GREEN}${prefix}upgrade.sh | sudo bash -s${dockerRegistryIP}${noProxyAddrs}${NC}\n\n"
if [ "$AIRGAP" = "1" ]; then
printf "\n\t${GREEN}${prefix}upgrade.sh | sudo bash -s airgap ${dockerRegistryIP}${noProxyAddrs}${NC}\n\n"
else
printf "\n\t${GREEN}${prefix}upgrade.sh | sudo bash -s${dockerRegistryIP}${noProxyAddrs}${NC}\n\n"
fi
printf "Press enter to proceed\n"
prompt

Expand Down
22 changes: 18 additions & 4 deletions scripts/common/upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,17 @@ function upgrade_kubernetes_remote_node_patch() {
continue
fi

DOCKER_REGISTRY_IP=$(kubectl -n kurl get service registry -o=jsonpath='{@.spec.clusterIP}' 2>/dev/null || echo "")

printf "${YELLOW}Drain node $nodeName to prepare for upgrade? ${NC}"
confirmY " "
kubernetes_drain "$nodeName"

local dockerRegistryIP=""
if [ -n "$DOCKER_REGISTRY_IP" ]; then
dockerRegistryIP=" docker-registry-ip=$DOCKER_REGISTRY_IP"
fi

local noProxyAddrs=""
if [ -n "$NO_PROXY_ADDRESSES" ]; then
noProxyAddrs=" additional-no-proxy-addresses=${NO_PROXY_ADDRESSES}"
Expand All @@ -138,9 +145,9 @@ function upgrade_kubernetes_remote_node_patch() {
printf "\n\n\tRun the upgrade script on remote node to proceed: ${GREEN}$nodeName${NC}\n\n"

if [ "$AIRGAP" = "1" ]; then
printf "\t${GREEN}cat upgrade.sh | sudo bash -s airgap kubernetes-version=${KUBERNETES_VERSION}${noProxyAddrs}${NC}\n\n"
printf "\t${GREEN}cat upgrade.sh | sudo bash -s airgap kubernetes-version=${KUBERNETES_VERSION}${noProxyAddrs}${dockerRegistryIP}${NC}\n\n"
elif [ -z "$KURL_URL" ]; then
printf "\t${GREEN}cat upgrade.sh | sudo bash -s kubernetes-version=${KUBERNETES_VERSION}${noProxyAddrs}${NC}\n\n"
printf "\t${GREEN}cat upgrade.sh | sudo bash -s kubernetes-version=${KUBERNETES_VERSION}${noProxyAddrs}${dockerRegistryIP}${NC}\n\n"
else
local prefix="curl $KURL_URL/$INSTALLER_ID/"
if [ -z "$KURL_URL" ]; then
Expand Down Expand Up @@ -231,10 +238,17 @@ function upgrade_kubernetes_remote_node_minor() {
continue
fi

DOCKER_REGISTRY_IP=$(kubectl -n kurl get service registry -o=jsonpath='{@.spec.clusterIP}' 2>/dev/null || echo "")

printf "${YELLOW}Drain node $nodeName to prepare for upgrade? ${NC}"
confirmY " "
kubernetes_drain "$nodeName"

local dockerRegistryIP=""
if [ -n "$DOCKER_REGISTRY_IP" ]; then
dockerRegistryIP=" docker-registry-ip=$DOCKER_REGISTRY_IP"
fi

local noProxyAddrs=""
if [ -n "$NO_PROXY_ADDRESSES" ]; then
noProxyAddrs=" additional-no-proxy-addresses=${NO_PROXY_ADDRESSES}"
Expand All @@ -243,9 +257,9 @@ function upgrade_kubernetes_remote_node_minor() {
printf "\n\n\tRun the upgrade script on remote node to proceed: ${GREEN}$nodeName${NC}\n\n"

if [ "$AIRGAP" = "1" ]; then
printf "\t${GREEN}cat upgrade.sh | sudo bash -s airgap kubernetes-version=${targetK8sVersion}${noProxyAddrs}${NC}\n\n"
printf "\t${GREEN}cat upgrade.sh | sudo bash -s airgap kubernetes-version=${targetK8sVersion}${noProxyAddrs}${dockerRegistryIP}${NC}\n\n"
elif [ -z "$KURL_URL" ]; then
printf "\t${GREEN}cat upgrade.sh | sudo bash -s kubernetes-version=${targetK8sVersion}${noProxyAddrs}${NC}\n\n"
printf "\t${GREEN}cat upgrade.sh | sudo bash -s kubernetes-version=${targetK8sVersion}${noProxyAddrs}${dockerRegistryIP}${NC}\n\n"
else
local prefix="curl $KURL_URL/$INSTALLER_ID/"
if [ -z "$KURL_URL" ]; then
Expand Down

0 comments on commit fcbf765

Please sign in to comment.