1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-06 06:46:26 +01:00
Files
openshift-docs/modules/sbo-setting-annotations-mapping-optional.adoc
Srivaralakshmi 88d7582d02 Document Optional annotation feature
Fixing SME review comments

Fixing QE review comments

Fixing peer review comments

updates to add Anchoring IDs in module files and for Additional resources titles in assembly
2022-09-22 07:37:05 +00:00

34 lines
1.6 KiB
Plaintext

// Module included in the following assemblies:
//
// * applications/connecting_applications_to_services/exposing-binding-data-from-a-service.adoc
:_content-type: PROCEDURE
[id="sbo-setting-annotations-mapping-optional_{context}"]
= Setting annotations mapping to be optional
You can have optional fields in the annotations. For example, a path to the credentials might not be present if the service endpoint does not require authentication. In such cases, a field might not exist in the target path of the annotations. As a result, {servicebinding-title} generates an error, by default.
As a service provider, to indicate whether you require annotations mapping, you can set a value for the `optional` flag in your annotations when enabling services. {servicebinding-title} provides annotations mapping only if the target path is available. When the target path is not available, the {servicebinding-title} skips the optional mapping and continues with the projection of the existing mappings without throwing any errors.
.Procedure
* To make a field in the annotations optional, set the `optional` flag value to `true`:
+
.Example
[source,yaml]
----
apiVersion: apps.example.org/v1beta1
kind: Database
metadata:
name: my-db
namespace: my-petclinic
annotations:
service.binding/username: path={.spec.name},optional=true
...
----
[NOTE]
====
* If you set the `optional` flag value to `false` and the {servicebinding-title} is unable to find the target path, the Operator fails the annotations mapping.
* If the `optional` flag has no value set, the {servicebinding-title} considers the value as `false` by default and fails the annotations mapping.
====