Skip to content

Commit 2e57ab0

Browse files
authored
Merge pull request #40086 from Srivaralakshmi/SBO_RBAC
Document RBAC requirements and fix section title levels
2 parents bb2f1fb + 749252b commit 2e57ab0

File tree

4 files changed

+46
-5
lines changed

4 files changed

+46
-5
lines changed

applications/connecting_applications_to_services/exposing-binding-data-from-a-service.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ The {servicebinding-title} enables application developers to easily bind workloa
1212

1313
include::modules/sbo-methods-of-exposing-binding-data.adoc[leveloffset=+1]
1414
include::modules/sbo-data-model.adoc[leveloffset=+1]
15+
include::modules/sbo-rbac-requirements.adoc[leveloffset=+1]
1516
include::modules/sbo-categories-of-exposable-binding-data.adoc[leveloffset=+1]
1617

1718
== Additional resources

modules/sbo-advanced-binding-options.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
Advanced binding options are available only for the `binding.operators.coreos.com` API group.
99

10-
=== Changing the binding names before projecting into the workload
11-
You can specify the rules to change the binding names in the .spec.namingStrategy attribute of the `ServiceBinding` custom resource (CR). For example, consider a Spring PetClinic sample application that connects to the PostgreSQL database. In this case, the host and port fields of the database are exposed by the the PostgreSQL database service to use for binding. The Spring PetClinic sample application can access this exposed binding data through the binding names.
10+
== Changing the binding names before projecting them into the workload
11+
You can specify the rules to change the binding names in the .spec.namingStrategy attribute of the `ServiceBinding` custom resource (CR). For example, consider a Spring PetClinic sample application that connects to the PostgreSQL database. In this case, the PostgreSQL database service exposes the host and port fields of the database to use for binding. The Spring PetClinic sample application can access this exposed binding data through the binding names.
1212

1313
.Example: Spring PetClinic sample application in the `ServiceBinding` CR
1414
[source,yaml]
@@ -63,7 +63,7 @@ The following items describe the expressions defined in the `POSTGRESQL_{{ .serv
6363

6464
Similar to the previous example, you can define the string templates in `namingStrategy` to define how each key of the binding names should be prepared by the service binding request.
6565

66-
=== Composing custom binding data
66+
== Composing custom binding data
6767
As an application developer, you can compose custom binding data under the following circumstances:
6868

6969
* The backing service does not expose binding data.

modules/sbo-binding-workloads-that-are-not-compliant-with-PodSpec.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ For such secondary workload resources, the location of the container path is arb
1111

1212
{servicebinding-title} provides an option to configure the value of where the container path or secret path is and bind these paths at a custom location. This option is available only for the `binding.operators.coreos.com` API group when the binding data is projected as environment variables.
1313

14-
=== Configuring the custom location of the container path
14+
== Configuring the custom location of the container path
1515
Consider a secondary workload CR, which is not compliant with the PodSpec and has containers located at the `spec.containers` path:
1616

1717
.Example: Secondary workload CR
@@ -95,7 +95,7 @@ spec:
9595
<1> Unique array of containers with values generated by the {servicebinding-title}. These values are based on the backing service CR.
9696
<2> Name of the `Secret` resource generated by the {servicebinding-title}.
9797

98-
=== Configuring the custom location of the secret path
98+
== Configuring the custom location of the secret path
9999
Consider a secondary workload CR, which is not compliant with the PodSpec, with only the secret at the `spec.secret` path:
100100

101101
.Example: Secondary workload CR

modules/sbo-rbac-requirements.adoc

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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-rbac-requirements_{context}"]
5+
= RBAC requirements
6+
7+
To expose the backing service binding data using the {servicebinding-title}, you require certain Role-based access control (RBAC) permissions. Specify certain verbs under the `rules` field of the `ClusterRole` resource to grant the RBAC permissions for the backing service resources. When you define these `rules`, you allow the {servicebinding-title} to read the binding data of the backing service resources throughout the cluster.
8+
9+
The {servicebinding-title} performs requests against the Kubernetes API using a dedicated service account. By default, this account has permissions to bind services to workloads, both represented by the following standard Kubernetes or OpenShift objects:
10+
11+
* `Deployments`
12+
* `DaemonSets`
13+
* `ReplicaSets`
14+
* `StatefulSets`
15+
* `DeploymentConfigs`
16+
17+
The Operator service account is bound to an aggregated cluster role, allowing Operator providers or cluster administrators to enable binding custom service resources to workloads. To grant the required permissions within a `ClusterRole`, label it with the `servicebinding.io/controller` flag and set the flag value to `true`. The following example shows how to allow the {servicebinding-title} to `get`, `watch`, and `list` the custom resources (CRs) of Crunchy PostgreSQL Operator:
18+
19+
.Example: Enable binding to PostgreSQL database instances provisioned by Crunchy PostgreSQL Operator
20+
[source,yaml]
21+
----
22+
apiVersion: rbac.authorization.k8s.io/v1
23+
kind: ClusterRole
24+
metadata:
25+
name: postgrescluster-reader
26+
labels:
27+
servicebinding.io/controller: "true"
28+
rules:
29+
- apiGroups:
30+
- postgres-operator.crunchydata.com
31+
resources:
32+
- postgresclusters
33+
verbs:
34+
- get
35+
- watch
36+
- list
37+
...
38+
----
39+
40+
This cluster role can be deployed during the installation of the backing service Operator.

0 commit comments

Comments
 (0)