diff --git a/bin/deploy_on_minishift b/bin/deploy_on_minishift new file mode 100755 index 000000000..a427cddbd --- /dev/null +++ b/bin/deploy_on_minishift @@ -0,0 +1,73 @@ +#!/bin/bash + +project=${PROJECT:-myproject} + +# Check that minishift is installed +minishift=$(which minishift) +if [ -z "$minishift" ]; +then + echo "Minishift not found, see https://github.com/minishift/minishift#getting-started for installation instructions" + exit 1 +fi + +# Ensure minishift is running +is_running=$(minishift status | grep Minishift | awk '{print $2}') +if [ "$is_running" != "Running" ]; +then + echo "You must start minishift" + exit 1 +fi + +# Make sure path to the oc binary is on our PATH +eval $(minishift oc-env) + +# Login as admin +$(oc login -u system:admin >/dev/null) + +$(oc project $project >/dev/null 2>&1) +if [ $? -ne 0 ]; +then + $(oc new-project $project >/dev/null) +fi + +$(oc describe scc anyuid | grep Users | awk '{print $2}' | grep -q $project:miq-anyuid) +if [ $? -ne 0 ]; +then + echo "Assigning SCC anyuid to miq-anyuid Service Account..." + $(oc adm policy add-scc-to-user anyuid system:serviceaccount:$project:miq-anyuid >/dev/null) +fi + +$(oc describe scc anyuid | grep Users | awk '{print $2}' | grep -q miq-orchestrator) +if [ $? -ne 0 ]; +then + echo "Assigning SCC anyuid to miq-orchestrator Service Account..." + $(oc adm policy add-scc-to-user anyuid system:serviceaccount:$project:miq-orchestrator >/dev/null) +fi + +$(oc get scc miq-sysadmin >/dev/null 2>&1) +if [ $? -ne 0 ]; +then + echo "Creating SCC miq-sysadmin" + $(oc create -f templates/miq-scc-sysadmin.yaml >/dev/null) +fi + +$(oc describe scc miq-sysadmin | grep Users | awk '{print $2}' | grep -q miq-httpd) +if [ $? -ne 0 ]; +then + echo "Assigning SCC miq-sysadmin to miq-httpd Service Account..." + $(oc adm policy add-scc-to-user miq-sysadmin system:serviceaccount:$project:miq-httpd >/dev/null) +fi + +$(oc get template manageiq >/dev/null 2>&1) +if [ $? -ne 0 ]; +then + echo "Creating manageiq template..." + $(oc create -f templates/miq-template.yaml >/dev/null) +fi + +res=$(oc get all -l app=manageiq 2>&1 >/dev/null) +if [ "$res" = "No resources found." ]; +then + echo "Creating ManageIQ app..." + res=$(oc new-app --template=manageiq) +fi