Skip to content

Instantly share code, notes, and snippets.

@jboyd01
Last active October 20, 2017 19:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jboyd01/f34ec15f1d916b05dd7a0abf5e3dd63d to your computer and use it in GitHub Desktop.
Save jboyd01/f34ec15f1d916b05dd7a0abf5e3dd63d to your computer and use it in GitHub Desktop.
exercising Service Catalog within OpenShift
You can validate Service Catalog using a couple of different approaches. The Service Catalog E2E is one (see the instructions
for syncing Service Catalog to OpenShift). Additionally, you can utilize the OpenShift web console or the CLI and add
applications exposed by the Template Service Broker or Ansible Service Broker. Note that some Templates create applications
directly and some use the Service Catalog. Python & HTTPD don't use Service Catalog, most templates with "persistent" in the
name do. For those that don't, there is no ServiceInstance, Class or binding created. Once you add applications to your
project, you should be able to see them via the CLI (oc get serviceinstances --all-namespaces)
In the OpenShift web console (https://127.0.0.1:8443) login as Developer (any password works) and select MyProject (or any
other project and then "Add to Project", "Browse Catalog". I believe the Ansible Service Broker offerings have (APB) in the
name.
You can also create a Service Instance & Binding via the cli (oc) using the attached JSON files. First create the secret
which has the required parameters for the service (I got this from Sam Padgett), then create the instance and then the binding.
I.E.,
oc create -f secret.json
oc create -f instance.json
oc create -f binding.json
Start OpenShift:
$ oc cluster up --version=latest --service-catalog
Login:
$ oc login -u system:admin
Start ASB:
wget https://raw.githubusercontent.com/openshift/ansible-service-broker/master/scripts/run_latest_build.sh
I edited run_latest_build.sh and commented out the start of oc (oc cluster up...) and set DOCKERHUB_USER anDOCKERHUB_PASSWORD.
{
"apiVersion": "servicecatalog.k8s.io/v1beta1",
"kind": "ServiceBinding",
"metadata": {
"name": "ups-binding3",
"namespace": "myproject"
},
"spec": {
"instanceRef": {
"name": "postgresql-persistent-8w55j"
}
}
}
{
"kind":"ServiceInstance",
"apiVersion":"servicecatalog.k8s.io/v1beta1",
"metadata":{
"namespace":"postgres",
"generateName":"postgresql-persistent-"
},
"spec":{
"externalClusterServiceClassName":"postgresql-persistent",
"externalClusterServicePlanName":"default",
"parametersFrom":[
{
"secretKeyRef":{
"name":"postgresql-persistent-parameters-xd94y",
"key":"parameters"
}
}
]
}
}
{
"apiVersion":"v1",
"kind":"Secret",
"metadata":{
"name":"postgresql-persistent-parameters-xd94y"
},
"type":"Opaque",
"stringData":{
"parameters":"{\"DATABASE_SERVICE_NAME\":\"postgresql\",\"MEMORY_LIMIT\":\"512Mi\",\"NAMESPACE\":\"openshift\",\"POSTGRESQL_DATABASE\":\"sampledb\",\"POSTGRESQL_VERSION\":\"9.5\",\"VOLUME_CAPACITY\":\"1Gi\"}"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment