Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a simple script to deploy MIQ on minishift #303

Merged
merged 6 commits into from
Aug 31, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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