diff --git a/experiments/compositions/samples/Eventarc/README.md b/experiments/compositions/samples/Eventarc/README.md index aeb5c91260..b531a4a844 100644 --- a/experiments/compositions/samples/Eventarc/README.md +++ b/experiments/compositions/samples/Eventarc/README.md @@ -17,6 +17,18 @@ This repository provides a KCC Compositions approach to setting up an event-driv * **Service Account:** With IAM permissions to manage GCS buckets, Pub/Sub topics, Eventarc triggers, and Cloud Workflows. * **Cloud Workflow:** The workflow you want to trigger. +**Why Getters and the Context API are Used** + +This configuration utilizes KCC's `GetterConfiguration` and `Context` API to improve resource management and streamline deployments. + +* **Getters (`GetterConfiguration`)** + + Getters allow the composition to extract values from resources within the cluster. In this case, they ensure that the `StorageNotification` resource is created only after the GCS bucket and Pub/Sub topic are fully available, preventing dependency errors. + +* **Context API (`Context`)** + + The Context API provides a way to define contextual information, such as the project ID, that can be accessed by the composition. This avoids redundant specification of the project ID for each resource and promotes centralized configuration management. + **Deployment Steps** 1. **Apply `sa.yaml`:** Creates the service account and grants it necessary permissions. diff --git a/experiments/compositions/samples/Eventarc/eventarc-composition.yaml b/experiments/compositions/samples/Eventarc/eventarc-composition.yaml index 0777231675..b1489343e0 100644 --- a/experiments/compositions/samples/Eventarc/eventarc-composition.yaml +++ b/experiments/compositions/samples/Eventarc/eventarc-composition.yaml @@ -102,8 +102,8 @@ spec: spec: destination: workflowRef: - external: "projects/{{ context.spec.project }}/locations/us-central1/workflows/{{eventarcconfigs.spec.workflowName}}" - location: us-central1 + external: "projects/{{ context.spec.project }}/locations/{{eventarcconfigs.spec.location}}/workflows/{{eventarcconfigs.spec.workflowName}}" + location: {{eventarcconfigs.spec.location}} serviceAccountRef: name: eventarctrigger-iam-gsa transport: