Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Event-driven orchestration with Eventarc and Wo...

Mete Atamel
November 03, 2021

Event-driven orchestration with Eventarc and Workflows

Mete Atamel

November 03, 2021
Tweet

More Decks by Mete Atamel

Other Decks in Programming

Transcript

  1. Event-driven orchestration with Eventarc and Workflows Mete Atamel Developer Advocate

    at Google @meteatamel atamel.dev speakerdeck.com/meteatamel
  2. Google Cloud GA Your own apps GA Cloud Run GA

    Cloud Functions Preview Workflows Preview Targets Sources Cloud Run for Anthos on GKE Preview Eventarc Triggers to filter events CloudEvents format
  3. New message in a Pub/Sub topic → Cloud Run gcloud

    eventarc triggers create trigger-pubsub \ --destination-run-service=$SERVICE_NAME \ --destination-run-region=$REGION \ --event-filters="type=google.cloud.pubsub.topic.v1.messagePublished" --transport-topic=projects/$PROJECT_ID/topics/$TOPIC_ID Pub/Sub Trigger
  4. New Compute Engine VM creation → Cloud Run gcloud eventarc

    triggers create trigger-auditlog \ --destination-run-service=$SERVICE_NAME \ --destination-run-region=$REGION --event-filters="type=google.cloud.audit.log.v1.written" \ --event-filters="serviceName=compute.googleapis.com" \ --event-filters="methodName=beta.compute.instances.insert" \ --service-account=$PROJECT_NO-compute@developer.gserviceaccount.com Audit Log Trigger
  5. Create a trigger for new object creation in Cloud Storage

    → Cloud Run gcloud eventarc triggers create trigger-gcs \ --destination-run-service=$SERVICE_NAME \ --destination-run-region=$REGION --event-filters="type=google.cloud.storage.object.v1.finalized" \ --event-filters="bucket=$BUCKET_NAME" \ --service-account=$PROJECT_NO-compute@developer.gserviceaccount.com Cloud Storage Trigger
  6. Serverless Compute External API’s Google API’s etc... Workflows - orchestrate

    & integrate SaaS API’s Private API’s Other Clouds Workflows
  7. - processPayment: call: http.post args: url: https://payment-processor.run.app/... body: input: ${paymentDetails}

    result: processResult - shipItems: call: http.post args: url: https://.../cloudfunctions.net/ship body: input: ${processResult.body} result: shipResult - notifyUser: call: http.post ... Payment Processor Cloud Run Authorize & charge CC Notifier Cloud Run Notify user Shipper Cloud Functions Prepare & ship items YAML or JSON syntax
  8. Deploy, execute, manage workflows # Deploy a workflow gcloud workflows

    deploy my-workflow --source=workflow.yaml # Execute a workflow gcloud workflows execute my-workflow # See the result gcloud workflows executions describe <your-execution-id> --workflow my-workflow
  9. Image processing pipeline v1 - Eventarc (AuditLog-Cloud Storage) + Cloud

    Run End Users Images Input Cloud Storage Images Output Cloud Storage Filter Cloud Run Resizer Cloud Run Labeler Cloud Run Watermarker Cloud Run File uploaded Cloud Pub/Sub File resized Cloud Pub/Sub AuditLog Trigger Eventarc Pub/Sub Trigger Eventarc Pub/Sub Trigger Eventarc
  10. Image processing pipeline v2 - Eventarc (Cloud Storage) + Cloud

    Run +Workflows End Users Images Input Cloud Storage Images Output Cloud Storage Filter Cloud Run Cloud Storage Trigger Eventarc Image Processing Workflows Watermarker Cloud Functions Resizer Cloud Functions Labeler Cloud Functions
  11. Image processing pipeline v3 - Eventarc (Cloud Storage) + Workflows

    End Users Images Input Cloud Storage Images Output Cloud Storage Cloud Storage Trigger Eventarc Image Processing Workflows Watermarker Cloud Functions Resizer Cloud Functions Labeler Cloud Functions Filter Cloud Functions