Skip to content

Commit

Permalink
Restore .spec.type and .spec.provider
Browse files Browse the repository at this point in the history
While bring back these fields and the general capability, I removed
references that mandated these fields be added to a Secret. Instead, the
requirement is that they are part of the application projection.
Implementors can figure out the best way to make that happen, either by
creating a derivative Secret, or by using a projected volume.

Signed-off-by: Scott Andrews <[email protected]>
  • Loading branch information
scothis committed Jun 3, 2021
1 parent bf6c0c0 commit dbd7105
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,11 @@ rules:

# Application Projection

A Binding `Secret` **MUST** be volume mounted into a container at `$SERVICE_BINDING_ROOT/<binding-name>` with directory names matching the name of the binding. Binding names **MUST** match `[a-z0-9\-\.]{1,253}`. The `$SERVICE_BINDING_ROOT` environment variable **MUST** be declared and can point to any valid file system location.
A projected binding **MUST** be volume mounted into a container at `$SERVICE_BINDING_ROOT/<binding-name>` with directory names matching the name of the binding. Binding names **MUST** match `[a-z0-9\-\.]{1,253}`. The `$SERVICE_BINDING_ROOT` environment variable **MUST** be declared and can point to any valid file system location.

The `Secret` data **MUST** contain a `type` entry with a value that identifies the abstract classification of the binding. The `Secret` type (`.type` verses `.data.type`) **MUST** reflect this value as `service.binding/{type}`, replacing `{type}` with the `Secret` data type. It is **RECOMMENDED** that the `Secret` data also contain a `provider` entry with a value that identifies the provider of the binding. The `Secret` data **MAY** contain any other entry.
The projected binding **MUST** contain a `type` entry with a value that identifies the abstract classification of the binding. It is **RECOMMENDED** that the projected binding also contain a `provider` entry with a value that identifies the provider of the binding. The projected binding data **MAY** contain any other entry.

The name of a secret entry file name **SHOULD** match `[a-z0-9\-\.]{1,253}`. The contents of a secret entry may be anything representable as bytes on the file system including, but not limited to, a literal string value (e.g. `db-password`), a language-specific binary (e.g. a Java `KeyStore` with a private key and X.509 certificate), or an indirect pointer to another system for value resolution (e.g. `vault://production-database/password`).
The name of a binding entry file name **SHOULD** match `[a-z0-9\-\.]{1,253}`. The contents of a binding entry may be anything representable as bytes on the file system including, but not limited to, a literal string value (e.g. `db-password`), a language-specific binary (e.g. a Java `KeyStore` with a private key and X.509 certificate), or an indirect pointer to another system for value resolution (e.g. `vault://production-database/password`).

The collection of files within the directory **MAY** change between container launches. The collection of files within the directory **SHOULD NOT** change during the lifetime of the container.

Expand Down Expand Up @@ -284,6 +284,8 @@ metadata:
...
spec:
name: # string, optional, default: .metadata.name
type: # string, optional
provider: # string, optional
application: # ObjectReference-like
apiVersion: # string
Expand Down Expand Up @@ -414,6 +416,8 @@ If the `$SERVICE_BINDING_ROOT` environment variable has already been configured

The `$SERVICE_BINDING_ROOT` environment variable **MUST NOT** be reset if it is already configured on the resource represented by `application`.

If a `.spec.type` is set, the `type` entry in the application projection **MUST** be set to its value overriding any existing value. If a `.spec.provider` is set, the `provider` entry in the application projection **MUST** be set to its value overriding any existing value.

### Ready Condition Status

If the modification of the Application resource is completed successfully, the `Ready` condition status **MUST** be set to `True`. If the modification of the Application resource is not completed successfully the `Ready` condition status **MUST NOT** be set to `True`.
Expand Down
4 changes: 4 additions & 0 deletions internal/service.binding/v1alpha2/service_binding.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ type EnvMapping struct {
type ServiceBindingSpec struct {
// Name is the name of the service as projected into the application container. Defaults to .metadata.name.
Name string `json:"name,omitempty"`
// Type is the type of the service as projected into the application container
Type string `json:"type,omitempty"`
// Provider is the provider of the service as projected into the application container
Provider string `json:"provider,omitempty"`
// Application is a reference to an object
Application ServiceBindingApplicationReference `json:"application"`
// Service is a reference to an object that fulfills the ProvisionedService duck type
Expand Down
6 changes: 6 additions & 0 deletions service.binding_servicebindings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ spec:
name:
description: Name is the name of the service as projected into the application container. Defaults to .metadata.name.
type: string
provider:
description: Provider is the provider of the service as projected into the application container
type: string
service:
description: Service is a reference to an object that fulfills the ProvisionedService duck type
properties:
Expand All @@ -132,6 +135,9 @@ spec:
- kind
- name
type: object
type:
description: Type is the type of the service as projected into the application container
type: string
required:
- application
- service
Expand Down

0 comments on commit dbd7105

Please sign in to comment.