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
Copy file name to clipboardExpand all lines: docs/design.md
+47-78
Original file line number
Diff line number
Diff line change
@@ -96,20 +96,13 @@ and therefore a separate persistent storage (from Kubernetes) is not needed.
96
96
storage. The plan is to add support for CRDs to the `rest.storage` interface
97
97
of the API Server in the near future.*
98
98
99
-
The Service Catalog resource model is defined within a file called
100
-
`pkg/apis/servicecatalog/types.go` and the initial (current) version
101
-
of the model is in `pkg/apis/servicecatalog/v1alpha1/`. As of now there is
102
-
only one version of the model but over time additional versions will be
103
-
created and each will have its own sub-directory under
104
-
`pkg/apis/servicecatalog/`.
99
+
The Service Catalog API resources are defined within a file called
100
+
`pkg/apis/servicecatalog/types.go` and the version
101
+
of the api is in `pkg/apis/servicecatalog/v1beta1/`.
105
102
106
-
**TODO** add a brief discussion of how resources are created and we'll
107
-
use the Status section to know when its fully realized. Instead of the
108
-
"claim" model that is used by other parts of Kube.
109
-
110
-
The Controller is the brains of the Service Catalog. It monitors the
111
-
resource model (via watches on the API server), and takes the appropriate
112
-
actions based on the changes it detects.
103
+
The controller implements the behaviors of the service-catalog API. It monitors the
104
+
API resources (by watching the API server), and takes the appropriate
105
+
actions based on the user's desired intent.
113
106
114
107
To understand the Service Catalog resource model, it is best to walk through
115
108
a typical workflow:
@@ -123,41 +116,51 @@ can be in different NS's than the rest (which must all be in the same).
123
116
Before a Service can be used by an Application it must first be registered
124
117
with the Kubernetes platform. Since Services are managed by Service Brokers
125
118
we must first register the Service Broker by creating an instance of a
126
-
`ServiceBroker`:
119
+
`ClusterServiceBroker`:
127
120
128
121
kubectl create -f broker.yaml
129
122
130
123
where `broker.yaml` might look like:
131
124
132
-
apiVersion: servicecatalog.k8s.io/v1alpha1
133
-
kind: ServiceBroker
125
+
apiVersion: servicecatalog.k8s.io/v1beta1
126
+
kind: ClusterServiceBroker
134
127
metadata:
135
-
name: BestDataBase
128
+
name: best-db-broker
136
129
spec:
137
130
url: http://bestdatabase.com
138
131
139
-
**TODO** beef-up theses sample resource snippets
132
+
**Note:** As the name implies, the `ClusterServiceBroker` resource is cluster-scoped, ie,
133
+
outside of any namespace.
134
+
135
+
**TODO** beef-up these sample resource snippets
140
136
141
-
After a `ServiceBroker` resource is created the Service Catalog Controller will
137
+
After a `ClusterServiceBroker` resource is created the Service Catalog Controller will
142
138
receive an event indicating its addition to the datastore. The Controller
143
139
will then query the Service Broker (at the `url` specified) for the list
144
140
of available Services. Each Service will then have a corresponding
145
-
`ServiceClass` resource created:
141
+
`ClusterServiceClass` resource created:
146
142
147
-
apiVersion: servicecatalog.k8s.io/v1alpha1
148
-
kind: ServiceClass
143
+
apiVersion: servicecatalog.k8s.io/v1beta1
144
+
kind: ClusterServiceClass
149
145
metadata:
150
146
name: smallDB
151
-
brokerName: BestDataBase
152
-
plans...
147
+
spec:
148
+
bindable: true
149
+
clusterServiceBrokerName: ups-broker
150
+
description: A user provided service
151
+
externalID: 4f6e6cf6-ffdd-425f-a2c7-3c9258ad2468
152
+
externalName: user-provided-service
153
+
planUpdatable: false
154
+
155
+
Each Service has one or more Plans associated with it.
153
156
154
-
Notice that each Service can have one or more Plans associated with it.
157
+
For each plan of each service, a `ClusterServicePlan` will be created.
155
158
156
159
**TODO** Anything special about the CF flows we need to discuss?
157
160
158
161
Users can then query for the list of available Services:
159
162
160
-
kubectl get services
163
+
kubectl get clusterserviceclasses
161
164
162
165
### Creating a Service Instance
163
166
@@ -168,18 +171,20 @@ done by creating a new `ServiceInstance` resource:
168
171
169
172
where `instance.yaml` might look like:
170
173
171
-
apiVersion: servicecatalog.k8s.io/v1alpha1
174
+
apiVersion: servicecatalog.k8s.io/v1beta1
172
175
kind: ServiceInstance
173
176
metadata:
174
-
name: johnsDB
177
+
namespace: example-ns
178
+
name: test-database
175
179
spec:
176
-
serviceClassName: smallDB
180
+
clusterServiceClassExternalName: small-db
181
+
clusterServicePlanExternalName: free
177
182
178
183
Within the `ServiceInstance` resource is the specified Plan to be used. This allows
179
184
for the user of the Service to indicate which variant of the Service they
180
185
want - perhaps based on QoS type of variants.
181
186
182
-
When creating a ServiceInstance, extra metadata (called "parameters") can be
187
+
When creating a `ServiceInstance`, extra metadata (called "parameters") can be
183
188
passed in to help configure the new Service being provisioned. Parameters
184
189
can be provided two different ways: raw JSON or referencing a Kubernetes
185
190
Secret. In the case of a Secret, the Secret name and key holding the
@@ -197,6 +202,8 @@ ServiceInstanceSpec resource that would cause a reconciliation to occur.
197
202
Within the ServiceInstanceSpec is a property called `UpdateRequests` which
198
203
can be incremented to cause this to happen.
199
204
205
+
For more information, see the documentation on [parameters](parameters.md).
206
+
200
207
**TODO** Discuss the parameters that can be passed in
201
208
202
209
Once an `ServiceInstance` resource is created, the Controller talks with the
@@ -240,13 +247,15 @@ Service Instance must be established. This is done by creating a new
240
247
241
248
where `instance.yaml` might look like:
242
249
243
-
apiVersion: servicecatalog.k8s.io/v1alpha1
250
+
apiVersion: servicecatalog.k8s.io/v1beta1
244
251
kind: ServiceBinding
245
252
metadata:
246
-
name: johnsServiceBinding
253
+
namespace: example-ns
254
+
name: test-database-binding
247
255
spec:
248
-
secretName: johnSecret
249
-
...Pod selector labels...
256
+
instanceRef:
257
+
name: test-database
258
+
secretName: db-secret
250
259
251
260
The Controller, upon being notified of the new `ServiceBinding` resource, will
252
261
then talk to the Service Broker to create a new ServiceBinding for the specified
@@ -267,50 +276,13 @@ by reading the documentation of the Service.
267
276
The Credentials will not be stored in the Service Catalog's datastore.
268
277
Rather, they will be stored in the Kubenetes core as Secrets and a reference
269
278
to the Secret will be saved within the `ServiceBinding` resource. If the
270
-
ServiceBinding `Spec.SecretName` is not specified then the Controller will
271
-
use the ServiceBinding `Name` property as the name of the Secret.
279
+
ServiceBinding `spec.secretName` is not specified then the Controller will
280
+
use the ServiceBinding `metadata.name` property as the name of the Secret.
272
281
273
282
ServiceBindings are not required to be in the same Kubenetes Namespace
274
283
as the Service Instance. This allows for sharing of Service Instances
275
284
across Applications and Namespaces.
276
285
277
-
In addition to the Secret, the Controller will also create a Pod Injection
278
-
Policy (PIP) resource in the Kubernetes core. See the
279
-
[PIP Proposal](https://github.com/kubernetes/community/pull/254) for more
280
-
information, but in short, the PIP defines how to modify the specification
281
-
of a Pod during its creation to include additional volumes and environment
282
-
variables.
283
-
In particular, Service Catalog will use PIPs to allow the Application
284
-
owner to indicate how the Secret should be made available to its Pods. For
285
-
example, they may define a PIP to indicate that the Secret should be mounted
286
-
into its Pods. Or perhaps the Secret's names/values should be exposed as
287
-
environment variables.
288
-
289
-
PIPs will use label selectors to indicate which Pods will be modified.
290
-
For example:
291
-
292
-
kind: PodInjectionPolicy
293
-
apiVersion: extensions/v1alpha1
294
-
metadata:
295
-
name: allow-database
296
-
namespace: myns
297
-
spec:
298
-
selector:
299
-
matchLabels:
300
-
role: frontend
301
-
env:
302
-
- name: DB_PORT
303
-
value: 6379
304
-
305
-
defines a PIP that will add an environment variable called `DB_PORT` with
306
-
a value of `6379` to all Pods that have a label of `role` with a value
307
-
of `frontend`.
308
-
309
-
Eventually, the OSB API specification will hopefully have additional metadata
310
-
about the Credentials to indicate which fields are considered "secret" and
311
-
which are not. When that support is available expect the non-secret Credential
312
-
information to be placed into a ConfigMap instead of a Secret.
313
-
314
286
Once the Secret is made available to the Application's Pods, it is then up
315
287
to the Application code to use that information to talk to the Service
316
288
ServiceInstance.
@@ -321,12 +293,9 @@ As with all resources in Kubernetes, you can delete any of the Service
321
293
Catalog resource by doing an HTTP DELETE to the resource's URL. However,
322
294
it is important to note the you can not delete a Service Instance while
323
295
there are ServiceBindings associated with it. In other words, before a Service
324
-
ServiceInstance can be delete, you must first delete all of its ServiceBindings.
325
-
Attempting to delete an ServiceInstance that still has a ServiceBinding will fail
326
-
and generate an error.
296
+
ServiceInstance can be deleted, you must first delete all of its ServiceBindings.
327
297
328
-
Deleting a ServiceBinding will also, automatically, delete any Secrets or ConfigMaps
329
-
that might be associated with it.
298
+
Deleting a `ServiceBinding` indicates a user's intent to unbind. The service-catalog controller handles deleting any Secrets associated with a binding.
0 commit comments