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

added service catalog cli details #9653

Merged
merged 1 commit into from
Jun 25, 2018
Merged

added service catalog cli details #9653

merged 1 commit into from
Jun 25, 2018

Conversation

@gaurav-nelson gaurav-nelson added this to the Future Release milestone May 30, 2018
@openshift-ci-robot openshift-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label May 30, 2018
@gaurav-nelson
Copy link
Contributor Author

@gaurav-nelson
Copy link
Contributor Author

gaurav-nelson commented May 30, 2018

@jpeeler PTAL I still need to update the examples though.


[[service-catalog-cli-broker-details]]
=== Get broker details
TBD
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be done...

[[service-catalog-cli-usage]]
== Using `svcat`
This section includes common commands to handle the user associated tasks listed
in xref:index.adoc#service-catalog-design[the service catalog workflow]. Use the `svcat help` command to get more information and view other available

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"svcat help" change to "svcat --help"

----
<1> Replace `<project-name>` with name of your project.

. Create a service instance definition file *_postgresql-apb.yaml_*.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should better use svcat command. For example,

$ svcat provision -n szh-project postgresql-instance --class rh-postgresql-apb --plan dev --params-json '{"postgresql_database":"admin","postgresql_password":"admin","postgresql_user":"admin","postgresql_version":"9.6"}'
  Name:        postgresql-instance  
  Namespace:   szh-project          
  Status:                           
  Class:       rh-postgresql-apb    
  Plan:        dev                  

Parameters:
  postgresql_database: admin
  postgresql_password: admin
  postgresql_user: admin
  postgresql_version: "9.6"

. The service catalog controller adds those credentials as secrets to the project.
====

. Create a service binding definition file *_postgresql-apb-mediawiki-apb-bind.yaml_*

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also I think we should better use svcat command. For example,

$ svcat bind postgresql-instance --name mediawiki-postgresql-binding
  Name:        mediawiki-postgresql-binding  
  Namespace:   szh-project                   
  Status:                                    
  Secret:      mediawiki-postgresql-binding  
  Instance:    postgresql-instance           

Parameters:
  {}

$ svcat get bindings
              NAME                NAMESPACE         INSTANCE         STATUS  
+------------------------------+-------------+---------------------+--------+
  mediawiki-postgresql-binding   szh-project   postgresql-instance   Ready  

+
[source, bash]
----
$ oc delete -n <project-name> servicebindings <binding-name>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unbind the service instance is ok, we don't need to delete the service binding in step 2.

$ svcat unbind --name mediawiki-postgresql-binding
deleted mediawiki-postgresql-binding

$ svcat unbind -n <project-name> <instance-name>
----

. Delete the service instance:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deprovision the service instance is ok, we don't need to delete the service instance in step 2.

$ svcat deprovision postgresql-instance
deleted postgresql-instance

$ oc delete clusterservicebrokers <broker-name>
----

To verify that the broker is removed, view the `ClusterServiceClass` resources for the broker.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should verify the broker is removed first.

$ svcat get brokers
           NAME                                                URL                                        STATUS  
+------------------------+------------------------------------------------------------------------------+--------+

@gaurav-nelson
Copy link
Contributor Author

@jpeeler @sunzhaohua2 I was unable to test or run the commands myself. Can you please help me by providing example commands and output for following commands so that all the commands follow a single example through out.

  1. svcat get brokers
  2. svcat sync broker <broker-name>
  3. svcat get classes
  4. svcat describe class <class-name>
  5. svcat get plans
  6. svcat get instances

Please see the rendered document for this PR to identify the commands and the flow.

@sunzhaohua2
Copy link

sunzhaohua2 commented Jun 6, 2018

@gaurav-nelson Below are some examples you can refer. And delete bindings and instances using commands "svcat unbind" and "svcat deprovision" are ok, we should remove "oc delete" command related. Thanks.

$ svcat get brokers
           NAME                                                        URL                                              STATUS  
+-------------------------+-------------------------------------------------------------------------------------------+--------+
  ansible-service-broker    https://asb.openshift-ansible-service-broker.svc:1338/ansible-service-broker                Ready   
  template-service-broker   https://apiserver.openshift-template-service-broker.svc:443/brokers/template.openshift.io   Ready   

$ svcat sync broker ansible-service-broker
Synchronization requested for broker: ansible-service-broker

$ svcat get classes
                      NAME                                                                         DESCRIPTION                                                                     UUID                  
+-----------------------------------------------+----------------------------------------------------------------------------------------------------------------+--------------------------------------+
  rh-mediawiki-apb                                Mediawiki apb implementation                                                                                     03b69500305d9859bb9440d9f9023784      
  
...                                                          

  rh-mariadb-apb                                  Mariadb apb implementation                                                                                       2c259ddd8059b9bc65081e07bf20058f      
  rh-mysql-apb                                    Software Collections MySQL APB                                                                                   73ead67495322cc462794387fa9884f5      
  rh-postgresql-apb                               SCL PostgreSQL apb implementation                                                                                d5915e05b253df421efe6e41fb6a66ba      

$ svcat describe class rh-postgresql-apb
  Name:          rh-postgresql-apb                  
  Description:   SCL PostgreSQL apb implementation  
  UUID:          d5915e05b253df421efe6e41fb6a66ba   
  Status:        Active                             
  Tags:          database, postgresql               
  Broker:        ansible-service-broker             

Plans:
  NAME            DESCRIPTION            
+------+--------------------------------+
  prod   A single DB server with         
         persistent storage              
  dev    A single DB server with no      
         storage                         

$ svcat get plans
   NAME                         CLASS                                DESCRIPTION                             UUID                  
+---------+-----------------------------------------------+--------------------------------+--------------------------------------+
  default   rh-mediawiki-apb                                An APB that deploys MediaWiki    43d3e23d214c26dbebc0879e44425db4      
  default   mariadb-ephemeral                               Default plan                     09c9e2fb-6881-11e8-bac8-fa163e5ec98b 
   
...

  prod      rh-mariadb-apb                                  This plan deploys a single       93a78b607a2e18776587f0a35ebe92a6      
                                                            MariaDB instance with 10 GiB                                           
                                                            of persistent storage                                                  
  dev       rh-mariadb-apb                                  This plan deploys a single       ba144caf21607ad5d50c06bdd0f72db3      
                                                            MariaDB instance with                                                  
                                                            ephemeral storage                                                      
  prod      rh-mysql-apb                                    A MySQL server with persistent   465063705516630c3d3e2de7798b7041      
                                                            storage                                                                
  dev       rh-mysql-apb                                    A MySQL server with ephemeral    ac68a02cfc1148713f61edb99213a17d      
                                                            storage                                                                
  prod      rh-postgresql-apb                               A single DB server with          4acaf1511a92890cd8910b1d8473be97      
                                                            persistent storage                                                     
  dev       rh-postgresql-apb                               A single DB server with no       9783fc2e859f9179833a7dd003baa841      
                                                            storage                                                                

$ svcat describe plan rh-postgresql-apb/dev
  Name:          dev                                 
  Description:   A single DB server with no storage  
  UUID:          9783fc2e859f9179833a7dd003baa841    
  Status:        Active                              
  Free:          true                                
  Class:         rh-postgresql-apb                   

Instances:
No instances defined

Instance Create Parameter Schema:
  $schema: http://json-schema.org/draft-04/schema
  additionalProperties: false
  properties:
    postgresql_database:
      default: admin
      pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$
      title: PostgreSQL Database Name
      type: string
    postgresql_password:
      pattern: ^[a-zA-Z0-9_~!@#$%^&*()-=<>,.?;:|]+$
      title: PostgreSQL Password
      type: string
    postgresql_user:
      default: admin
      maxLength: 63
      pattern: ^[a-zA-Z_][a-zA-Z0-9_]*$
      title: PostgreSQL User
      type: string
    postgresql_version:
      default: "9.6"
      enum:
      - "9.6"
      - "9.5"
      - "9.4"
      title: PostgreSQL Version
      type: string
  required:
  - postgresql_database
  - postgresql_user
  - postgresql_password
  - postgresql_version
  type: object

Instance Update Parameter Schema:
  $schema: http://json-schema.org/draft-04/schema
  additionalProperties: false
  properties:
    postgresql_version:
      default: "9.6"
      enum:
      - "9.6"
      - "9.5"
      - "9.4"
      title: PostgreSQL Version
      type: string
  required:
  - postgresql_version
  type: object

Binding Create Parameter Schema:
  $schema: http://json-schema.org/draft-04/schema
  additionalProperties: false
  type: object



$ svcat provision postgresql-instance --class rh-postgresql-apb --plan dev --params-json  '{"postgresql_database":"admin","postgresql_password":"admin","postgresql_user":"admin","postgresql_version":"9.6"}' -n szh-project
  Name:        postgresql-instance  
  Namespace:   szh-project          
  Status:                           
  Class:       rh-postgresql-apb    
  Plan:        dev                  

Parameters:
  postgresql_database: admin
  postgresql_password: admin
  postgresql_user: admin
  postgresql_version: "9.6"

$ svcat get instance
         NAME            NAMESPACE          CLASS         PLAN   STATUS  
+---------------------+-------------+-------------------+------+--------+
  postgresql-instance   szh-project   rh-postgresql-apb   dev    Ready   
  
  
$ svcat bind postgresql-instance --name mediawiki-postgresql-binding
  Name:        mediawiki-postgresql-binding  
  Namespace:   szh-project                   
  Status:                                    
  Instance:    postgresql-instance           

Parameters:
  {}

$ svcat get bindings
              NAME                NAMESPACE         INSTANCE         STATUS  
+------------------------------+-------------+---------------------+--------+
  mediawiki-postgresql-binding   szh-project   postgresql-instance   Ready   

$ svcat describe instance postgresql-instance
  Name:        postgresql-instance                                                                
  Namespace:   szh-project                                                                        
  Status:      Ready - The instance was provisioned successfully @ 2018-06-05 08:42:55 +0000 UTC  
  Class:       rh-postgresql-apb                                                                  
  Plan:        dev                                                                                

Parameters:
  postgresql_database: admin
  postgresql_password: admin
  postgresql_user: admin
  postgresql_version: "9.6"

Bindings:
              NAME               STATUS  
+------------------------------+--------+
  mediawiki-postgresql-binding   Ready   

$ oc get secret
NAME                           TYPE                                  DATA      AGE
builder-dockercfg-jxk48        kubernetes.io/dockercfg               1         6m
builder-token-92jrf            kubernetes.io/service-account-token   4         6m
builder-token-b4sm6            kubernetes.io/service-account-token   4         6m
default-dockercfg-cggcr        kubernetes.io/dockercfg               1         6m
default-token-g4sg7            kubernetes.io/service-account-token   4         6m
default-token-hvdpq            kubernetes.io/service-account-token   4         6m
deployer-dockercfg-wm8th       kubernetes.io/dockercfg               1         6m
deployer-token-hnk5w           kubernetes.io/service-account-token   4         6m
deployer-token-xfr7c           kubernetes.io/service-account-token   4         6m
mediawiki-postgresql-binding   Opaque                                6         3m

$ svcat unbind postgresql-instance -n szh-project
deleted mediawiki-postgresql-binding

$ oc get secret -n szh-project
NAME                       TYPE                                  DATA      AGE
builder-dockercfg-jxk48    kubernetes.io/dockercfg               1         9m
builder-token-92jrf        kubernetes.io/service-account-token   4         9m
builder-token-b4sm6        kubernetes.io/service-account-token   4         9m
default-dockercfg-cggcr    kubernetes.io/dockercfg               1         9m
default-token-g4sg7        kubernetes.io/service-account-token   4         9m
default-token-hvdpq        kubernetes.io/service-account-token   4         9m
deployer-dockercfg-wm8th   kubernetes.io/dockercfg               1         9m
deployer-token-hnk5w       kubernetes.io/service-account-token   4         9m
deployer-token-xfr7c       kubernetes.io/service-account-token   4         9m

$ svcat get bindings
  NAME   NAMESPACE   INSTANCE   STATUS  
+------+-----------+----------+--------+


$ svcat deprovision postgresql-instance
deleted postgresql-instance


$ svcat get instance
  NAME   NAMESPACE   CLASS   PLAN   STATUS  
+------+-----------+-------+------+--------+

$ oc delete clusterservicebrokers template-service-broker
clusterservicebroker "template-service-broker" deleted

$ svcat get brokers
           NAME                                                        URL                                              STATUS  
+-------------------------+-------------------------------------------------------------------------------------------+--------+
  ansible-service-broker    https://asb.openshift-ansible-service-broker.svc:1338/ansible-service-broker                Ready   

@gaurav-nelson
Copy link
Contributor Author

Thank you @sunzhaohua2 I will update this soon.

@gaurav-nelson
Copy link
Contributor Author

@sunzhaohua2 @jpeeler I have updated this doc, Can you please review this?

To view the available ClusterServiceClass resources:
[source, bash]
----
$ svcat get classes

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry. This part need to update. The new version svcat doesn't include UUID in get class|plan output.

$ svcat get classes
        NAME                   DESCRIPTION            
+-------------------+--------------------------------+
  rh-mediawiki-apb    Mediawiki apb implementation    
  
  ...
  
  rh-mariadb-apb      Mariadb apb implementation      
  rh-mysql-apb        Software Collections MySQL APB  
  rh-postgresql-apb   SCL PostgreSQL apb              
                      implementation  

[source, bash]
----
$ svcat get plans
NAME CLASS DESCRIPTION UUID

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part also need to update. The new version svcat doesn't include UUID in get class|plan output.

$ svcat get plans
   NAME           CLASS                  DESCRIPTION            
+---------+-------------------+--------------------------------+
  default   rh-mediawiki-apb    An APB that deploys MediaWiki   
  
  ...
  
  prod      rh-mariadb-apb      This plan deploys a single      
                                MariaDB instance with 10 GiB    
                                of persistent storage           
  dev       rh-mariadb-apb      This plan deploys a single      
                                MariaDB instance with           
                                ephemeral storage               
  prod      rh-mysql-apb        A MySQL server with persistent  
                                storage                         
  dev       rh-mysql-apb        A MySQL server with ephemeral   
                                storage                         
  prod      rh-postgresql-apb   A single DB server with         
                                persistent storage              
  dev       rh-postgresql-apb   A single DB server with no      
                                storage   

To view service instance details, run the command:
[source, bash]
----
svcat get instance

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to add "$ "

@gaurav-nelson
Copy link
Contributor Author

Thanks @sunzhaohua2 I have made suggested updates.

@gaurav-nelson gaurav-nelson added the peer-review-needed Signifies that the peer review team needs to review this PR label Jun 11, 2018
@gaurav-nelson
Copy link
Contributor Author

@openshift/team-documentation PTAL

The Service Catalog command-line interface (CLI) utility called *`svcat`* is
available to handle these user related tasks. Although these tasks can be
handled by various `oc` commands, `svcat` provides simpler commands to do the
same tasks, allowing easier interaction with the Service Catalog resources.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To avoid adverbs and passive voice, can I suggest:

While oc commands can perform the same tasks, you can use svcat to allow easier interaction with Service Catalog resources.


[[service-catalog-cli-find-broker]]
==== Find brokers
To view all the brokers installed on the cluster, run the following command:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because #minimalism, maybe drop the "run the following command"?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happens a few more times in this PR.

[[service-catalog-cli-view-serviceplans]]
==== View service plans
To view the ClusterServicePlan resources available in the cluster, run the
command:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.


[[service-catalog-cli-delete-servicebrokers]]
=== Deleting service brokers
. To remove broker services for the service catalog, delete the `ClusterServiceBroker` resource.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

: at the end

ansible-service-broker https://asb.openshift-ansible-service-broker.svc:1338/ansible-service-broker Ready
----

. View the `ClusterServiceClass` resources for the broker, to verify that the broker is removed.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same

@bfallonf
Copy link

@gaurav-nelson I made some nits 🐄

@gaurav-nelson gaurav-nelson added peer-review-done Signifies that the peer review team has reviewed this PR and removed peer-review-needed Signifies that the peer review team needs to review this PR labels Jun 12, 2018
@gaurav-nelson
Copy link
Contributor Author

Thanks @bfallonf 💵

+
[source, bash]
----
$ svcat unbind -n <project-name> <instance-name>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part doesn't seem to flow well to me. Since 1 and 2 are really the same step, I think they should be combined.

Also, it should be made clear that that when bindings are removed this way, the user doesn't have to explicitly name each binding to remove. But then give an example of how that is done, such as with svcat unbind -n szh-project --name mediawiki-postgresql-binding.

@gaurav-nelson
Copy link
Contributor Author

Thanks @jpeeler

I have updated the example and added a note with additional command to delete individual bindings.

image

+
[source, bash]
----
$ svcat get classes

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The output should be as below, uuid have been removed.

$ svcat get classes
  NAME   DESCRIPTION
+------+-------------+

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @sunzhaohua2 I have updated this.

@gaurav-nelson gaurav-nelson merged commit fa2f98f into openshift:master Jun 25, 2018
@gaurav-nelson gaurav-nelson deleted the service-catalog-cli branch June 25, 2018 09:58
@gaurav-nelson
Copy link
Contributor Author

/cherrypick enterprise-3.10

@openshift-cherrypick-robot

@gaurav-nelson: new pull request created: #10377

In response to this:

/cherrypick enterprise-3.10

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
branch/enterprise-3.10 peer-review-done Signifies that the peer review team has reviewed this PR size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants