Skip to content

Commit eb848a4

Browse files
authored
[eks-argo] Add instructions for how to publish argo events from outside cluster (#61)
1 parent 832fc3f commit eb848a4

File tree

3 files changed

+34
-13
lines changed

3 files changed

+34
-13
lines changed

examples/eks_argo/README.md

+20
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,23 @@ Run `terraform destroy`
4949
⚠️ This is meant as a reference example, with many things omitted for simplicity, such as proper RBAC setup, production-grade autoscaling and UI. For example, all workloads running in the cluster use the same AWS IAM role. We do not recommend using this as a production deployment of Metaflow on Kubernetes.
5050

5151
For learn more about production-grade deployments, you can talk to us on [the Outerbounds slack](http://slack.outerbounds.co). We are happy to help you there!
52+
53+
# Advanced topics
54+
55+
Q: How to publish an Argo Event from outside the Kubernetes cluster?
56+
A:
57+
Establish port forward for Argo Events Webhook server:
58+
59+
$ kubectl port-forward -n default service/argo-events-webhook-eventsource-svc 12000:12000
60+
61+
Here is a snippet that publishes the event "foo" (consume this event with `@trigger(event="foo")`):
62+
```
63+
from metaflow.integrations import ArgoEvent
64+
65+
def main():
66+
evt = ArgoEvent('foo', url="http://localhost:12000/metaflow-event")
67+
evt.publish(force=True)
68+
69+
if __name__ == '__main__':
70+
main()
71+
```

examples/eks_argo/eks.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module "eks" {
44
version = "17.23.0"
55

66
cluster_name = local.cluster_name
7-
cluster_version = "1.21"
7+
cluster_version = "1.24"
88
subnets = module.vpc.private_subnets
99
enable_irsa = true
1010
tags = local.tags

examples/eks_argo/metaflow_config.tf

+13-12
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,19 @@ data "aws_api_gateway_api_key" "metadata_api_key" {
44

55
resource "local_file" "foo" {
66
content = jsonencode({
7-
"METAFLOW_SERVICE_AUTH_KEY" = data.aws_api_gateway_api_key.metadata_api_key.value
8-
"METAFLOW_DATASTORE_SYSROOT_S3" = module.metaflow-datastore.METAFLOW_DATASTORE_SYSROOT_S3
9-
"METAFLOW_DATATOOLS_S3ROOT" = module.metaflow-datastore.METAFLOW_DATATOOLS_S3ROOT
10-
"METAFLOW_SERVICE_URL" = module.metaflow-metadata-service.METAFLOW_SERVICE_URL
11-
"METAFLOW_KUBERNETES_NAMESPACE" = "default"
12-
"METAFLOW_KUBERNETES_SERVICE_ACCOUNT" = "argo-workflow"
13-
"METAFLOW_DEFAULT_DATASTORE" = "s3"
14-
"METAFLOW_DEFAULT_METADATA" = "service"
15-
"METAFLOW_ARGO_EVENTS_EVENT_BUS" = "default"
16-
"METAFLOW_ARGO_EVENTS_EVENT_SOURCE" = "argo-events-webhook"
17-
"METAFLOW_ARGO_EVENTS_EVENT" = "metaflow-event"
18-
"METAFLOW_ARGO_EVENTS_WEBHOOK_URL" = "http://argo-events-webhook-eventsource-svc.default:12000/metaflow-event"
7+
"METAFLOW_SERVICE_AUTH_KEY" = data.aws_api_gateway_api_key.metadata_api_key.value
8+
"METAFLOW_DATASTORE_SYSROOT_S3" = module.metaflow-datastore.METAFLOW_DATASTORE_SYSROOT_S3
9+
"METAFLOW_DATATOOLS_S3ROOT" = module.metaflow-datastore.METAFLOW_DATATOOLS_S3ROOT
10+
"METAFLOW_SERVICE_URL" = module.metaflow-metadata-service.METAFLOW_SERVICE_URL
11+
"METAFLOW_KUBERNETES_NAMESPACE" = "default"
12+
"METAFLOW_KUBERNETES_SERVICE_ACCOUNT" = "argo-workflow"
13+
"METAFLOW_DEFAULT_DATASTORE" = "s3"
14+
"METAFLOW_DEFAULT_METADATA" = "service"
15+
"METAFLOW_ARGO_EVENTS_EVENT_BUS" = "default"
16+
"METAFLOW_ARGO_EVENTS_EVENT_SOURCE" = "argo-events-webhook"
17+
"METAFLOW_ARGO_EVENTS_SERVICE_ACCOUNT" = "operate-workflow-sa"
18+
"METAFLOW_ARGO_EVENTS_EVENT" = "metaflow-event"
19+
"METAFLOW_ARGO_EVENTS_WEBHOOK_URL" = "http://argo-events-webhook-eventsource-svc.default:12000/metaflow-event"
1920
})
2021
filename = "${path.module}/config.json"
2122
}

0 commit comments

Comments
 (0)