Skip to content

Commit

Permalink
location and getter context
Browse files Browse the repository at this point in the history
  • Loading branch information
svetakvsundhar committed Sep 30, 2024
1 parent 8fbafb7 commit b5aa6c2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
12 changes: 12 additions & 0 deletions experiments/compositions/samples/Eventarc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit b5aa6c2

Please sign in to comment.