You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Globally available brokers are only supported (space-restricted
brokers are currently out of scope)
Introduce the CFServiceBroker custom resource
The CFServiceBroker controller sets its Ready state
Implement POST /v3/service_brokers
Only allow admin users to create brokers
The CFServiceBroker object is created in the root namespace (as it
is globally available)
Implement GET /v3/jobs/service_broker.create~<broker-guid> to return COMPLETE job state once the broker is ready
Validate broker name uniqueness via a validating webhook
Discussion
I would like to take the opportunity of this PR to discuss an alternative way to model Korifi objects.
Currently, we have three types - the k8s object spec, the repository record, the request objects in the API (on e.g. create) and the object being returned from the API (on e.g. get). While those types are quite similar, we need boilerplate code to convert them. For example:
The approach this PR takes to model the new ServiceBroker resource is a bit different. Instead of having so many different types, model the object into multiple small reusable type and aggregate them as necessary. Here are the details:
Introduce a model package where we put small reusable types
The CFResource type is a layer that is needed for API responses - it has all the common API response fields like GUID, createdAt, etc.
The model.services.ServiceBroker type describes a service broker resource and only contains the fields that are specific to the service broker resource only
The korifiv1alhpa1.CFServiceBrokerSpec type embeds model.services.ServiceBroker and adds a k8s-specific field to reference the credentials secret. Note that this reference only makes sense to k8s and is therefore placed in the spec type
Not demonstrated in this PR, but when get service-broker is implemented, the resource object returned by the repository could be presented in a fairly simple manner as the service broker resource already fits the CF API service broker object. It only lacks the links section which could be added by the presenter.
So what do you think about this approach? I think it has its merits though it might look a bit confusing at first. If we agree on it, then we could use it for new resources and experiment with migrating existing ones (hopefully that should be possible in a backwards compatible manner). If not, we could always use the well known pattern.
Does this PR introduce a breaking change?
No
Acceptance Steps
See story
Tag your pair, your PM, and/or team
@cloudfoundry/wg-cf-on-k8s
The text was updated successfully, but these errors were encountered:
Is there a related GitHub Issue?
#3263
What is this change about?
Implement
POST /v3/service_brokers
brokers are currently out of scope)
CFServiceBroker
custom resourceCFServiceBroker
controller sets itsReady
statePOST /v3/service_brokers
CFServiceBroker
object is created in the root namespace (as itis globally available)
GET /v3/jobs/service_broker.create~<broker-guid>
to returnCOMPLETE
job state once the broker is readyDiscussion
I would like to take the opportunity of this PR to discuss an alternative way to model Korifi objects.
Currently, we have three types - the k8s object spec, the repository record, the request objects in the API (on e.g.
create
) and the object being returned from the API (on e.g.get
). While those types are quite similar, we need boilerplate code to convert them. For example:CFApp
payload object describes the CFAppCFApp.Spec
CFApp
object is translated to repository recordThe approach this PR takes to model the new
ServiceBroker
resource is a bit different. Instead of having so many different types, model the object into multiple small reusable type and aggregate them as necessary. Here are the details:model
package where we put small reusable typesCFResource
type is a layer that is needed for API responses - it has all the common API response fields likeGUID
,createdAt
, etc.model.services.ServiceBroker
type describes a service broker resource and only contains the fields that are specific to the service broker resource onlykorifiv1alhpa1.CFServiceBrokerSpec
type embedsmodel.services.ServiceBroker
and adds a k8s-specific field to reference the credentials secret. Note that this reference only makes sense to k8s and is therefore placed in the spec typerepositories.CreateServiceBrokerMessage
) composes the common typesrepositories.ServiceBrokerResource
object which, agains, only composes model typespayloads.ServiceBrokerCreate
composes the model objects in a way to conform to the CF API specificationget service-broker
is implemented, the resource object returned by the repository could be presented in a fairly simple manner as the service broker resource already fits the CF API service broker object. It only lacks the links section which could be added by the presenter.So what do you think about this approach? I think it has its merits though it might look a bit confusing at first. If we agree on it, then we could use it for new resources and experiment with migrating existing ones (hopefully that should be possible in a backwards compatible manner). If not, we could always use the well known pattern.
Does this PR introduce a breaking change?
No
Acceptance Steps
See story
Tag your pair, your PM, and/or team
@cloudfoundry/wg-cf-on-k8s
The text was updated successfully, but these errors were encountered: