Skip to content

Instantly share code, notes, and snippets.

@futuretea
Last active March 23, 2023 12:44
Show Gist options
  • Save futuretea/46d6864ade27aa353195437e6284a9de to your computer and use it in GitHub Desktop.
Save futuretea/46d6864ade27aa353195437e6284a9de to your computer and use it in GitHub Desktop.
Harvester Upgrade to Dev Version

build iso

cd harvester
export REPO="harbor.futuretea.me/rancher"
export PUSH=true
make
make build-iso
cd dist/artifacts

upload manifest

name="v1.2-head"
target="dev:/mnt/www/share/box/harvester/upgrade/"
isoChecksum=$(sha512sum harvester-master-amd64.iso | awk '{print $1}')
releaseDate=$(date +"%Y%m%d")

cat > /tmp/version.yaml <<EOF
apiVersion: harvesterhci.io/v1beta1
kind: Version
metadata:
  name: ${name}
  namespace: harvester-system
spec:
  isoChecksum: "${isoChecksum}"
  isoURL: http://192.168.5.79/box/harvester/upgrade/harvester-master-amd64.iso
  releaseDate: "${releaseDate}"
EOF
cat > /tmp/upgrade.yaml <<EOF
apiVersion: harvesterhci.io/v1beta1
kind: Upgrade
metadata:
  generateName: hvst-upgrade-
  namespace: harvester-system
spec:
  version: ${name}
EOF
scp /tmp/version.yaml ${target}
scp /tmp/upgrade.yaml ${target}
scp harvester-master-amd64.iso ${target}

patch timeout

cat > /tmp/fix.yaml <<EOF
spec:
  values:
    systemUpgradeJobActiveDeadlineSeconds: "3600"
EOF
kubectl --namespace fleet-local patch managedcharts.management.cattle.io local-managed-system-upgrade-controller --patch-file=/tmp/fix.yaml --type merge
kubectl -n cattle-system rollout restart deploy/system-upgrade-controller
kubectl --namespace fleet-local get managedcharts.management.cattle.io local-managed-system-upgrade-controller -oyaml

upgrade

manifestsURL="http://192.168.5.79/box/harvester/upgrade"

kubectl -n harvester-system delete upgrades.harvesterhci.io --all
kubectl create -f ${manifestsURL}/version.yaml
kubectl create -f ${manifestsURL}/upgrade.yaml
watch 'kubectl -n harvester-system get upgrades.harvesterhci.io -oyaml'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment