From 15db993f6b05f504d3e8b56818d0bb60be508de9 Mon Sep 17 00:00:00 2001 From: Nick Carboni Date: Fri, 31 Aug 2018 14:14:13 -0400 Subject: [PATCH] Merge pull request #303 from agrare/add_simple_minishift_setup Add a simple script to deploy MIQ on minishift (cherry picked from commit d40b35489b7038e361fda855fb255e8ad834830e) --- bin/deploy_on_minishift | 73 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100755 bin/deploy_on_minishift diff --git a/bin/deploy_on_minishift b/bin/deploy_on_minishift new file mode 100755 index 00000000..a427cddb --- /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