Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redis Parameterization JSON #1752

Closed
jrowinski3d opened this issue Mar 18, 2022 · 2 comments · Fixed by #1754
Closed

Redis Parameterization JSON #1752

jrowinski3d opened this issue Mar 18, 2022 · 2 comments · Fixed by #1754
Labels
bug Something isn't working

Comments

@jrowinski3d
Copy link

jrowinski3d commented Mar 18, 2022

Describe the bug
As per the title, trying to parameterize the json coming from the pub/sub of redis. I. posted a question about it, but now I'm wondering if its a bug or something is missing?

To Reproduce
Publish to redis:

PUBLISH FOO '{"message": "hello", "message2": "bye"}'

Have the eventSource and Sensor configured:

apiVersion: argoproj.io/v1alpha1
kind: EventSource
metadata:
  name: redis
spec:
  redis:
    example:
      # HostAddress refers to the address of the Redis host/server
      hostAddress: redis.redis:6379
      namespace: argo
      password:
        name: redis
        key: redis-pass
        # Channels to subscribe to listen events.
      channels:
        - FOO

---
apiVersion: argoproj.io/v1alpha1
kind: Sensor
metadata:
  name: redis
spec:
  template:
    serviceAccountName: operate-workflow-sa
  dependencies:
    - name: test-dep
      eventSourceName: redis
      eventName: example
  triggers:
    - template:
        name: workflow-trigger
        k8s:
          operation: create
          source:
            resource:
              apiVersion: argoproj.io/v1alpha1
              kind: Workflow
              metadata:
                generateName: redis-
                namespace: argo
              spec:
                entrypoint: whalesay
                arguments:
                  parameters:
                  - name: message
                templates:
                - name: whalesay
                  inputs:
                    parameters:
                    - name: message
                  container:
                    image: docker/whalesay:latest
                    command: [cowsay]
                    args: ["{{inputs.parameters.message}}"]
          # https://argoproj.github.io/argo-events/tutorials/02-parameterization/#webhook-event-payload
          parameters:
            - src:
                dependencyName: test-dep
                dataKey: THIS_WILL_BE_REPLACED
              dest: spec.arguments.parameters.0.value
        parameters:
          - src:
              dependencyName: test-dep
              dataKey: body.message
            dest: k8s.parameters.0.src.dataKey

Expected behavior
Being able to see only the message from the json.

Actual behavior
Receive entire data payload.

 _________________________________________
/ {"channel":"FOO","pattern":"","body":"{ \
| \"message\": \"hello\", \"message2\":       |
\ \"bye\"}"}                              /
 -----------------------------------------
    \
     \
      \
                    ##        .
              ## ## ##       ==
           ## ## ## ##      ===
       /""""""""""""""""___/ ===
  ~~~ {~~ ~~~~ ~~~ ~~~~ ~~ ~ /  ===- ~~~
       \______ o          __/
        \    \        __/
          \____\______/


Message from the maintainers:

If you wish to see this enhancement implemented please add a 👍 reaction to this issue! We often sort issues this way to know what to prioritize.

I feel like this my be a feature request?

@jrowinski3d jrowinski3d added the bug Something isn't working label Mar 18, 2022
@whynowy
Copy link
Member

whynowy commented Mar 21, 2022

This is a bug, all the redis message content is treated as regular string. Similar to other event sources, we should add a bool field jsonBody to indicate the message content is JSON.

@jrowinski3d
Copy link
Author

Thanks @whynowy , I will be watching for it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants