<#3663 [BUG] Sending cloud events from flyteadmin ...
# flyte-github
a
#3663 [BUG] Sending cloud events from flyteadmin not documented properly for GCP and results in errors Issue created by fg91 Describe the bug How the cloud events integration of flyteadmin can be configured is documented here. For GCP, for instance, it says:
Copy code
cloud_events.yaml: |
           cloudEvents:
             enable: true
             gcp:
               region: us-east-2
             eventsPublisher:
               eventTypes:
               - all # or node, task, workflow
               topicName: my-topic
             type: gcp
When including such a config in the helm values file, the following error is raised in flyteadmin:
Copy code
{"json":{},"level":"fatal","msg":"caught panic: project id is required [goroutine 1 [running]:\nruntime/debug.Stack()\n\t/usr/local/go/src/runtime/debug/stack.go:24 +0x65\<http://ngithub.com/flyteorg/flyteadmin/pkg/rpc/adminservice.NewAdminServer.func1()|ngithub.com/flyteorg/flyteadmin/pkg/rpc/adminservice.NewAdminServer.func1()>\n\t/go/src/github.com/flyteorg/flyteadmin/pkg/rpc/adminservice/base.go:74 +0x88\npanic({0x2273960, 0xc0013f1dd0})\n\t/usr/local/go/src/runtime/panic.go:838 +0x207\<http://ngithub.com/flyteorg/flyteadmin/pkg/async/cloudevent.NewCloudEventsPublisher(|ngithub.com/flyteorg/flyteadmin/pkg/async/cloudevent.NewCloudEventsPublisher(>{0x2c04440, 0xc000128000}, {0x1, {0xc00051b4e8, 0x3}, {{0xc00051b470, 0xb}}, {{0x0, 0x0}}, {{0x0, ...}, ...}, ...}, ...)\n\t/go/src/github.com/flyteorg/flyteadmin/pkg/async/cloudevent/factory.go:61 +0x905\<http://ngithub.com/flyteorg/flyteadmin/pkg/rpc/adminservice.NewAdminServer({0x2c04440|ngithub.com/flyteorg/flyteadmin/pkg/rpc/adminservice.NewAdminServer({0x2c04440>?, 0xc000128000}, 0xc0006a3b80, {0x2c0cb60, 0xc00058c6c0}, {0x0, 0x0}, {0x0, 0x0}, 0xc000b563c0, ...)\n\t/go/src/github.com/flyteorg/flyteadmin/pkg/rpc/adminservice/base.go:103 +0x845\<http://ngithub.com/flyteorg/flyteadmin/pkg/|ngithub.com/flyteorg/flyteadmin/pkg/>
When setting the
projectId
instead of the region as done here, this error disappears. However, the resulting yaml file in the flyteadmin configmap still contains aws config:
Copy code
❯ k -n flyte get configmaps flyte-admin-base-config -o yaml
apiVersion: v1
data:
  cloud_events.yaml: "cloudEvents: \n  aws:\n    region: us-east-2\n  enable: true\n
    \ eventsPublisher:\n    eventTypes:\n    - all\n    topicName: <my-topic>\n
    \ gcp:\n    projectId: <my-project>\n  type: gcp\n"
Despite the unintended aws config, the published events do make it to GCP pub/sub and can be pulled in the cloud console. However, even though the messages can successfully be pulled from the pub sub topic/subscription, flyteadmin always shows error logs:
Copy code
{"json":{"exec_id":"b862f22a535442bda2e4","node":"n0"},"level":"error","msg":"Failed to publish a message with key [flyteidl.admin.TaskExecutionEventRequest] and message [Context Attributes,\n  specversion: 1.0\n  type: com.flyte.resource.flyteidl.admin.TaskExecutionEventRequest\n   ... ] and error: context canceled","ts":"2023-05-10T11:46:42Z"}
{"json":{"exec_id":"b862f22a535442bda2e4","node":"n0"},"level":"error","msg":"Failed to send message [event:\u003ctask_id:\u003cresource_type:TASK ... ] with error: context canceled","ts":"2023-05-10T11:46:42Z"}
Expected behavior • The documentation should not say to add the region for GCP but the projedId. • When configuring GCP, the resulting configmap should not contain AWS config. • Flyteadmin should not show errors even though the published events make it to pub/sub and can be pulled from there. Additional context to reproduce No response Screenshots No response Are you sure this issue hasn't been raised already? ☑︎ Yes Have you read the Code of Conduct? ☑︎ Yes flyteorg/flyte