Skip to content

Commit f7bcc49

Browse files
docs: add service instance sharing guide (#266)
1 parent 31b654f commit f7bcc49

8 files changed

Lines changed: 77 additions & 48 deletions

File tree

docs/_category_.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
"type": "generated-index",
66
"description": "Documentation for the SAP Crossplane Provider for Cloud Foundry."
77
}
8-
}
8+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"label": "🛠️ Contribution Notes",
33
"position": 1
4-
}
4+
}

docs/contribution-notes/resource-names.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,4 +133,4 @@ status:
133133
createdAt: "2024-09-01T12:00:00Z"
134134
updatedAt: "2024-09-01T12:00:00Z"
135135
name: test-space # not the same as spec.forProvider.name
136-
```
136+
```

docs/contribution-notes/upgrade-testing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,4 +533,4 @@ kind get clusters | grep e2e | xargs -n1 kind delete cluster --name
533533
- [Crossplane Documentation](https://docs.crossplane.io)
534534
- [CloudFoundry Provider](https://github.com/SAP/crossplane-provider-cloudfoundry)
535535
- [BTP Provider Upgrade Tests](https://github.com/SAP/crossplane-provider-btp/tree/main/test/upgrade) (reference implementation)
536-
- [External-Name ADR](/docs/crossplane-provider-btp/docs/contribution-notes/external-name-handling) (internal documentation for external-name patterns)
536+
- [External-Name ADR](/docs/crossplane-provider-btp/docs/contribution-notes/external-name-handling) (internal documentation for external-name patterns)

docs/end-user-guides/cloudfoundry.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ To realize the use case, you'll:
1313

1414
Additionally topics you can learn about:
1515

16-
- [Exporter Tool](/docs/crossplane-provider-cloudfoundry/docs/end-user-guides/import-resources-provider-cf) which helps you with exporting existing Cloud Foundry resources and importing them into your control plane
16+
- [Exporter Tool](/docs/crossplane-provider-cloudfoundry/docs/end-user-guides/import-resources-provider-cf) which helps you with exporting existing Cloud Foundry resources and importing them into your control plane

docs/end-user-guides/configure-provider-cf.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ metadata:
236236
spec:
237237
forProvider:
238238
type: Developer # valid role types are: Developer, Supporter, Auditor, Manager
239-
username: user1@example.com
239+
username: user1@example.com
240240
spaceRef:
241241
name: my-space
242242
```
@@ -306,4 +306,4 @@ We can use `enforcementPolicy` to control group assignment behavior:
306306

307307
### Error: "user with username `abc@example.com` does not exist"
308308

309-
If the user with the username/e-mail never logged in to your SAP Cloud Foundry environment, you will receive an error "user with username `abc@example.com` does not exist".
309+
If the user with the username/e-mail never logged in to your SAP Cloud Foundry environment, you will receive an error "user with username `abc@example.com` does not exist".

docs/end-user-guides/deploy-workload-provider-cf.mdx

Lines changed: 66 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,20 @@ import Badge, { READY,IN_PREVIEW, CONCEPT, IN_DEV, RESTRICTION, NA } from "@site
88

99
# Deploy workload
1010

11-
Finally, we want to deploy workload into our CloudFoundry environment.
11+
Finally, we want to deploy workload into our CloudFoundry environment.
1212

13-
Our sample application is a simple web application that uses `xsuaa` for authentication and `destination` service to connect to a backend system. The application is deployed as a docker image and exposed via a route.
13+
Our sample application is a simple web application that uses `xsuaa` for authentication and `destination` service to connect to a backend system. The application is deployed as a docker image and exposed via a route.
1414

1515
To deploy our sample application, we can either directly orchestrate all aspects (routes, services, app etc) using the `CloudFoundry` provider or use the `Multi-target Application` *(MTA)* to deploy in a bundle.
1616
- [Direct Deployment](#direct-deployment)
1717
- [Multi-target Application (MTA)](#multi-target-application) (coming soon)
1818

1919
## Prerequisites: Application Runtime Quota
2020

21-
Before we can deploy workload to Cloud Foundry, we need to first allocate **APPLICATION_RUNTIME** quota to our BTP `Subaccount`. We can use [`Entitlement`](https://doc.crds.dev/github.com/SAP/crossplane-provider-btp/account.btp.sap.crossplane.io/Entitlement/v1alpha1@v1.6.0) of the BTP provider for this.
21+
Before we can deploy workload to Cloud Foundry, we need to first allocate **APPLICATION_RUNTIME** quota to our BTP `Subaccount`. We can use [`Entitlement`](https://doc.crds.dev/github.com/SAP/crossplane-provider-btp/account.btp.sap.crossplane.io/Entitlement/v1alpha1@v1.6.0) of the BTP provider for this.
2222

2323
```yaml title="examples/runtime-quota.yaml"
24-
apiVersion: account.btp.sap.crossplane.io/v1alpha1
24+
apiVersion: account.btp.sap.crossplane.io/v1alpha1
2525
kind: Entitlement
2626
metadata:
2727
name: cf-quota
@@ -33,17 +33,17 @@ spec:
3333
subaccountRef:
3434
name: my-subaccount
3535
```
36-
This will allocate 2GB of memory to the Cloud Foundry runtime, and allows to create up to 20 routes and 100 service instances in your entire Cloud Foundry Organization. You may first distribute this quota among different `Spaces` using the `SpaceQuota` managed resource.
36+
This will allocate 2GB of memory to the Cloud Foundry runtime, and allows to create up to 20 routes and 100 service instances in your entire Cloud Foundry Organization. You may first distribute this quota among different `Spaces` using the `SpaceQuota` managed resource.
3737

3838

3939
## Direct deployment
4040

41-
In this approach, we orchestrate all resources required for our sample application directly using using the `CloudFoundry` provider.
42-
41+
In this approach, we orchestrate all resources required for our sample application directly using using the `CloudFoundry` provider.
42+
4343

4444
### Managing Services <Badge isHeadline={true} type={IN_PREVIEW}/>
4545

46-
Service instances are orchestrated using the `ServiceInstance` manages resources. All service instances are created in the orchestrated Space `my-space` we created in the previous step.
46+
Service instances are orchestrated using the `ServiceInstance` manages resources. All service instances are created in the orchestrated Space `my-space` we created in the previous step.
4747

4848

4949
```yaml title="Example: a destination service instance"
@@ -55,7 +55,7 @@ Service instances are orchestrated using the `ServiceInstance` manages resources
5555
forProvider:
5656
type: managed
5757
name: my-destination-service
58-
spaceRef:
58+
spaceRef:
5959
name: my-space
6060
servicePlan:
6161
offering: destination
@@ -85,10 +85,10 @@ Service instances are orchestrated using the `ServiceInstance` manages resources
8585
}
8686
```
8787
#### Configure Service Parameters
88-
Some service instances support configuration parameters, like the `xsuaa` service instance. You can provide these parameters in several ways:
88+
Some service instances support configuration parameters, like the `xsuaa` service instance. You can provide these parameters in several ways:
8989
<Tabs>
9090
<TabItem value="forProvider.jsonParams" label="Plain JSON">
91-
Use `spec.forProvider.jsonParams` to provide the parameters as a JSON string.
91+
Use `spec.forProvider.jsonParams` to provide the parameters as a JSON string.
9292

9393
```yaml title="Example: a xsuaa service instance with paramaters as JSON"
9494
spec:
@@ -140,24 +140,57 @@ Some service instances support configuration parameters, like the `xsuaa` servic
140140
</TabItem>
141141
</Tabs>
142142
143-
:::note Service Parameter Drift Detection
143+
:::note Service Parameter Drift Detection
144144
145-
Some managed service instances, *for example `xsuaa`*, do not allow fetching the service parameters after the service instance is created.
146-
In such cases, if service parameters are manually updated via the Cockpit or any other ways, the provider cannot detect the change and will do nothing.
145+
Some managed service instances, *for example `xsuaa`*, do not allow fetching the service parameters after the service instance is created.
146+
In such cases, if service parameters are manually updated via the Cockpit or any other ways, the provider cannot detect the change and will do nothing.
147147

148148
**Whenever service parameters are modified in the CR, the provider will apply the changes as usual**.
149149

150150
:::
151151

152+
#### Sharing service instances
153+
154+
Some service offerings support [service instance sharing](https://docs.cloudfoundry.org/devguide/services/sharing-instances.html). One example is `alert-notification`.
155+
156+
If you have the CF CLI and jq installed you can check if a service offering supports service instance sharing with the following command: `cf curl /v3/service_offerings | jq '.resources[] | select(.name == "<service-offering-name>") | .shareable'`
157+
158+
The space the service instance was initially created in and all spaces it is shared with can be in different orgs, but must be in the same landscape.
159+
160+
The user referenced in the [ProviderConfig](./configure-provider-cf.mdx#create-providerconfig) must have the `SpaceDeveloper` role in the space the service instance was initially created in and in all spaces it is shared with.
161+
162+
```yaml title="Example: a shared service instance"
163+
apiVersion: cloudfoundry.crossplane.io/v1alpha1
164+
kind: ServiceInstance
165+
metadata:
166+
name: my-alert-notification-service
167+
spec:
168+
forProvider:
169+
type: managed
170+
name: my-alert-notification-service
171+
spaceRef:
172+
name: my-space
173+
servicePlan:
174+
offering: alert-notification
175+
plan: standard
176+
sharedSpaces:
177+
- spaceRef:
178+
name: my-other-space
179+
```
180+
181+
:::warning
182+
Unsharing a service instance deletes all service bindings to apps in the spaces it was shared with. This might cause apps to fail.
183+
:::
184+
152185
#### Create Service Keys
153186
154187
`ServiceKeys` are created to give external applications access to the service instance.
155188

156189
They are credentials for **direct communication with specific service instances within the Cloud Foundry Environment**.
157190

158191
```yaml title="Example: a service key"
159-
apiVersion: cloudfoundry.crossplane.io/v1alpha1
160-
kind: ServiceCredentialBinding
192+
apiVersion: cloudfoundry.crossplane.io/v1alpha1
193+
kind: ServiceCredentialBinding
161194
metadata:
162195
name: my-service-key
163196
spec:
@@ -181,8 +214,8 @@ Service keys (`ServiceCredentialBinding` of type `key`) support automatic key ro
181214
**Basic Rotation Configuration:**
182215

183216
```yaml title="Example: rotating service key"
184-
apiVersion: cloudfoundry.crossplane.io/v1alpha1
185-
kind: ServiceCredentialBinding
217+
apiVersion: cloudfoundry.crossplane.io/v1alpha1
218+
kind: ServiceCredentialBinding
186219
metadata:
187220
name: my-rotating-service-key
188221
spec:
@@ -240,9 +273,9 @@ metadata:
240273

241274
### Configure `Route` <Badge isHeadline={true} type={READY}/>
242275

243-
A route is a unique address/URL that enables our end users to reach our sample applications.
276+
A route is a unique address/URL that enables our end users to reach our sample applications.
244277

245-
We first choose a `Domain` in which we want to create the route. Here we use the shared HTTP domain `cfapps.eu12.hana.ondemand.com`. This domain is deployed by default in the BTP Cloud Foundry environment.
278+
We first choose a `Domain` in which we want to create the route. Here we use the shared HTTP domain `cfapps.eu12.hana.ondemand.com`. This domain is deployed by default in the BTP Cloud Foundry environment.
246279

247280
```yaml title="Example:import cfapps domain"
248281
apiVersion: cloudfoundry.crossplane.io/v1alpha1
@@ -252,14 +285,14 @@ metadata:
252285
name: cfapps-domain
253286
spec:
254287
forProvider:
255-
name: cfapps.eu12.hana.ondemand.com
288+
name: cfapps.eu12.hana.ondemand.com
256289
orgRef:
257290
name: my-org
258291
internal: false
259292
260293
```
261294

262-
We then create a route with the given `host` and `path` in the `cfapp-domain`. The resulting URL will be `my-app.cfapps.eu12.hana.ondemand.com/hello`.
295+
We then create a route with the given `host` and `path` in the `cfapp-domain`. The resulting URL will be `my-app.cfapps.eu12.hana.ondemand.com/hello`.
263296

264297
```yaml title="Example: create my application route"
265298
apiVersion: cloudfoundry.crossplane.io/v1alpha1
@@ -283,16 +316,16 @@ spec:
283316
:::note Route with the same URL already exists
284317
Routes are unique URL/address . If a Route with a URL exist in another Space or Organization, you cannot create a Route with the same URL.
285318
286-
Route subjects to quota limit set on the respective Space. If not set, the Subaccount quota limit applies.
319+
Route subjects to quota limit set on the respective Space. If not set, the Subaccount quota limit applies.
287320
:::
288321
289-
Currently, you can only create Routes under the default landscape domain `cfapps.<region>.hana.ondemand.com`.
290-
It depends on the region of your BTP Subaccount, in the `eu10` region, the default domain is `cfapps.eu10.hana.ondemand.com`.
322+
Currently, you can only create Routes under the default landscape domain `cfapps.<region>.hana.ondemand.com`.
323+
It depends on the region of your BTP Subaccount, in the `eu10` region, the default domain is `cfapps.eu10.hana.ondemand.com`.
291324
Use `spec.forProvider.domain.name` to specify the domain name directly.
292325

293326
### Deploy `App` <Badge isHeadline={true} type={IN_PREVIEW}/>
294327

295-
The `App` resource lets you deploy a Docker image as an app.
328+
The `App` resource lets you deploy a Docker image as an app.
296329

297330
```yaml title="examples/app.yaml"
298331
apiVersion: cloudfoundry.crossplane.io/v1alpha1
@@ -399,15 +432,15 @@ For `Apps` to consume `ServiceInstances` you can either bind them **using the de
399432
<details>
400433
<summary>How do I bind non-cloudfoundry service instances (e.g. using BTP Service Operator)</summary>
401434

402-
Let's assume we created [`ServiceInstance`](https://doc.crds.dev/github.com/SAP/crossplane-provider-btp/account.btp.sap.crossplane.io/ServiceInstance/v1alpha1@v1.6.0) and [`ServiceBinding`](https://doc.crds.dev/github.com/SAP/crossplane-provider-btp/account.btp.sap.crossplane.io/ServiceBinding/v1alpha1@v1.6.0).
435+
Let's assume we created [`ServiceInstance`](https://doc.crds.dev/github.com/SAP/crossplane-provider-btp/account.btp.sap.crossplane.io/ServiceInstance/v1alpha1@v1.6.0) and [`ServiceBinding`](https://doc.crds.dev/github.com/SAP/crossplane-provider-btp/account.btp.sap.crossplane.io/ServiceBinding/v1alpha1@v1.6.0).
403436
Note that this service is created outside of Cloud Foundry Environment.
404437

405438
To bind it to a Cloud Foundry `App`, we first create a Cloud Foundry `ServiceInstance` of type `user-provided` called `my-ups`. It reads from the `Secret` of the `ServiceBinding` we created using BTP Service Operator.
406439
You can use `spec.forProvider.serviceBinding` in `App` to then bind `my-ups`.
407440
Effectively this delivers `ServiceBinding` to the `VCAP_SERVICES` environment variables of the app.
408441

409442
```yaml title="examples/ups-svc.yaml"
410-
apiVersion: cloudfoundry.crossplane.io/v1alpha1
443+
apiVersion: cloudfoundry.crossplane.io/v1alpha1
411444
kind: ServiceInstance
412445
metadata:
413446
namespace: default
@@ -418,19 +451,19 @@ For `Apps` to consume `ServiceInstances` you can either bind them **using the de
418451
name: my-ups
419452
routeServiceUrl: https://my-demo-route-service.example.com
420453
syslogDrainUrl: syslog-tls://example.log-aggregator.com:6514
421-
spaceRef:
454+
spaceRef:
422455
name: my-space
423456
policy:
424457
resolve: Always
425-
credentialsSecretRef:
458+
credentialsSecretRef:
426459
name: svc-secret ## Secret created from ServiceBinding via BTP Service Operator
427460
namespace: default
428461
```
429462
</details>
430463

431464
## Multi-target Application
432465

433-
In this scenario all aspects of the deployment are **orchestrated by the Multi-target Application _`MTA`_ approach** which spans over several tool and offers one application lifecycle.
466+
In this scenario all aspects of the deployment are **orchestrated by the Multi-target Application _`MTA`_ approach** which spans over several tool and offers one application lifecycle.
434467

435468
You can learn more about the `MTA` build tool [here](https://help.sap.com/docs/btp/sap-business-technology-platform/multitarget-applications-in-cloud-foundry-environment).
436469

@@ -440,7 +473,7 @@ Coming soon...
440473

441474
### Existing pipelines <Badge isHeadline={true} type={READY}/>
442475

443-
You can use any CloudFoundry landscape, orchestrated or manually created, and use traditional pipelines to deploy your [`MTA` or Non-`MTA` workload](https://www.project-piper.io/steps/cloudFoundryDeploy/).
476+
You can use any CloudFoundry landscape, orchestrated or manually created, and use traditional pipelines to deploy your [`MTA` or Non-`MTA` workload](https://www.project-piper.io/steps/cloudFoundryDeploy/).
444477

445478

446479

@@ -452,4 +485,4 @@ Set it as `SpaceDeveloper` or `SpaceManager` role in the respective `Space` and
452485

453486
### CF-UnprocessableEntity|10008: Cfclient error - Routes quota exceeded
454487

455-
When orchestrating `Routes`, ensure that you allocated route quota to your `Organization` using [`APPLICATION_RUNTIME Entitlement`](#prerequisites-application-runtime-quota) on `Subaccount` level.
488+
When orchestrating `Routes`, ensure that you allocated route quota to your `Organization` using [`APPLICATION_RUNTIME Entitlement`](#prerequisites-application-runtime-quota) on `Subaccount` level.

docs/end-user-guides/order-cf-environment.mdx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@ import Badge, { READY,IN_PREVIEW, CONCEPT, IN_DEV, RESTRICTION, NA } from "@site
1010

1111
In this guide, we will get familiar with the fundamentals of creating a managed `CloudFoundryEnvironment` in a BTP `Subaccount`.
1212

13-
:::note
14-
Are you a platform operator or administrator? Feel free to check out the [OpenMCP project](https://openmcp-project.github.io/docs/). It helps organizations enable more teams to use Crossplane by providing a managed control plane as a service.
15-
:::
16-
1713
## 🚧 Prerequisites
1814

1915
- You have a running control plane.
@@ -34,14 +30,14 @@ Now, we have everything in place to enable `CloudFoundry` in our selected `Subac
3430

3531

3632
```yaml title="examples/cloudfoundry.yaml"
37-
apiVersion: environment.btp.sap.crossplane.io/v1alpha1
33+
apiVersion: environment.btp.sap.crossplane.io/v1alpha1
3834
kind: CloudFoundryEnvironment
3935
metadata:
4036
name: cf-env
4137
spec:
4238
forProvider:
4339
initialOrgManagers:
44-
- technical-user@example.com
40+
- technical-user@example.com
4541
landscape: cf-eu12
4642
orgName: test-eu12
4743
environmentName: cf-test-eu12
@@ -50,7 +46,7 @@ spec:
5046
subaccountRef:
5147
name: my-subaccount
5248
writeConnectionSecretToRef:
53-
name: cf-environment-secret # Secret containing connection details including apiEnpoint of the created cloudfoundry environment.
49+
name: cf-environment-secret # Secret containing connection details including apiEnpoint of the created cloudfoundry environment.
5450
namespace: default
5551
```
5652
@@ -74,4 +70,4 @@ Once the resource is created, you can find the connection details in the `Secret
7470
## FAQs
7571
### 401, User Authentication failed: LOCKED_OTP_CODE
7672

77-
The required services can only be consumed by technical users. Please revisit our [configuration guide](/docs/crossplane-provider-btp/docs/end-user-guides/setup/configure-provider-btp) page and switch to a non personal user.
73+
The required services can only be consumed by technical users. Please revisit our [configuration guide](/docs/crossplane-provider-btp/docs/end-user-guides/setup/configure-provider-btp) page and switch to a non personal user.

0 commit comments

Comments
 (0)