Giter VIP home page Giter VIP logo

go-open-service-broker-client's People

Contributors

ash2k avatar edwardecook avatar fabstu avatar girikuncoro avatar hezhizhen avatar jberkhahn avatar jhvhs avatar jpeeler avatar kibbles-n-bytes avatar luksa avatar mhbauer avatar mook-as avatar n3wscott avatar nikhita avatar nilebox avatar onyiny-ang avatar pmorie avatar richardfung avatar shawn-hurley avatar staebler avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

go-open-service-broker-client's Issues

connectivity error messages

great library so far, would be nice to improve error message from the client so that users of the client do not need to wrap them in something more user friendy.

current errors received:

  • missing config.URL
Fetching catalog: Get /v2/catalog: unsupported protocol scheme ""
  • wrong auth creds
Using 'http://10.244.0.2:8080' service broker
ERROR: logging before flag.Parse: I0828 18:52:18.359582   97591 client.go:192] handling failure responses

Fetching catalog: Status: 401; ErrorMessage: <nil>; Description: <nil>; ResponseError: invalid character 'N' looking for beginning of value

wdyt?

cc @youreddy

Mismatch between this library and OSB schema

As @luksa pointed out in #96, parts of this library's types don't match the OSB schema.

  • The ParameterSchemas field of Plan should be called Schemas
  • The type ParameterSchemas should be called Schemas
  • The ServiceInstances field of Schemas should be called ServiceInstance
  • The ServiceBindings field of Schemas should be called ServiceBindings

RequestResponseSchema not present in any version of OSBAPI spec

As part of #146 I noticed that ServiceBindingSchema.Create are of type RequestResponseSchema rather than simply InputParametersSchema: https://github.com/kubernetes-sigs/go-open-service-broker-client/blob/56a01c84bf43813ca1f99edb5033812927cd67ab/v2/types.go#L149

This is not in line with any released version of the OSBAPI spec or with master:

It seems like it was part of an earlier draft version of the schema spec: https://github.com/n3wscott/servicebroker/blob/95910853f5287b7b647fce28e4165f42d3a5b715/spec.md#schema-object

I propose that we switch ServiceBindingSchema.Create to just be of type InputParametersSchema to simplify the logic we have in get_catalog.go

glog not writing full logs with clientConfig.Verbose=true

I'm seeing messages that look like this:

 "services": [
    {
      "name": "dh-mongodb-apb",
      "id": "e9c042c4925dd0c7c25ceca4f5179e1c",
      "description": "Deploy MongoDB app on your Openshift Project",
      "bindable": true,
      "metadata": {
        "displayName": "MongoDB (APB)",
        "documentationUrl": "https://access.redhat.com",
        "imageUrl": "http://nightdeveloper.net/wp-content/uploads/2014/12/mongo_db.png",
        "longDescription": "MongoDB is a document database with the scalability and flexibility that you want with the querying and indexing that you need. This APB will cover an standalone and HA deployment.",
        "providerDisplayName": "Red Hat, Inc."
      },
      "instances_retrievable": true,
      "bindings_retrievable": true,
      "plans": [
        {
          "id": "85f2cc9b1c440e49dce41f2939dca1d2",
          "name": "ephemeral",
          "description": "This default plan deploys mongodb-apb",
          "metadata": {
            "cost": "€0.00",
            "displayName": "Ephemeral",
            "longDescription": "This plan will deploy a MongoDB standalone or HA instance/s using ephemeral storage",
            "schemas": {
              "service_binding": {
                "create": {
                  "openshift_form_definition": []
                }
              },
              "service_instance": {
                "create": {
                  "openshift_form_definition": [
                    {
                      "title": "Container Specs",
                      "type": "fieldset",
                      "items": [
                        {
                          "key": "MONGODB_VERSION",
                          "type": "select"
                        },
                        "MONGODB_IMAGE_TAG",
                        "USE_UPSTREAM_IMAGES"
                      ]
                    },
                    {
                      "title": "MongoDB Config",
                      "type": "fieldset",
                      "items": [
                        {
I0228 23:48:18.219946       1 leaderelection.go:199] successfully renewed lease kube-service-catalog/service-catalog-controller-manager
I0228 23:48:20.225271       1 leaderelection.go:199] successfully renewed lease kube-service-catalog/service-catalog-controller-manager
I0228 23:48:22.233711       1 leaderelection.go:199] successfully renewed lease kube-service-catalog/service-catalog-controller-manager
...
    {
      "name": "dh-rocketchat-apb",
      "id": "ba9c2d4db404ce97111bea80225de968",
      "description": "This APB deploys RocketChat backed by MongoDB",
      "bindable": false,
      "metadata": {
        "dependencies": [
          "rocket.chat:latest",
          "mongo:3.2"
        ],
        "displayName": "RocketChat (APB)",
        "documentationUrl": "https://rocket.chat",
        "imageUrl": "https://github.com/RocketChat/Rocket.Chat.Artwork/blob/master/Logos/rocketcat.png?raw=true",
        "longDescription": "An APB that deploys RocketChat to OpenShift backed by MongoDB",
        "providerDisplayName": "Red Hat, Inc."
      },
      "instances_retrievable": true,
      "bindings_retrievable": false,
      "plans": [
        {
          "id": "b2bba601df39d5774c2313bc716981e0",
          "name": "default",
          "description": "This plan deploys a single RocketChat application backed by MongoDB",
          "metadata": {
            "cost": "$0.00",
            "displayName": "Default",
            "longDescription": "This plan provides a RocketChat application backed by MongoDB",
            "schemas": {
              "service_binding": {
                "create": {
                  "openshift_form_definition": []
                }
              },
              "service_instance": {
                "create": {
                  "openshift_form_definition": [
                    "mongodb_user",
                    "mongodb_pass",
                    "mongodb_name",
                    "mongodb_admin_pass",
                    "mongodb_version",
                    "rocketchat_version"
                  ]
                },
                "update": {}
              }
            }
          },
          "free": true,
          "schemas": {
            "service_instance": {
              "create": {
                "parameters": {
                  "$schema": "http://json-schema.org/draft-04/schema",

The broker's response to GetCatalog is being interrupted or truncated somehow.

Ignore non-spec-compliant errors

Currently, we expect error responses to be able to be marshaled into the following:

type failureResponseBody struct {
        Err         *string `json:"error,omitempty"`
        Description *string `json:"description,omitempty"`
}

The spec says we should ignore errors that are not of the expected format. However, responses that match these keys but are not strings but instead nested objects will cause an unmarshaling error, which creates a HTTPStatusCodeError object that looks like the following:

Status: 500; ErrorMessage: <nil>; Description:
      <nil>; ResponseError: json: cannot unmarshal object into Go struct field failureResponseBody.error
      of type string

This error is surfaced to the user when it should be ignored, and is misleading as the error reported here is not from the broker but from the go client.

add documentation for deprecated fields and point to the new location of where that information is now

documentation should be added to the godoc of https://github.com/pmorie/go-open-service-broker-client/blob/0.0.10/v2/types.go#L177-L182 indicating that the fields have been deprecated in OSBAPI. The documentation should recommend and point to https://github.com/openservicebrokerapi/servicebroker/blob/v2.14/profile.md#kubernetes-context-object as containing the canonical version of the information.

Add Support for OSBAPI 2.16

Once the 2.15 support #161 is complete, support for 2.16 has to be added.
Below is a list of items from the relevant release notes:

Feature Current status
Allow Service Brokers to indicate if a Service Instance is still usable after a failed update or deprovisioning and if an update can be repeated WORK REQUIRED
Add support for ETag and If-Modified-Since headers in catalog requests WORK REQUIRED
Service Instances can be labelled with information defined by the Service Broker when provisioned or updated WORK REQUIRED
Specify an expiration timestamp for the binding WORK REQUIRED
Specify Service ID and Plan ID as hints when retrieving a service binding or a service instance WORK REQUIRED
Add guidance of how long the state of an operation SHOULD be remembered N/A
Add guidance to handle 500 errors from Service Instance update N/A
Add guidance to handle requests with invalid data N/A
Specify that Platforms SHOULD NOT reuse IDs N/A
Add CF and K8s annotations to the profile document N/A
Clarify the response code when Platform does not provide the required API version header N/A

DeprovisionResponse & LastOperationRequest support in broker responses as per OSB spec is missing

LastOperationResponse and service broker error response fields should be updated to reflect

The instance_usable response fields should be included in:

  • UpdateInstanceResponse
  • DeprovisionResponse
  • LastOperationResponse

If an update or deprovisioning operation failed, this flag indicates whether or not the Service Instance is still usable. If true, the Service Instance can still be used, false otherwise. This field MUST NOT be present for errors of other operations. Defaults to true.

update_repeatable should be available in all update operations.

If an update operation failed, this flag indicates whether this update can be repeated or not. If true, the same update operation MAY be repeated and MAY succeed; if false, repeating the same update operation will fail again. This field MUST NOT be present for errors of other operations. Defaults to true.

Add a UUID for each request

...that can be set by the client user and sent to the broker in X-Broker-Request-ID (or something like that) header, to allow for tracing requests from platform into broker

Support the Retry-After header in PollLastOperation as per the OSB spec

The response for PollLastOperation MAY also include the Retry-After HTTP header. This header will indicate how long the Platform SHOULD wait before polling again and is intended to prevent unnecessary, and premature, calls to the last_operation endpoint. It is RECOMMENDED that the header include a duration rather than a timestamp.

[enhancement request] add platform recognized CA's

I created a broker and it's SSL Certificate was created by the platform with a platform generated CA. It would be nice if the broker client could automatically add platform CA's to its TLS config so brokers could skip registering the CA when it creates the ClusterServiceBroker resource.

details: OpenShift 3.9, CA is mounted in all pods at /var/run/secrets/kubernetes.io/serviceaccount/service-ca.crt
more at https://docs.openshift.org/latest/dev_guide/secrets.html#service-serving-certificate-secrets

Is this project in use by anyone?

At this time, the kubernetes project is considering archiving this project. It may still be forked and maintained externally, however there does not appear to be enough momentum in project to keep it going.

If you are a user of this project, please chime in on this thread.

ExtensionAPIs is not a currently proposed feature of OSBAPI

Currently ExtensionAPIs is included as a field on ProvisionResponse: https://github.com/kubernetes-sigs/go-open-service-broker-client/blob/a6136cae557aaec67949f38da4fa9a13e4fcadf4/v2/types.go#L228-L233

This corresponds to an old OSBAPI proposal, openservicebrokerapi/servicebroker#431 but this has been closed in favour of openservicebrokerapi/servicebroker#670 which has also yet to be accepted.

I feel like removing the current ExtensionAPIs seems like a reasonable step and that later on the new proposed API could be re-added as an alpha feature.

Add support for OSBAPI 2.14

We'd like to get this client up to date with the current version of the OSBAPI spec (which is currently on 2.15). This is an interim step to add support for 2.14.

Below is a list of the 2.14 release notes. We plan to look at each feature and determine if the feature has already been implemented or if new changes are required.

Feature Current Status
Added Opaque Bearer Tokens to the Platform to Service Broker Authentication section (PR) DONE
Added Content Type guidelines DONE
Added GET endpoints for fetching a Service Binding ALPHA
Added support for asynchronous Service Bindings (PR)and a new last operation endpoint for Service Bindings endpoint ALPHA
Added GET endpoints for fetching a Service Instance ALPHA (#145)
Allow an updated dashboard_url to be provided when updating a Service Instance (PR) ALPHA
Added clarity around concurrent updates (PR) N/A
Added clarity on how Platform's can clean up after a failed provision or bind (PR) N/A
Provided guidance for CLI-friendly names (PR) N/A
Allow for uppercase characters in Service and Service Plan names (PR) N/A
Clarify that extra fields in requests and responses are allowed (PR) N/A
Added an OpenAPI 2.0 implementation N/A
Allow for periods in name fields (PR) N/A
Removed the need for Platforms to perform orphan mitigation when receiving an HTTP 408 response code (PR) N/A
Moved the dashboard_client field to Cloud Foundry Catalog Extensions N/A
Added a compatibility matrix describing which optional features in the specification are supported by different Platforms N/A
Added clarity for returning Service Binding information via the GET endpoints (PR) N/A
Added guidance for supported string lengths (PR) N/A
Clarified that the plan_updateable field affects modifying the Service Plan, not parameters (PR) N/A
Clarified which Service Plan ID to use for polling the last operation endpoint after an update (PR) N/A
Clarified Platform behaviour when a dashboard URL is not returned (PR) N/A
Fixed an incompatible change introduced in v2.12 (PR) N/A
Added clarity around the state of resources after a failure (PR) N/A
  • DONE = Feature is released
  • ALPHA = implemented behind feature flag
  • WORK REQUIRED = not currently implemented - requires work
  • N/A = no changes required to client

In terms of implementation we were thinking to PR in new features as Alpha features, then once we think everything has been implemented we can open a final PR to move the features from Alpha and add Version2_14 to the client.

Does that all sound reasonable?

Thanks
@tedddyking and @Samze

Library should support previous_values in UpdateInstanceRequest

I'm currently using this library to build a component that's talking to on demand service broker. As written in the comment, the library is missing previous_values field in UpdateInstanceRequest here

This is important missing piece for me because the broker I talk to requires previous_values for updating service instance which is according to the spec. Specifically the broker will look for previous_values here which is currently empty since the library is not passing it on.

If you are ok, I can make a PR for this.

cc @frodenas

Prepare repo for releasing v2.x.y

There has been some discussion around releasing a new version of go-open-service-broker-client and what version it should have. The point has been made that in order to be compliant with the import path github.com/kubernetes-sigs/go-open-service-broker-client/v2 that we should release a version that is v2.x.y. However in order to do this in go modules it is usual to indicate this in the module defined in go.mod https://github.com/kubernetes-sigs/go-open-service-broker-client/blob/4406bd2cb6b8ace5644ce50f7d4c790da8e00219/go.mod#L1 by updating it to include a /v2. This would result in the actual import path becoming github.com/kubernetes-sigs/go-open-service-broker-client/v2/v2 (since the libraries are currently in a v2 subdirectory). There are two possible solutions to this:

  1. Move the contents of v2 to the top level and update go.mod to include v2
  2. Make use of the "major version subdirectory strategy", see: https://blog.golang.org/v2-go-modules. This would entail moving go.mod and go.sum into the v2 directory and updating the module name to include /v2 at the end.

Once either of these is done we could cut a new release with v2.x.y.

This repo should have a release strategy

I realized this week that we have never released this repo and are depending on random shas in service-catalog. We should release this repo. There's a question of what the versioning strategy should be.

I'm thinking something like:

  • 2.13 as a base version
  • 2.13.x for fixes

I suspect @kibbles-n-bytes @staebler @MHBauer may have some opinions in this area

OSB HTTP Client does not honor proxy environment variables

We had a use case wherein the Kubernetes Service Catalog had to talk to a OSB server via an HTTP proxy. The go OSB HTTP Client does not seem to honour the HTTP proxy environment variables "http_proxy" and "HTTP_PROXY". In package v2(client.go) of this project, a new HTTP transport is created as "&http.Transport{}", and in there the proxy environment variables are being ignored, as the transport.proxy function is not being set. This is unlike the transport http.DefaultTransport(in go http package), which sets the proxy as "ProxyFromEnvironment". Is this omission a carefully considered one or can this can be considered a bug?

Add support for OSBAPI 2.15

It would be great to get this client up to date with the current version of the OSBAPI spec (which is now on 2.16). This is an interim step to add support for 2.15.

Below is the list of 2.15 release notes, the plan is to categorise them by whether the work has already been done, work is needed or if it is not relevant to this library.

Feature Current Status
Added a delay to polling response for Service Instance and Service Binding last operations. WORK REQUIRED
Added a Service Offering specific async polling timeout. WORK REQUIRED
Allow a Service Instance context to be updated and add org name, space name, and instance names. WORK REQUIRED
Added list of endpoints to create Service Binding response body. WORK REQUIRED
Add plan_updateable field to the Service Plan object. WORK REQUIRED
Added maintenance info support to Service Plans. WORK REQUIRED
Added request identity header. WORK REQUIRED
Allow brokers to not return parameters when returning a Service Instance or Service Binding. N/A
Restrict Operation strings to 10,000 chartacters in the response body for provisioning or deprovisioning a Service Instance, and binding or unbinding a Service Binding. N/A
Remove character restrictions on names of Service Offerings, and Service Plans. N/A
Allow empty descriptions in the response body for getting the last operations of Service Instances, and Service Bindings. N/A
Added mechanism for orphan mitigation. N/A
Allow brokers to return 200 for no-op update Service Instance requests. N/A
Clarify what happens when deleting during a provision/bind request. N/A
Clarify broker behavior expected when deprovisioning while a provision request is in progress and unbinding while an unbind request is in progress. N/A
Clarify broker behavior when a provision request is received during a provision request for the same instance or when a binding request is received during a binding request for the same binding. N/A
  • DONE = Feature is released
  • ALPHA = implemented behind feature flag
  • WORK REQUIRED = not currently implemented - requires work
  • N/A = no changes required to client

For implementation it would probably make sense to follow the same pattern as for 2.14, #144, i.e. PR in features as Alpha features and once it is all implemented a final PR to move them out of Alpha and add Version2_15 to the client.

Hopefully that sounds reasonable?

Custom Transport used with HTTP Client has no timeouts & many bad defaults

This is related to PR #131. Even after 131 was merged in Service Catalog I saw reports that the TCP Connections in ESTABLISHED state continued to climb and result in consuming too many resources. I reproduced and spent a day tracking this down. I finally realized why:

https://github.com/pmorie/go-open-service-broker-client/blob/9cc214e88d00504888af633376c9462e0ab2bd8b/v2/client.go#L41

This is creating a new Transport with bad defaults. In fact, many of them are horrible, ie zero for Timeout, KeepAlive, MaxIdleConnections.... & more

We should pick up the default values as specified in DefaultTransport and make modifications as necessary.

We could hardcode the source for the current defaults from https://github.com/golang/go/blob/b5ed6ec14092b04156adcbaba101958dc9d9d74b/src/net/http/transport.go#L42-L53 but that doesn't set us up well for picking up new versions or fixes. There is this suggestion: golang/go#26013

cannot differentiate http.StatusOK from http.StatusGone(410) in DeprovisionInstance

I'm currently using this library to build a component that's talking to on demand service broker.

In current DeprovisionInstance implementation, we cannot really differentiate http.StatusOK from http.StatusGone: in either case, an empty response and a nil error are returned.

However, we do need this ability to take different actions. Besides, http.StatusGone has a 410 code which is supposed to mean ClientError. So I propose to return an empty response here and a non-nil error(returning a c.handleFailureResponse(response) should be good enough).

What do you think? If you feel ok, I'm happy to make a PR for this.

@pmorie
cc @frodenas

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.