Last active
March 19, 2020 18:52
-
-
Save dav1x/f985745bcd47d3e44e8df573ed1ef306 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Prep | |
export KUBECONFIG=/root/mcm-spoke2/installer/upi/vsphere/auth/kubeconfig | |
KUBEPASS=/root/mcm-spoke2/installer/upi/vsphere/auth/kubeadmin-password | |
TERRAFORM=/root/mcm-spoke2/installer/upi/vsphere | |
IGNITION=/root/mcm-spoke2/installer/upi/vsphere/ignition | |
TFVARS="/root/mcm-spoke2/installer/upi/vsphere/terraform.tfvars" | |
cd ${TERRAFORM} | |
if [ ! -f oc ]; then | |
curl https://mirror.openshift.com/pub/openshift-v4/clients/ocp/4.3.0/openshift-client-linux-4.3.0.tar.gz | tar xzv | |
fi | |
# | |
if [ ! -f openshift-install ]; then | |
curl https://mirror.openshift.com/pub/openshift-v4/clients/ocp/4.3.0/openshift-install-linux-4.3.0.tar.gz | tar xzv | |
fi | |
# function from release ci template | |
function update_image_registry() { | |
while true; do | |
sleep 10; | |
./oc get configs.imageregistry.operator.openshift.io/cluster > /dev/null && break | |
done | |
./oc patch configs.imageregistry.operator.openshift.io cluster --type merge --patch '{"spec":{"managementState":"Managed","storage":{"emptyDir":{}}}}' | |
} | |
set -xe | |
#(cd ${TERRAFORM} && terraform destroy -auto-approve) | |
rm -Rf auth *.ign metadata.json .openshift_install* | |
(cd ${TERRAFORM} && rm -Rf *.ign terraform.tfstate terraform.tfstate.backup) | |
(cd ${IGNITION} && rm -Rf *.ign) | |
cp install-config{-backup,}.yaml | |
./openshift-install create ignition-configs | |
cp -rf *.ign ignition/ | |
(cd ${TERRAFORM} && terraform init) | |
(cd ${TERRAFORM} && terraform apply -auto-approve) | |
./openshift-install wait-for bootstrap-complete --log-level debug | |
terraform apply -auto-approve -var 'bootstrap_complete=true' | |
update_image_registry | |
./openshift-install wait-for install-complete --log-level debug | |
\cp -rf $KUBECONFIG /var/www/html/config/kubeconfig-mcm2-spoke && chmod 777 /var/www/html/config/kubeconfig-mcm2-spoke | |
\cp -rf $KUBEPASS /var/www/html/config/kubeadmin-password-mcm2-spoke && chmod 777 /var/www/html/config/kubeadmin-password-mcm2-spoke | |
printf "\n" | |
printf "\n" | |
cat $KUBECONFIG |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment