Skip to content

Commit d65a890

Browse files
authored
Merge pull request #39283 from Srivaralakshmi/ExamplesSBOExposing
Document changes to annotation examples
2 parents 2d7a94b + a17857f commit d65a890

File tree

2 files changed

+61
-30
lines changed

2 files changed

+61
-30
lines changed

modules/sbo-categories-of-exposable-binding-data.adoc

Lines changed: 42 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,27 @@ metadata:
2323
----
2424

2525

26+
== Exposing a constant value as the binding item
27+
The following examples show how to expose a constant value from the `PostgresCluster` custom resource (CR):
28+
29+
.Example: Exposing a constant value
30+
[source,yaml]
31+
----
32+
apiVersion: postgres-operator.crunchydata.com/v1beta1
33+
kind: PostgresCluster
34+
metadata:
35+
name: hippo
36+
namespace: my-postgresql
37+
annotations:
38+
"service.binding/type": "postgresql" <1>
39+
----
40+
<1> Binding `type` to be exposed with the `postgresql` value.
41+
42+
2643
== Exposing an entire config map or secret that is referenced from a resource
27-
The following examples show how to expose an entire secret as annotations:
44+
The following examples show how to expose an entire secret through annotations:
2845

29-
.Example: Exposing an entire secret as annotations
46+
.Example: Exposing an entire secret through annotations
3047
[source,yaml]
3148
----
3249
apiVersion: postgres-operator.crunchydata.com/v1beta1
@@ -50,9 +67,9 @@ data:
5067
user: "Z3Vlc3Q="
5168
----
5269

53-
The following example shows how to expose an entire config map as OLM descriptors:
70+
The following example shows how to expose an entire config map through OLM descriptors:
5471

55-
.Example: Exposing an entire config map as OLM descriptors
72+
.Example: Exposing an entire config map through OLM descriptors
5673
[source,yaml]
5774
----
5875
- path: data.dbConfiguration
@@ -67,9 +84,9 @@ If you intend to project all the values from a `ConfigMap` service resource, you
6784

6885

6986
== Exposing a specific entry from a config map or secret that is referenced from a resource
70-
The following examples show how to expose a specific entry from a config map as annotations:
87+
The following examples show how to expose a specific entry from a config map through annotations:
7188

72-
.Example: Exposing an entry from a config map as annotations
89+
.Example: Exposing an entry from a config map through annotations
7390
[source,yaml]
7491
----
7592
apiVersion: postgres-operator.crunchydata.com/v1beta1
@@ -94,9 +111,9 @@ data:
94111
user: "hippo"
95112
----
96113

97-
The following example shows how to expose a specific entry from a config map as OLM descriptors:
114+
The following example shows how to expose a specific entry from a config map through OLM descriptors:
98115

99-
.Example: Exposing an entry from a config map as OLM descriptors
116+
.Example: Exposing an entry from a config map through OLM descriptors
100117
[source,yaml]
101118
----
102119
- path: data.dbConfiguration
@@ -107,14 +124,14 @@ The following example shows how to expose a specific entry from a config map as
107124

108125
This example uses the `path` attribute with an `X-Descriptors` update for `service.binding` and `sourceKey` by providing the following information:
109126

110-
* Name of the binding key that is to be injected
127+
* Name of the binding key that is to be projected
111128
* Name of the key in the Secret service resource
112129

113130

114131
== Exposing a resource definition value
115-
The following example shows how to expose a resource definition value as annotations:
132+
The following example shows how to expose a resource definition value through annotations:
116133

117-
.Example: Exposing a resource definition value as annotations
134+
.Example: Exposing a resource definition value through annotations
118135
[source,yaml]
119136
----
120137
apiVersion: postgres-operator.crunchydata.com/v1beta1
@@ -127,9 +144,9 @@ metadata:
127144
...
128145
----
129146

130-
The following example shows how to expose a resource definition value as OLM descriptors:
147+
The following example shows how to expose a resource definition value through OLM descriptors:
131148

132-
.Example: Exposing a resource definition value as OLM descriptors
149+
.Example: Exposing a resource definition value through OLM descriptors
133150
[source,yaml]
134151
----
135152
- path: data.connectionURL
@@ -143,9 +160,9 @@ If required values are available as attributes of backing service resources, ann
143160

144161

145162
== Exposing entries of a collection with the key and value from each entry
146-
Following is the example for exposing the entries of a collection with the key and value from each entry as annotations:
163+
The following example shows how to expose the entries of a collection with the key and value from each entry through annotations:
147164

148-
.Example: Exposing the entries of a collection as annotations
165+
.Example: Exposing the entries of a collection through annotations
149166
[source,yaml]
150167
----
151168
apiVersion: postgres-operator.crunchydata.com/v1beta1
@@ -176,9 +193,9 @@ The following example shows how the previous entries of a collection in annotati
176193
/bindings/<binding-name>/uri_404 => black-hole.example.com
177194
----
178195

179-
Following is the example for exposing the entries of a collection with the key and value from each entry as OLM descriptors:
196+
The following example shows how to expose the entries of a collection with the key and value from each entry through OLM descriptors:
180197

181-
.Example: Exposing the entries of a collection as OLM descriptors
198+
.Example: Exposing the entries of a collection through OLM descriptors
182199
[source,yaml]
183200
----
184201
- path: bootstrap
@@ -206,9 +223,9 @@ The previous example helps you to project all those values with keys such as `pr
206223

207224

208225
== Exposing items of a collection with one key per item
209-
Following is the example for exposing the items of a collection with one key per item as annotations:
226+
The following example shows how to expose the items of a collection with one key per item through annotations:
210227

211-
.Example: Exposing the items of a collection as annotations
228+
.Example: Exposing the items of a collection through annotations
212229
[source,yaml]
213230
----
214231
apiVersion: postgres-operator.crunchydata.com/v1beta1
@@ -234,9 +251,9 @@ The following example shows how the previous items of a collection in annotation
234251
/bindings/<binding-name>/tags_2 => power
235252
----
236253

237-
Following is the example for exposing the items of a collection with one key per item as OLM descriptors:
254+
The following example shows how to expose the items of a collection with one key per item through OLM descriptors:
238255

239-
.Example: Exposing the items of a collection as OLM descriptors
256+
.Example: Exposing the items of a collection through OLM descriptors
240257
[source,yaml]
241258
----
242259
- path: spec.tags
@@ -257,9 +274,9 @@ spec:
257274

258275

259276
== Exposing values of collection entries with one key per entry value
260-
Following is the example for exposing the values of collection entries with one key per entry value as annotations:
277+
The following example shows how to expose the values of collection entries with one key per entry value through annotations:
261278

262-
.Example: Exposing the values of collection entries as annotations
279+
.Example: Exposing the values of collection entries through annotations
263280
[source,yaml]
264281
----
265282
apiVersion: postgres-operator.crunchydata.com/v1beta1
@@ -288,9 +305,9 @@ The following example shows how the previous values of a collection in annotatio
288305
/bindings/<binding-name>/url_2 => black-hole.example.com
289306
----
290307

291-
Following is the example for exposing the values of collection entries with one key per entry value as OLM descriptors:
308+
The following example shows how to expose the values of collection entries with one key per entry value through OLM descriptors:
292309

293-
.Example: Exposing the values of collection entries as OLM descriptors
310+
.Example: Exposing the values of collection entries through OLM descriptors
294311
[source,yaml]
295312
----
296313
- path: bootstrap

modules/sbo-methods-of-exposing-binding-data.adoc

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ The service you intend to connect to is compliant with the Service Binding speci
1616
You must expose the binding data from the backing service. Depending on your workload requirements and environment, you can choose any of the following methods to expose the binding data:
1717
+
1818
** Direct secret reference
19-
** Generation of an intermediate secret through custom resource definition (CRD) or CR annotations
20-
** Generation of an intermediate secret through Operator Lifecycle Manager (OLM) descriptors
19+
** Declaring binding data through custom resource definition (CRD) or CR annotations
20+
** Declaring binding data through Operator Lifecycle Manager (OLM) descriptors
2121
** Detection of binding data through owned resources
2222

2323
== Provisioned service
@@ -143,7 +143,7 @@ You can use this method to annotate the resources of the backing service to expo
143143

144144
The following examples show the annotations that are added under the `metadata` section and a referenced `ConfigMap` object from a resource:
145145

146-
.Example: Exposing binding data from a `Secret` object in the `metadata.annotations.dbsecret` custom field
146+
.Example: Exposing binding data from a `Secret` object defined in the CR annotations
147147
[source,yaml]
148148
----
149149
apiVersion: postgres-operator.crunchydata.com/v1beta1
@@ -156,7 +156,21 @@ metadata:
156156
...
157157
----
158158

159-
.Example: Exposing binding data from a `ConfigMap` object in the `metadata.annotations.dbconfig` custom field
159+
The previous example places the name of the secret name in the `{.metadata.name}-pguser-{.metadata.name}` template that resolves to `hippo-pguser-hippo`. The template can contain multiple JSONPath expressions.
160+
161+
.Example: Referenced `Secret` object from a resource
162+
[source,yaml]
163+
----
164+
apiVersion: v1
165+
kind: Secret
166+
metadata:
167+
name: hippo-pguser-hippo
168+
data:
169+
password: "MTBz"
170+
user: "Z3Vlc3Q="
171+
----
172+
173+
.Example: Exposing binding data from a `ConfigMap` object defined in the CR annotations
160174
[source,yaml]
161175
----
162176
apiVersion: postgres-operator.crunchydata.com/v1beta1
@@ -169,7 +183,7 @@ metadata:
169183
...
170184
----
171185

172-
The previous example places the name of the config map in the `metadata.annotations.dbconfig` custom field and specifies to expose a single key from the config map.
186+
The previous example places the name of the config map in the `{.metadata.name}-config` template that resolves to `hippo-config`. The template can contain multiple JSONPath expressions.
173187

174188
.Example: Referenced `ConfigMap` object from a resource
175189
[source,yaml]

0 commit comments

Comments
 (0)