From 4d22f60e107d8f4fa60babe7bd6fe58d178007bb Mon Sep 17 00:00:00 2001 From: Jonas Forsberg Date: Sun, 26 Sep 2021 16:04:05 +0200 Subject: [PATCH] . --- update.sh | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/update.sh b/update.sh index f181d98..43d67b4 100755 --- a/update.sh +++ b/update.sh @@ -14,6 +14,7 @@ Usage ${0##*/} [options..] -y, --yes answer 'yes' on all questions -i, --image-load pull images so they hits the local proxy -t, --tools Install/update tools (kubectl, helm, etc) +-a, --airgap Prepera manifests for airgapped Rancher installs --rmt-sync Sync database with SUSE Customer Center --rmt-enable-products Enable all preconfigured repositories --rmt-mirror Mirror repositories @@ -255,6 +256,54 @@ function install_tools(){ set -e } +function airgap(){ + new_log "Prepair manifests for airgapped installs" + for dir in $SCRIPTDIR/image-lists/Rancher/*/; do + version="${dir::-1}" + version="${version##*/}" + echo " * Rancher $version" + done + if asktobreak; then + return + fi + cd $SCRIPTDIR/airgap + + helm repo add rancher-latest https://releases.rancher.com/server-charts/latest + helm repo add jetstack https://charts.jetstack.io + helm repo update + + + #createing manifests for cert-manager + helm fetch jetstack/cert-manager --version v1.5.1 + if [[ ! -d ./manifests/cert-manager-v1.5.1 ]];then + mkdir -p ./manifests/cert-manager-v1.5.1 + fi + helm template cert-manager ./cert-manager-v1.5.1.tgz --output-dir ./manifests/cert-manager-v1.5.1 \ + --namespace cert-manager + #--set image.repository=/quay.io/jetstack/cert-manager-controller \ + #--set webhook.image.repository=/quay.io/jetstack/cert-manager-webhook \ + #--set cainjector.image.repository=/quay.io/jetstack/cert-manager-cainjector + curl -L -o ./manifests/cert-manager-v1.5.1/cert-manager-crd.yaml \ + https://github.com/jetstack/cert-manager/releases/download/v1.5.1/cert-manager.crds.yaml + + #creating manifests for Rancher + + for dir in $SCRIPTDIR/image-lists/Rancher/*/; do + version="${dir::-1}" + version="${version##*/}" + + helm template rancher ./rancher-${version#?}.tgz --output-dir ./manifests/Rancher-$version \ + --no-hooks \ + --namespace cattle-system \ + --set useBundledSystemChart=true # Use the packaged Rancher system charts + #--set hostname= \ + #--set certmanager.version= \ + #--set rancherImage=/rancher/rancher \ + #--set systemDefaultRegistry= \ # Set a default private registry to be used in Rancher + + done +} + ######################### # # Main Script @@ -271,6 +320,7 @@ RMT_MIRROR=false RMT_ENABLE_PRODUCTS=false IMAGE_LOAD=false INSTALL_TOOLS=false +AIRGAP=false while :; do case ${1-noop} in @@ -309,6 +359,10 @@ while :; do INSTALL_TOOLS=true ALL=false ;; + -a|--airgap) + AIRGAP=true + ALL=false + ;; --) #End of all options shift break @@ -334,6 +388,7 @@ done [[ $ALL == true ]] || [[ $RMT_MIRROR == true ]] && rmt_mirror [[ $ALL == true ]] || [[ $IMAGE_LOAD == true ]] && image_load [[ $ALL == true ]] || [[ $INSTALL_TOOLS == true ]] && install_tools +[[ $ALL == true ]] || [[ $AIRGAP == true ]] && airgap printf "\n DONE!!!!!!!\n"