Last active
April 8, 2019 14:36
-
-
Save gyfoster/90e6202307a79251faf7ead079ec553d to your computer and use it in GitHub Desktop.
For migrating resources from one OpenShift instance to another
This file contains hidden or 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
if [ $# -eq 0 ]; then | |
echo "No new project name specified. Exiting." | |
exit 1 | |
fi | |
read -p "OpenShift username: " username | |
read -s -p "OpenShift password: " password | |
mkdir openshift-mig-temp | |
oc logout | |
# on old host | |
oc login https://my-old-host.com:8443 -u=$username -p=$password | |
oc project my-project | |
echo exporting configmap "main-config"... | |
oc export configmap main-config > openshift-mig-temp/main-config.yaml | |
echo exporting all secrets... | |
oc export secrets > openshift-mig-temp/secrets.yaml | |
echo exporting all templates... | |
oc export templates > openshift-mig-temp/templates.yaml | |
echo exporting Jenkins service accounts... | |
oc export serviceaccount jenkins > openshift-mig-temp/jenkins.yaml | |
oc export serviceaccount jenkins-ci > openshift-mig-temp/jenkins-ci.yaml | |
echo exporting horizontal pod autoscalers... | |
oc export hpa > openshift-mig-temp/hpa.yaml | |
oc logout | |
# on new host | |
oc login https://my-new-host.com:8443 -u=$username -p=$password | |
oc new-project $1 | |
oc project $1 | |
oc create -f openshift-mig-temp/main-config.yaml | |
oc create -f openshift-mig-temp/secrets.yaml | |
oc create -f openshift-mig-temp/templates.yaml | |
oc create -f openshift-mig-temp/jenkins.yaml | |
oc create -f openshift-mig-temp/jenkins-ci.yaml | |
oc create -f openshift-mig-temp/hpa.yaml | |
oc import-image wildfly-11 --from=nexus.my-domain.com:5000/wildfly-11 --confirm | |
oc logout | |
rm -r openshift-mig-temp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment