This commit is contained in:
Jonas Forsberg 2021-09-26 16:04:05 +02:00
parent 64a2ea0bad
commit 4d22f60e10

View File

@ -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=<REGISTRY.YOURDOMAIN.COM:PORT>/quay.io/jetstack/cert-manager-controller \
#--set webhook.image.repository=<REGISTRY.YOURDOMAIN.COM:PORT>/quay.io/jetstack/cert-manager-webhook \
#--set cainjector.image.repository=<REGISTRY.YOURDOMAIN.COM:PORT>/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=<RANCHER.YOURDOMAIN.COM> \
#--set certmanager.version=<CERTMANAGER_VERSION> \
#--set rancherImage=<REGISTRY.YOURDOMAIN.COM:PORT>/rancher/rancher \
#--set systemDefaultRegistry=<REGISTRY.YOURDOMAIN.COM:PORT> \ # 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"