Skip to content
This repository was archived by the owner on Nov 5, 2024. It is now read-only.

Google Sources - Add support for Workload Identity#1223

Merged
FranBarrera merged 2 commits into
triggermesh:mainfrom
FranBarrera:google-sources-workload-identity
Nov 22, 2022
Merged

Google Sources - Add support for Workload Identity#1223
FranBarrera merged 2 commits into
triggermesh:mainfrom
FranBarrera:google-sources-workload-identity

Conversation

@FranBarrera

Copy link
Copy Markdown
Contributor

Closes #1200

Steps to use:

A GKE cluster ready with Workload Identity (https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity)
Following the guide, it is needed to do some steps:

Allow the triggermesh service account to impersonate the IAM:

gcloud iam service-accounts add-iam-policy-binding [email protected] \
    --role roles/iam.workloadIdentityUser \
    --member "serviceAccount:my-project.svc.id.goog[triggermesh/triggermesh-controller]"

Also the service account for the specific source, ex: pubsub:

gcloud iam service-accounts add-iam-policy-binding [email protected] \
    --role roles/iam.workloadIdentityUser \
    --member "serviceAccount:my-project.svc.id.goog[my-namespace/googlecloudpubsubsource-adapter]"

Annotate the triggermesh-controller service account:

kubectl annotate serviceaccount triggermesh-controller \
    --namespace triggermesh \
    iam.gke.io/[email protected]

Finally add the following annotation to the Google source: ex: pubsub:

apiVersion: sources.triggermesh.io/v1alpha1
kind: GoogleCloudPubSubSource
metadata:
  name: sample
  annotations:
    iam.gke.io/gcp-service-account: [email protected]
spec:
  topic: projects/my-project/topics/my-topic

  sink:
    ref:
      apiVersion: eventing.knative.dev/v1
      kind: Broker
      name: default

@FranBarrera FranBarrera requested a review from a team November 22, 2022 13:07
Comment thread pkg/reconciler/adapter.go Outdated
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support Workload Identity for authenticating GoogleCloud event sources

2 participants