-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #303 from agrare/add_simple_minishift_setup
Add a simple script to deploy MIQ on minishift (cherry picked from commit d40b354)
- Loading branch information
Showing
1 changed file
with
73 additions
and
0 deletions.
There are no files selected for viewing
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
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 |