Skip to content

Commit

Permalink
do not include colors in remote commands (#4838)
Browse files Browse the repository at this point in the history
also flatten remote command directory structure
  • Loading branch information
laverya committed Sep 22, 2023
1 parent e789901 commit dfaf6ae
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 6 deletions.
12 changes: 10 additions & 2 deletions scripts/common/addon.sh
Original file line number Diff line number Diff line change
Expand Up @@ -307,12 +307,20 @@ function addon_outro() {

printf "\n${YELLOW}Run this script on all remote nodes to apply changes${NC}\n"
if [ "$AIRGAP" = "1" ]; then
printf "\n\t${GREEN}cat ./upgrade.sh | sudo bash -s airgap${common_flags}${NC}\n\n" | tee "$DIR/remotes/allnodes.sh"
local command=
command=$(printf "cat ./upgrade.sh | sudo bash -s airgap${common_flags}")
echo "$command" > "$DIR/remotes/allnodes"

printf "\n\t${GREEN}%s${NC}\n\n" "$command"
else
local prefix=
prefix="$(build_installer_prefix "${INSTALLER_ID}" "${KURL_VERSION}" "${KURL_URL}" "${PROXY_ADDRESS}" "${PROXY_HTTPS_ADDRESS}")"

printf "\n\t${GREEN}${prefix}upgrade.sh | sudo bash -s${common_flags}${NC}\n\n" | tee "$DIR/remotes/allnodes.sh"
local command=
command=$(printf "${prefix}upgrade.sh | sudo bash -s${common_flags}")
echo "$command" > "$DIR/remotes/allnodes"

printf "\n\t${GREEN}%s${NC}\n\n" "$command"
fi

if [ "${KURL_IGNORE_REMOTE_UPGRADE_PROMPT}" != "1" ]; then
Expand Down
3 changes: 1 addition & 2 deletions scripts/common/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1617,6 +1617,5 @@ function kubectl_client_version() {
# create directories for remote commands to be placed within, and ensure they are empty
function setup_remote_commands_dirs() {
mkdir -p "$DIR/remotes"
rm -rf "$DIR/remotes"/*
mkdir -p "$DIR/remotes/onenode"
rm -f "$DIR/remotes/*"
}
11 changes: 9 additions & 2 deletions scripts/common/upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -520,12 +520,19 @@ function upgrade_kubernetes_remote_node() {
printf "\n\n\tRun the upgrade script on remote node to proceed: %b%s%b\n\n" "$GREEN" "$nodeName" "$NC"

if [ "$AIRGAP" = "1" ]; then
printf "\t%bcat ./upgrade.sh | sudo bash -s airgap kubernetes-version=%s%s%b\n\n" "$GREEN" "$targetK8sVersion" "$common_flags" "$NC" | tee "$DIR/remotes/onenode/$nodeName"
local command=
command=$(printf "cat ./upgrade.sh | sudo bash -s airgap kubernetes-version=%s%s" "$targetK8sVersion" "$common_flags")
echo "$command" > "$DIR/remotes/$nodeName"
printf "\t%b%s%b\n\n" "$GREEN" "$command" "$NC"
else
local prefix=
prefix="$(build_installer_prefix "${INSTALLER_ID}" "${KURL_VERSION}" "${KURL_URL}" "${PROXY_ADDRESS}" "${PROXY_HTTPS_ADDRESS}")"

printf "\t%b %supgrade.sh | sudo bash -s kubernetes-version=%s%s%b\n\n" "$GREEN" "$prefix" "$targetK8sVersion" "$common_flags" "$NC" | tee "$DIR/remotes/onenode/$nodeName"
local command=
command=$(printf "%supgrade.sh | sudo bash -s kubernetes-version=%s%s" "$prefix" "$targetK8sVersion" "$common_flags")
echo "$command" > "$DIR/remotes/$nodeName"

printf "\t%b %s%b\n\n" "$GREEN" "$command" "$NC"
fi

rm -rf "$HOME/.kube"
Expand Down
46 changes: 46 additions & 0 deletions testgrid/specs/k8s-upgrade.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
- name: 119 to 120
numPrimaryNodes: 1
numSecondaryNodes: 2
cpu: 3
flags: "yes"
installerSpec:
kubernetes:
version: 1.19.x
containerd:
version: 1.6.x
flannel:
version: latest
upgradeSpec:
kubernetes:
version: 1.20.x
containerd:
version: 1.6.x
flannel:
version: latest
postInstallScript: |
kubectl get nodes
postUpgradeScript: |
kubectl get nodes
- name: 119 to 122
numPrimaryNodes: 1
numSecondaryNodes: 2
cpu: 3
flags: "yes"
installerSpec:
kubernetes:
version: 1.19.x
containerd:
version: 1.6.x
flannel:
version: latest
upgradeSpec:
kubernetes:
version: 1.22.x
containerd:
version: 1.6.x
flannel:
version: latest
postInstallScript: |
kubectl get nodes
postUpgradeScript: |
kubectl get nodes

0 comments on commit dfaf6ae

Please sign in to comment.