Skip to content

[BUG] Trigger's spec.attributes does not work with numbers #1646

@Harwayne

Description

@Harwayne

Describe the bug
Trigger's spec.attributes is a map[string]string, for exact matching with CloudEvents attributes. If the value of the attribute happens to look like a number (e.g. 42), then you cannot match it. As it is considered a number, which is never equal to a string.

Expected behavior
If spec.attributes is { the: "42" }, and I send a CloudEvent with an attribute in HTTP binary content mode with an HTTP header of ce-the: 42, then I expect the filter to match.

To Reproduce

  apiVersion: eventing.knative.dev/v1alpha1
  kind: Trigger
  spec:
    broker: default
    filter:
      attributes:
        heart: "yes"
        source: https://github.com/knative/eventing-sources/cmd/heartbeats/#event-test/mypod
        the: "42"
        type: dev.knative.eventing.samples.heartbeat
    subscriber:
      ref:
        apiVersion: v1
        kind: Service
        name: event-display
---
  apiVersion: sources.eventing.knative.dev/v1alpha1
  kind: ContainerSource
  metadata:
    name: test-heartbeats
    namespace: default
  spec:
    args:
    - --period=1
    env:
    - name: POD_NAME
      value: mypod
    - name: POD_NAMESPACE
      value: event-test
    image: index.docker.io/daisyycguo/heartbeats-6790335e994243a8d3f53b967cdd6398
    sink:
      apiVersion: eventing.knative.dev/v1alpha1
      kind: Broker
      name: default

Metadata

Metadata

Assignees

Labels

kind/bugCategorizes issue or PR as related to a bug.priority/important-soonMust be staffed and worked on either currently, or very soon, ideally in time for the next release.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions