Skip to content

Commit

Permalink
Merge pull request #303 from agrare/add_simple_minishift_setup
Browse files Browse the repository at this point in the history
Add a simple script to deploy MIQ on minishift

(cherry picked from commit d40b354)
  • Loading branch information
carbonin authored and simaishi committed Sep 25, 2018
1 parent 41f0c1f commit 15db993
Showing 1 changed file with 73 additions and 0 deletions.
73 changes: 73 additions & 0 deletions bin/deploy_on_minishift
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 15db993

Please sign in to comment.