-
Notifications
You must be signed in to change notification settings - Fork 2
/
run_latest_build.sh
executable file
·102 lines (88 loc) · 3.46 KB
/
run_latest_build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#!/bin/bash
#
# Minimal example for deploying latest built 'Ansible Service Broker'
# on oc cluster up
#
#
# We deploy oc cluster up with an explicit hostname and routing suffix
# so that pods can access routes internally.
#
# For example, we need to register the ansible service broker route to
# the service catalog when we create the broker resource. The service
# catalog needs to be able to communicate to the ansible service broker.
#
# When we use the default "127.0.0.1.nip.io" route suffix, requests
# from inside the cluster fail with an error like:
#
# From Service Catalog: controller manager
# controller.go:196] Error syncing Broker ansible-service-broker:
# Get https://asb-1338-ansible-service-broker.127.0.0.1.nip.io/v2/catalog:
# dial tcp 127.0.0.1:443: getsockopt: connection refused
#
# To resolve this, we explicitly set the
# --public-hostname and --routing-suffix
#
# We use the IP of the docker interface on our host for testing in a
# local environment, or the external listening IP if we want to expose
# the cluster to the outside.
#
# Below will default to grabbing the IP of docker0, typically this is
# 172.17.0.1 if not customized
#
PUBLIC_IP="$(ip addr show docker0 | grep -Po 'inet \K[\d.]+')"
HOSTNAME=${PUBLIC_IP}.nip.io
ROUTING_SUFFIX="${HOSTNAME}"
./oc cluster up --image=openshift/origin --version=v3.6.0-rc.0 --service-catalog=true --routing-suffix=${ROUTING_SUFFIX} --public-hostname=${HOSTNAME}
#
# A valid dockerhub username/password is required so the broker may
# authenticate with dockerhub to:
#
# 1) inspect the available repositories in an organization
# 2) read the manifest of each repository to determine metadata about
# the images
#
# This is how the Ansible Service Broker determines what content to
# expose to the Service Catalog
#
# Note: dockerhub API requirements require an authenticated user only,
# the user does not need any special access beyond read access to the
# organization.
#
# By default, the Ansible Service Broker will look at the
# 'ansibleplaybookbundle' organization, this can be overridden with the
# parameter DOCKERHUB_ORG being passed into the template.
#
DOCKERHUB_USER="changeme"
DOCKERHUB_PASS="changeme"
curl -s https://raw.githubusercontent.com/openshift/ansible-service-broker/master/templates/deploy-ansible-service-broker.template.yaml > deploy-ansible-service-broker.template.yaml
#
# Logging in as system:admin so we can create a clusterrolebinding
#
./oc login -u system:admin
./oc new-project ansible-service-broker
./oc process -f ./deploy-ansible-service-broker.template.yaml -n ansible-service-broker -p DOCKERHUB_USER="" -p DOCKERHUB_PASS="" -p DOCKERHUB_ORG="ansibleplaybookbundle" | oc create -f -
if [ "$?" -ne 0 ]; then
echo "Error processing template and creating deployment"
exit
fi
ASB_ROUTE=`./oc get routes | grep ansible-service-broker | awk '{print $2}'`
cat <<EOF > ansible-service-broker.broker
apiVersion: servicecatalog.k8s.io/v1alpha1
kind: Broker
metadata:
name: ansible-service-broker
spec:
url: https://${ASB_ROUTE}
EOF
./oc create -f ./ansible-service-broker.broker
#
# Then login as 'developer'/'developer' to WebUI
# Create a project
# Deploy mediawiki to new project (use a password other than
# admin since mediawiki forbids admin as password)
# Deploy PostgreSQL(ABP) to new project
# After they are up
# Click 'Create Binding' on the kebab menu for Mediawiki,
# select postgres
# Click deploy on mediawiki, after it's redeployed access webui
#