:_mod-docs-content-type: ASSEMBLY
[id="binding-workloads-using-sbo"]
= Binding workloads using Service Binding Operator
include::_attributes/common-attributes.adoc[]
include::_attributes/servicebinding-document-attributes.adoc[]
:context: binding-workloads-using-sbo

toc::[]

Application developers must bind a workload to one or more backing services by using a binding secret. This secret is generated for the purpose of storing information to be consumed by the workload.

As an example, consider that the service you want to connect to is already exposing the binding data. In this case, you would also need a workload to be used along with the `ServiceBinding` custom resource (CR). By using this `ServiceBinding` CR, the workload sends a binding request with the details of the services to bind with.

.Example of `ServiceBinding` CR
[source,yaml]
----
apiVersion: binding.operators.coreos.com/v1alpha1
kind: ServiceBinding
metadata:
    name: spring-petclinic-pgcluster
    namespace: my-petclinic
spec:
    services: <1>
    - group: postgres-operator.crunchydata.com
      version: v1beta1
      kind: PostgresCluster
      name: hippo
    application: <2>
      name: spring-petclinic
      group: apps
      version: v1
      resource: deployments
----
<1> Specifies a list of service resources.
<2> The sample application that points to a Deployment or any other similar resource with an embedded PodSpec.

As shown in the previous example, you can also directly use a `ConfigMap` or a `Secret` itself as a service resource to be used as a source of binding data.

include::modules/sbo-naming-strategies.adoc[leveloffset=+1]
include::modules/sbo-advanced-binding-options.adoc[leveloffset=+1]
include::modules/sbo-binding-workloads-that-are-not-compliant-with-PodSpec.adoc[leveloffset=+1]
include::modules/sbo-unbinding-workloads-from-a-backing-service.adoc[leveloffset=+1]

[role="_additional-resources"]
[id="additional-resources_binding-workloads-sbo"]
== Additional resources
* xref:../../applications/connecting_applications_to_services/understanding-service-binding-operator.adoc#binding-a-workload-together-with-a-backing-service_understanding-service-binding-operator[Binding a workload together with a backing service].
* xref:../../applications/connecting_applications_to_services/getting-started-with-service-binding.adoc#sbo-connecting-spring-petclinic-sample-app-to-postgresql-database-service_getting-started-with-service-binding[Connecting the Spring PetClinic sample application to the PostgreSQL database service].
* xref:../../operators/understanding/crds/crd-managing-resources-from-crds.adoc#crd-creating-custom-resources-from-file_crd-managing-resources-from-crds[Creating custom resources from a file]
* link:https://redhat-developer.github.io/service-binding-operator/userguide/binding-workloads-using-sbo/custom-path-injection.html#_workload_resource_mapping[Example schema of the ClusterWorkloadResourceMapping resource].
