spring-cloud / spring-cloud-app-broker

Spring Cloud project for implementing service brokers that conform to the Open Server Broker API specification
http://projects.spring.io/spring-cloud/
Apache License 2.0
26 stars 39 forks source link

Support service instances provisionned by K8S svcat (idempotent dups calls) #337

Open gberche-orange opened 4 years ago

gberche-orange commented 4 years ago

https://github.com/openservicebrokerapi/servicebroker/blob/master/spec.md#provisioning

PUT /v2/service_instances/:instance_id Response

Status Code Description
200 OK SHOULD be returned if the Service Instance already exists, is fully provisioned, and the requested parameters are identical to the existing Service Instance. The expected response body is below.
201 Created MUST be returned if the Service Instance was provisioned as a result of this request. The expected response body is below.
202 Accepted MUST be returned if the Service Instance provisioning is in progress. The operation string MUST match that returned for the original request. This triggers the Platform to poll the Last Operation for Service Instances endpoint for operation status. Note that a re-sent PUT request MUST return a 202 Accepted, not a 200 OK, if the Service Instance is not yet fully provisioned.
400 Bad Request MUST be returned if the request is malformed or missing mandatory data. MAY be returned if the request contains invalid data, in which case the error response MAY include a helpful error message in the description field (see Service Broker Errors).
409 Conflict MUST be returned if a Service Instance with the same id already exists or is being provisioned but with different attributes.

See https://github.com/kubernetes-sigs/service-catalog/issues/1639 and case reproduced in OpenShift v3.9.51 ( Kubernetes v1.9.1+a0ce1bc657 )

Currently, duplicate provisionning calls leads to duplicate backend services, or depending on the configuration on errors from Cf reporting already existing app/service instance names

Same issue exist for deprovisionning and likely updates.

See https://github.com/orange-cloudfoundry/osb-cmdb-spike/issues/17 and https://github.com/orange-cloudfoundry/osb-cmdb-spike/issues/17#issuecomment-589705368 for considered fix using the service instance repository

royclarkson commented 4 years ago

@gberche-orange thanks. good catch! I have an unrelated request. Mind if we don't use the acronym SCAB? It's our fault for naming the project that way, but that word has negative connotations in English. :-D Maybe let's just say "app broker"?

gberche-orange commented 4 years ago

@royclarkson

Mind if we don't use the acronym SCAB?

Sure, I fixed that in the issue body, sorry I did not realize this semantic overriding

royclarkson commented 4 years ago

Thanks! much appreciated. No need to apologize. It just reads better for others coming to the project.