GCP Pub/Sub

Detailed documentation on the GCP Pub/Sub component

Create a Dapr component

To setup GCP pubsub create a component of type pubsub.gcp.pubsub. See this guide on how to create and apply a pubsub configuration

  1. apiVersion: dapr.io/v1alpha1
  2. kind: Component
  3. metadata:
  4. name: gcp-pubsub
  5. namespace: default
  6. spec:
  7. type: pubsub.gcp.pubsub
  8. version: v1
  9. metadata:
  10. - name: type
  11. value: service_account
  12. - name: project_id
  13. value: <PROJECT_ID> # replace
  14. - name: private_key_id
  15. value: <PRIVATE_KEY_ID> #replace
  16. - name: client_email
  17. value: <CLIENT_EMAIL> #replace
  18. - name: client_id
  19. value: <CLIENT_ID> # replace
  20. - name: auth_uri
  21. value: https://accounts.google.com/o/oauth2/auth
  22. - name: token_uri
  23. value: https://oauth2.googleapis.com/token
  24. - name: auth_provider_x509_cert_url
  25. value: https://www.googleapis.com/oauth2/v1/certs
  26. - name: client_x509_cert_url
  27. value: https://www.googleapis.com/robot/v1/metadata/x509/<PROJECT_NAME>.iam.gserviceaccount.com #replace PROJECT_NAME
  28. - name: private_key
  29. value: <PRIVATE_KEY> # replace x509 cert
  30. - name: disableEntityManagement
  31. value: "false"

Warning

以上示例将 Secret 明文存储。 更推荐的方式是使用 Secret 组件, here

Spec metadata fields

字段RequiredDetailsExample
typeYGCP credentials typeservice_account
project_idYGCP project idprojectId
private_key_idYGCP private key id“privateKeyId”
private_keyYGCP credentials private key. Replace with x509 cert12345-12345
client_emailYGCP client email“client@email.com”
client_idYGCP client id0123456789-0123456789
auth_uriYGoogle account OAuth endpointhttps://accounts.google.com/o/oauth2/auth
token_uriYGoogle account token urihttps://oauth2.googleapis.com/token
auth_provider_x509_cert_urlYGCP credentials cert urlhttps://www.googleapis.com/oauth2/v1/certs
client_x509_cert_urlYGCP credentials project x509 cert urlhttps://www.googleapis.com/robot/v1/metadata/x509/<PROJECT_NAME>.iam.gserviceaccount.com
disableEntityManagementNWhen set to “true”, topics and subscriptions do not get created automatically. Default: “false”“true”, “false”

Create a GCP Pub/Sub

Follow the instructions here on setting up Google Cloud Pub/Sub system.

相关链接

Last modified January 1, 0001