Skip to content

Enhance subscription features

Current situation

A service can subscribe to the event bus, but there's only a limited set of features a subscription can provide (selectors and subscriber's endpoint, mostly). It would be nice to be able to provide other requirements, such as rate limits, backoff, things like that.

Desired outcome

The Subscription event has been upgraded (now at v1 from v1alpha1, but still backward-compatible). It allows for the following features:

apiVersion: opentestfactory.org/v1
kind: Subscription
metadata:
  name: aSubscriptionName
spec:
  selector:                          # optional
    matchKind: aKind                 # optional
    matchLabels:                     # optional
      name: value
      name: value
    matchExpressions:                # optional
      - key: labelName
        operator: In | NotIn
        values:
          - string1
          - string2
      - key: labelName
        operator: Exists | DoesNotExist
      - ...
    matchFields:                     # optional
      path: value
      path: value
    matchFieldExpressions:           # optional
      - key: path
        operator: In | NotIn | ContainsAll | DoesNotContainAll
        values:
          - string1
          - string2
      - key: path
        operator: Exists | DoesNotExist
      - ...
  subscriber:
    endpoint: aString
    insecure-skit-tls-verify: aBool  # optional
  queues: aNumber                    # optional
  rateLimit: aNumber                 # optional
  backoff:                           # optional
    duration: aString
    factor: aNumber
    jitter: aNumber
    steps: aNumber
    retries: aNumber

The spec.selector part is optional. If not provided, will match all publications. If provided, will match publications that match all specified selectors.

The ContainsAll and DoesNotContainAll operators have been added for matchFieldExpressions (they are of no use for matchExpressions, as labels' values are strings, not arrays or objects).

The queues, rateLimit, and backoff have been added too, and will be used by #169.

Edited by Martin Lafaix