Skip to content
This repository has been archived by the owner on Aug 27, 2024. It is now read-only.

Latest commit

 

History

History
183 lines (141 loc) · 6.61 KB

File metadata and controls

183 lines (141 loc) · 6.61 KB

Getting Started on OpenShift

Installation

1. Making configurations for Service Broker

The broker can be deployed to an already existing OpenShift Cluster which has enabled Service Catalog.

We recommend to finish the following installation in the OpenShift Cluster Master Node.

$ git clone https://github.com/huaweicloud/huaweicloud-service-broker.git
$ cd huaweicloud-service-broker/openshift/deploy/
$ vi config.json

Modify the file config.json to include your own configurations. Different Clouds have different configurations. See configuration.md for instructions.

The default authorization for visiting huaweicloud service broker is as following:

    "broker_config": {
        "log_level": "DEBUG",
        "username": "username",
        "password": "password"
    },

2. Creating secrets in OpenShift Cluster

Encode the authorization username and password by using base64.

$ echo -n "username" | base64
$ echo -n "password" | base64

Update the key username value and the key password value in secret-auth.yaml file by using the result of the above two commands, and then you can run the following command to create secret-auth.yaml.

$ oc create -f secret-auth.yaml

Encode the file config.json content by using base64.

$ base64 -w 0 config.json

Update the key config.json value in secret-config.yaml file by using the result of the above command, and then you can run the following command to create secret-config.yaml.

$ oc create -f secret-config.yaml

3. Creating service in OpenShift Cluster

You can find more information by openning the file service.yaml. The default name for the service is service-broker, and the default namespace for the service is default, and the default port for the service is 12345, and then you can run the following command to create service.yaml. Please make sure the service is running before going to the next step.

$ oc create -f service.yaml

4. Creating service broker in OpenShift Cluster

If you do not use the default configurations in Step 3, you can update the key url value in service-broker.yaml file by the service name, namespace and port which are created by Step 3.

$ vi service-broker.yaml

Then you can run the following command to create service-broker.yaml.

$ oc create -f service-broker.yaml

If the service broker is created successfully, you can find a service broker named cluster-service-broker by running the following command.

$ oc get clusterservicebrokers

You can also find the lastest Services clusterserviceclasses and Service Plans clusterserviceplans by running the following command.

$ oc get clusterserviceclasses -o=custom-columns=SERVICE\ NAME:.metadata.name,EXTERNAL\ NAME:.spec.externalName
$ oc get clusterserviceplans -o=custom-columns=NAME:.metadata.name,EXTERNAL\ NAME:.spec.externalName,SERVICE\ CLASS:.spec.clusterServiceClassRef.name --sort-by=.spec.clusterServiceClassRef.name

Currently the following Services and Service Plans are tested in OpenShift.

Service Name Service Description Service Plan Name Service Plan Description
rds-mysql RDS MySQL Service 5-7-17 RDS MySQL 5.7.17
5-6-35 RDS MySQL 5.6.35
5-6-34 RDS MySQL 5.6.34
5-6-33 RDS MySQL 5.6.33
5-6-30 RDS MySQL 5.6.30
rds-sqlserver RDS SQLServer Service 2014-SP2-SE RDS SQLServer 2014 SP2 SE
dcs-redis Distributed Cache Service for Redis SingleNode Redis Single Node
MasterStandby Redis Master Standby

Usage

Application Developers can start to consume the services by creating ServiceInstance and ServiceBinding resources. Take MySQL as an example.

1. Creating ServiceInstance in OpenShift Cluster

$ cd ./../examples/mysql/
$ vi mysql-service-instance.yaml

The mysql-service-instance.yaml example is using the Service rds-mysql and Service Plan 5-7-17. About the key parameters, you can find more informations in the rds-mysql.md. Then you can run the following command to create mysql-service-instance.yaml.

$ oc create -f mysql-service-instance.yaml

The following command will get more informations about the created mysql-service-instance. Please make sure the Status of mysql-service-instance is OK before going to the next step.

$ oc describe serviceinstance mysql-service-instance

2. Creating ServiceBinding in OpenShift Cluster

$ vi mysql-service-binding.yaml
$ oc create -f mysql-service-binding.yaml

This example will store the binding informations into a secret resource named mysql-service-secret.

3. Using ServiceBinding in Pod

$ oc create -f pod.yaml

The pod.yaml will use mysql-service-secret and mount it as a volume so that the nginx application can use the binding informations as an input.