|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// *openshift-docs/applications/connecting_applications_to_services/exposing-binding-data-from-a-service |
| 4 | +[id="sbo-data-model_{context}"] |
| 5 | += Data model |
| 6 | + |
| 7 | +Service binding annotations must use the following convention: |
| 8 | + |
| 9 | +[source,yaml] |
| 10 | +---- |
| 11 | +service.binding(/<NAME>)?: |
| 12 | + "<VALUE>|(path=<JSONPATH_TEMPLATE>(,objectType=<OBJECT_TYPE>)?(,elementType=<ELEMENT_TYPE>)?(,sourceKey=<SOURCE_KEY>)?(,sourceValue=<SOURCE_VALUE>)?)" |
| 13 | +---- |
| 14 | +where: |
| 15 | +[horizontal] |
| 16 | +`<NAME>`:: Specifies the name under which the binding value is to be exposed. You can exclude it only when the `objectType` parameter is set to `Secret` or `ConfigMap`. |
| 17 | +`<VALUE>`:: Specifies the constant value exposed when no `path` is set. |
| 18 | + |
| 19 | +This section explains the data model used in the annotations and OLM descriptors. The data model is the same for custom resource definition (CRD) or custom resource (CR) annotations and Operator Lifecycle Manager (OLM) descriptors, but the syntax differs. |
| 20 | + |
| 21 | +The data model provides the details on the allowed values and semantic for the `path`, `elementType`, `objectType`, `sourceKey`, and `sourceValue` parameters. |
| 22 | + |
| 23 | +.Parameters and their descriptions |
| 24 | +[cols="3,6,4",options="header"] |
| 25 | +|=== |
| 26 | +|Parameter |
| 27 | +|Description |
| 28 | +|Default value |
| 29 | + |
| 30 | +|`path` |
| 31 | +|JSONPath template that consists JSONPath expressions enclosed by curly braces {}. |
| 32 | +|N/A |
| 33 | + |
| 34 | +|`elementType` |
| 35 | +a|Specifies whether the value of the element referenced in the `path` parameter complies with any one of the following types: |
| 36 | + |
| 37 | +* `string` |
| 38 | +* `sliceOfStrings` |
| 39 | +* `sliceOfMaps` |
| 40 | +|`string` |
| 41 | + |
| 42 | +|`objectType` |
| 43 | +|Specifies whether the value of the element indicated in the `path` parameter refers to a `ConfigMap`, `Secret`, or plain string in the current namespace. |
| 44 | +|`Secret`, if `elementType` is non-string. |
| 45 | + |
| 46 | + |
| 47 | +|`sourceKey` |
| 48 | +a|Specifies the key in the `ConfigMap` or `Secret` resource to be added to the binding secret when collecting the binding data. + |
| 49 | + |
| 50 | +Note: |
| 51 | + |
| 52 | +* When used in conjunction with `elementType`=`sliceOfMaps`, the `sourceKey` parameter specifies the key in the slice of maps whose value is used as a key in the binding secret. |
| 53 | +* Use this optional parameter to expose a specific entry in the referenced `Secret` or `ConfigMap` resource as binding data. |
| 54 | +* When not specified, all keys and values from the `Secret` or `ConfigMap` resource are exposed and are added to the binding secret. |
| 55 | +|N/A |
| 56 | + |
| 57 | +|`sourceValue` |
| 58 | +a|Specifies the key in the slice of maps. + |
| 59 | + |
| 60 | +Note: |
| 61 | + |
| 62 | +* The value of this key is used as the base to generate the value of the entry for the key-value pair to be added to the binding secret. |
| 63 | +* In addition, the value of the `sourceKey` is used as the key of the entry for the key-value pair to be added to the binding secret. |
| 64 | +* It is mandatory only if `elementType`=`sliceOfMaps`. |
| 65 | +|N/A |
| 66 | +|=== |
| 67 | + |
| 68 | +[NOTE] |
| 69 | +==== |
| 70 | +The `sourceKey` and `sourceValue` parameters are applicable only if the element indicated in the `path` parameter refers to a `ConfigMap` or `Secret` resource. |
| 71 | +==== |
0 commit comments