This repository has been archived by the owner on May 6, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 382
Introduce spec.free
to catalog restrictions for Plans
#2211
Merged
k8s-ci-robot
merged 7 commits into
kubernetes-retired:master
from
jeremyrickard:catalog-restrictions-free-plans
Jul 19, 2018
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
c203b12
Adds ability to filter by [Cluster]ServicePlan.spec.free
jeremyrickard 1ec55e2
Adding catalog restriction docs
jeremyrickard 3ff0dbd
Fix html formatting
jeremyrickard 7e92cc1
Review comments
jeremyrickard 20092e5
Trying relative paths
jeremyrickard 455e675
Review comments from Jay
jeremyrickard 79b7e9d
linking to namespaced docs
jeremyrickard File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,194 @@ | ||
--- | ||
title: Filtering Broker Catalogs | ||
layout: docwithnav | ||
--- | ||
|
||
# Catalog Restrictions | ||
|
||
Services provided by service brokers are represented in Kubernetes by two | ||
different [resources](resources.md), service classes and service plans. When a | ||
`ClusterServiceBroker` or `ServiceBroker` resource is created, the Service | ||
Catalog will query the Service Broker for the list of available Services. | ||
Service Catalog will then create `ClusterServiceClass` or `ServiceClass` | ||
resources to represent the service classes and `ClusterServicePlan` or | ||
`ServicePlan` resources to represent service plans. By default, Service Catalog | ||
will create a `ClusterServiceClass` or `ServiceClass` for each service class | ||
and a `ClusterServicePlan` or `ServicePlan` for each service plan | ||
provided by the service broker. When creating a `ClusterServiceBroker` or | ||
`ServiceBroker` resource, you can change this behavior by specifying one or | ||
more catalog restrictions. Catalog restrictions act in a manner similar to | ||
Kubernetes label selectors to enable you to control how service classes and | ||
service plans should be exposed from the service brokers. | ||
|
||
## Using Catalog Restrictions | ||
|
||
Catalog restrictions are specified in `ClusterServiceBroker` or `ServiceBroker` | ||
resources. A sample YAML might look like: | ||
|
||
```yaml | ||
apiVersion: servicecatalog.k8s.io/v1beta1 | ||
kind: ClusterServiceBroker | ||
metadata: | ||
name: sample-broker | ||
spec: | ||
authInfo: | ||
basic: | ||
secretRef: | ||
name: sample-broker-auth | ||
namespace: brokers | ||
catalogRestrictions: | ||
servicePlan: | ||
- "spec.externalName==basic" | ||
url: http://sample-broker.brokers.svc.cluster.local | ||
``` | ||
|
||
In this example, a catalog restriction has been defined that specifies that | ||
only service plans that have an external name of basic should be selected. | ||
Catalog restrictions are defined as a set of one or more rules that target | ||
service classes and/or service plans. These rules have a special format | ||
similar to Kubernetes label selectors. | ||
|
||
The rule format is expected to be `<property><conditional><requirement>` | ||
|
||
* `<property>` is one of the supported properties of a service class or service plan resource, described below | ||
* `<conditional>` is allowed to be one of the following: `==`, `!=`, `in`, `notin` | ||
* `<requirement>` will be a string value if `==` or `!=` are used, otherwise it will be a set of string values if `in` or `notin` are used | ||
* `<requirement>` is case sensitive | ||
|
||
Catalog restrictions, while similar to label selectors, only operate on a | ||
subset of properties on service class and service plan resources. The following | ||
sections detail what properties can be used to define catalog restrictions for | ||
each resource type. | ||
|
||
`ClusterServiceClass` allowed property names: | ||
|
||
| Property Key | Description | | ||
| name | This key will match the ClusterServiceClass.Name property | | ||
| spec.externalName | This key will match the ClusterServiceClass.Spec.ExternalName property | | ||
| spec.externalID | This key will match the ClusterServiceClass.Spec.ExternalID property | | ||
|
||
`ServiceClass` allowed property names: | ||
|
||
| Property Key | Description | | ||
| name | This key will match the ServiceClass.Name | | ||
| spec.externalName | This key will match the ServiceClass.Spec.ExternalName property | | ||
| spec.externalID | This key will match the ServiceClass.Spec.ExternalID property | | ||
|
||
`ClusterServicePlan` allowed property names: | ||
|
||
| Property Key | Description | | ||
| name | This key will match the ClusterServicePlan.Name | | ||
| spec.externalName | This key will match the ClusterServicePlan.Spec.ExternalName property | | ||
| spec.externalID | This key will match the ClusterServicePlan.Spec.ExternalID property | | ||
| spec.free | This key will match the ClusterServicePlan.Spec.Free property | | ||
| spec.clusterServiceClass.name | This key will match the ClusterServicePlan.Spec.ClusterServiceClassRef.Name property | | ||
|
||
`ServicePlan` allowed property names: | ||
|
||
| Property Key | Description | | ||
| name | This key will match the ServicePlan.Name property | | ||
| spec.externalName | This key will match the ServicePlan.Spec.ExternalName property | | ||
| spec.externalID | This key will match the ServicePlan.Spec.ExternalID property | | ||
| spec.free | This key will match the ServicePlan.Spec.Free property | | ||
| spec.serviceClass.name | This key will match the ServicePlan.Spec.ServiceClassRef.Name property | | ||
|
||
## Examples | ||
|
||
The following examples show some possible ways to apply catalog restrictions. | ||
|
||
### Allow Only Service Class Resources with Specific External Name | ||
|
||
This example creates a Service Class restriction on spec.externalName using the | ||
`in` operator. In this case, only services that have the externalName | ||
`FooService` or `BarService` will have Service Catalog resources created. | ||
The YAML for this would look like: | ||
|
||
```yaml | ||
apiVersion: servicecatalog.k8s.io/v1beta1 | ||
kind: ClusterServiceBroker | ||
metadata: | ||
name: sample-broker | ||
spec: | ||
authInfo: | ||
basic: | ||
secretRef: | ||
name: sample-broker-auth | ||
namespace: brokers | ||
catalogRestrictions: | ||
serviceClass: | ||
- "spec.externalName in (FooService, BarService)" | ||
url: http://sample-broker.brokers.svc.cluster.local | ||
``` | ||
|
||
### Allow All Service Class Resources Except Those with Specific External Name | ||
|
||
To allow all services, except those named `FooService` or `BarService`, | ||
the `notin` operator can be used. The YAML for this would look like: | ||
above. | ||
|
||
```yaml | ||
apiVersion: servicecatalog.k8s.io/v1beta1 | ||
kind: ClusterServiceBroker | ||
metadata: | ||
name: sample-broker | ||
spec: | ||
authInfo: | ||
basic: | ||
secretRef: | ||
name: sample-broker-auth | ||
namespace: brokers | ||
catalogRestrictions: | ||
serviceClass: | ||
- "spec.externalName notin (FooService, BarService)" | ||
url: http://sample-broker.brokers.svc.cluster.local | ||
``` | ||
|
||
### Using Multiple Predicates | ||
|
||
As mentioned above, you can chain rules together. For example, | ||
to restrict service plans to only those free plans with an externalName of | ||
`Demo`, the YAML would look like: | ||
|
||
```yaml | ||
apiVersion: servicecatalog.k8s.io/v1beta1 | ||
kind: ClusterServiceBroker | ||
metadata: | ||
name: sample-broker | ||
spec: | ||
authInfo: | ||
basic: | ||
secretRef: | ||
name: sample-broker-auth | ||
namespace: brokers | ||
catalogRestrictions: | ||
servicePlan: | ||
- "spec.externalName in (Demo)" | ||
- "spec.free=true" | ||
url: http://sample-broker.brokers.svc.cluster.local | ||
``` | ||
|
||
### Combining Service Class and Service Plan Catalog Restrictions | ||
|
||
You can also combine restrictions on classes and plans. An example that | ||
allow all free plans with the externalName `Demo`, and not a specific service | ||
named `AABBB-CCDD-EEGG-HIJK`, you would create a YAML like: | ||
|
||
```yaml | ||
apiVersion: servicecatalog.k8s.io/v1beta1 | ||
kind: ClusterServiceBroker | ||
metadata: | ||
name: sample-broker | ||
spec: | ||
authInfo: | ||
basic: | ||
secretRef: | ||
name: sample-broker-auth | ||
namespace: brokers | ||
catalogRestrictions: | ||
serviceClass: | ||
- "name!=AABBB-CCDD-EEGG-HIJK" | ||
servicePlan: | ||
- "spec.externalName in (Demo)" | ||
- "spec.free=true" | ||
url: http://sample-broker.brokers.svc.cluster.local | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
bigheader: "Catalog Restrictions" | ||
abstract: "Using Catalog Restrictions to control Service Class and Plan access." | ||
landing_page: /docs/catalog-restrictions/ | ||
toc: | ||
- docs/catalog-restrictions.md | ||
- title: Catalog Restrictions | ||
path: "#catalog-restrictions" | ||
- title: Using Catalog Restrictions | ||
path: "#using-catalog-restrictions" | ||
- title: Examples | ||
path: "#examples" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the property key and descriptions are the same for the NS and Cluster scoped Plan/Class, I'd suggest combining them. IE "
ClusterServicePlan
andServicePlan
allowed property names"Same with the Classes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are almost the same. There are some shared keys, but we also allow to supplies predicates that reference the non-common parts, i.e. ServicePlans can be filtered with ServiceClassRef.Name and ClusterServicePlans can be filtered with ClusterServiceClassRef.Name.
Would you favor doing a shared block and then call out the two differences?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jeremyrickard I missed that. I totally agree, leave it as is, thank you.