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
This change adds an extension specification for a cluster-wide mapping
of non-Podspec-able resource types acting as applications.
Signed-off-by: Ben Hale <[email protected]>
@@ -201,7 +206,6 @@ The Service Binding resource **MAY** define `.spec.application.containers`, as a
201
206
- if the value is a string (`${containerString}`), a container or init container matching by name (`.spec.template.spec.containers[?(@.name=='${containerString}')]` or `.spec.template.spec.initContainers[?(@.name=='${containerString}')]`) **MUST** be bound
202
207
- values that do not match a container or init container **SHOULD** be ignored
203
208
204
-
205
209
A Service Binding Resource **MAY** define a `.spec.mappings` which is an array of `Mapping` objects. A `Mapping` object **MUST** define `name` and `value` entries. The `value` of a `Mapping` **MUST** be handled as a [Go Template][gt] exposing binding `Secret` keys for substitution. The executed output of the template **MUST** be added to the `Secret` exposed to the resource represented by `application` as the key specified by the `name` of the `Mapping`. If the `name` of a `Mapping` matches that of a Provisioned Service `Secret` key, the value from `Mapping` **MUST** be used for binding.
206
210
207
211
A Service Binding Resource **MAY** define a `.spec.env` which is an array of `EnvMapping`. An `EnvMapping` object **MUST** define `name` and `key` entries. The `key` of an `EnvMapping` **MUST** refer to a binding `Secret` key name including any key defined by a `Mapping`. The value of this `Secret` entry **MUST** be configured as an environment variable on the resource represented by `application`.
@@ -434,6 +438,98 @@ status:
434
438
435
439
Extensions are optional additions to the core specification as defined above. Implementation and support of these specifications are not required in order for a platform to be considered compliant. However, if the features addressed by these specifications are supported a platform **MUST** be in compliance with the specification that governs that feature.
436
440
441
+
## Application Resource Mapping
442
+
443
+
There are scenarios where an application resource is not strictly PodSpec-able but does include the `env`, `volumeMounts`, and `volumes` elements that are required to project a service binding. This extension defines a mapping of those elements onto any type. It **MUST** be codified as a concrete resource type with API version `service.binding/v1alpha2` and kind `ClusterApplicationResourceMapping`. An exemplar CRD can be found [here][cam-crd].
444
+
445
+
An Application Resource Mapping **MUST** define its name using [CRD syntax][crd-syntax] (`<plural>.<group>`) for the resource that it defines a mapping for. An Application Resource Mapping **MUST** define a `spec.versions` which is an array of `Version` objects. A `Version` object must define a `version` entry that represents a version of the mapped resource. A `Version` object **MAY** define `.containers`, as an array of strings containing [JSONPath][jsonpath], that describes the location of [`Container`][container] entries in the target resource. A `Version` object **MAY** define `.envs`, as an array of strings containing [JSONPath][jsonpath], that describes the location of [`EnvVar`][envvar] entries in the target resource. A `Version` object **MAY** define `.volumeMounts`, as an array of strings containing [JSONPath][jsonpath], that describes the location of [`VolumeMount`][volumemount] entries in the target resource. A `Version` object **MUST** define `.volumes`, as a string containing [JSONPath][jsonpath], that describes the location of [`Volume`][volume] entries in the target resource.
446
+
447
+
If an Application Resource Mapping defines `containers`, it **MUST NOT** define `envs` and `volumeMounts`. If an Application resources does not define `containers`, it **MUST** define `envs` and `volumeMounts`.
A reconciler implementation that supports `ClusterApplicationResourceMapping`s **MUST** support `ServiceBinding` resources that refer to applications that are not PodSpec-able. If no Application Resource Mapping exists for the `ServiceBinding` application resource type, the reconciliation **MUST** fail.
526
+
527
+
If a `ClusterApplicationResourceMapping` defines `containers`, the reconciler **MUST** first resolve a set of candidate locations in the application resource addressed by the `ServiceBinding` using the `Container` type (`.env`, `.volumeMounts`) for all available containers and then filter that collection by the `ServiceBinding` `.spec.application.containers` filter before applying the appropriate modification.
528
+
529
+
If a `ClusterApplicationResourceMapping` defines `env` and `volumeMounts`, the reconciler **MUST** first resolve a set of candidate locations in the application resource addressed by the `ServiceBinding` for all available containers and then filter that collection by the `ServiceBinding` `.spec.application.containers` filter before applying the appropriate modification.
530
+
531
+
A reconciler **MUST** apply the appropriate modification to the application resource addressed by the `ServiceBinding` as defined by `volumes`.
532
+
437
533
## Custom Projection
438
534
439
535
There are scenarios where the Reconciler that processes a `ServiceBinding` (hereinafter referred to as "Reconciler A") is different than the Reconciler that will project the binding into the Application (hereinafter referred to as "Reconciler B"). To transfer the projection responsibility from Reconciler A to Reconciler B the `ServiceBinding` author **MUST** set the `projection.service.binding/type` annotation to `Custom`. An exemplar CRD can be found [here][sbp-crd].
description: ClusterApplicationResourceMapping is the Schema for the clusterapplicationresourcemappings
27
+
API
28
+
properties:
29
+
apiVersion:
30
+
description: 'APIVersion defines the versioned schema of this representation
31
+
of an object. Servers should convert recognized schemas to the latest
32
+
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
33
+
type: string
34
+
kind:
35
+
description: 'Kind is a string value representing the REST resource this
36
+
object represents. Servers may infer this from the endpoint the client
37
+
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
38
+
type: string
39
+
metadata:
40
+
type: object
41
+
spec:
42
+
description: ClusterApplicationResourceMappingSpec defines the desired
43
+
state of ClusterApplicationResourceMapping
44
+
properties:
45
+
versions:
46
+
description: Versions is the collection of versions for a given resource,
47
+
with mappings.
48
+
items:
49
+
description: ClusterApplicationResourceMappingVersion defines the
50
+
mapping for a specific version of an application resource.
51
+
properties:
52
+
containers:
53
+
description: Containers is the collection of JSONPaths that
54
+
container configuration may be written to.
55
+
items:
56
+
type: string
57
+
type: array
58
+
envs:
59
+
description: Envs is the collection of JSONPaths that env configuration
60
+
may be written to.
61
+
items:
62
+
type: string
63
+
type: array
64
+
version:
65
+
description: Version is the version of the application resource
66
+
that this mapping is for.
67
+
type: string
68
+
volumeMounts:
69
+
description: VolumeMounts is the collection of JSONPaths that
70
+
volume mount configuration may be written to.
71
+
items:
72
+
type: string
73
+
type: array
74
+
volumes:
75
+
description: Volumes is the JSONPath that volume configuration
0 commit comments