This projects explore several basic Knative Eventing patterns via an application mirroring GitHub issues to Slack
Run these scripts, in order:
- 0-setup.sh: create a
kind
cluster and install core Knative Serving and Eventing usingkn quickstart
- 1-addons.sh: install the required add-ons to run the demo:
- GitHubSource
- Strimzi (this is not a Knative add-on)
- KafkaChannel
- KafkaBroker
- 3-deploy.sh: deploy the demo. This scripts looks for 2 environment variables:
- GITHUB_TOKEN: your GitHub personal access token
- SLACK_TOKEN: the slack token for your slack app. See Slack 101 for more information.
The default configuration listens for events coming from knativecon/demo22.
- Create a GitHub issue.
- Title:
There is a bug.
- Body:
Help me, please!
- Title:
- Observe Slack notifications in
kn-direct
- Pro: easy to use
- Pro: lightweight
- Con: no ordering guarantee
- Con: no persistence, events can be lost (e.g. long slack outage, or token expired, too many requests, etc...)
- Add a comment to the previous created GitHub issue
- Body:
sorry for the delay
- Body:
- Add another comment (don't wait too long):
- Body:
no worries
- Body:
- In
kn-direct
slack channel, observe the comments being out-of-order - In
kn-channel
slack channel, observe the comments being in-order
- Pro: event order is preserved (see notes below)
- Pro: no more too many requests
- Con: external dependency (in this example Apache Kafka)
- Con: events can still be lost (eg. slack outage)
Note: Both GitHub and the GitHub adapter don't guarantee ordering.
...
spec:
delivery:
backoffDelay: PT1S
backoffPolicy: linear
retry: 5
...
- Add a comment
so many errors!
- Wait 3s
- In
kn-direct
slack channel, observe no comments have been added - In
kn-channel
slack channel, observe the comment has been added
- Pro: less events left behind (transient errors)
- Con: some events left behind (eg. poison pill message)
...
deadLetterSink:
ref:
apiVersion: serving.knative.dev/v1
kind: Service
name: slack-dls
- Add a comment
some are permanent errors
- Wait 3s
- In
kn-direct
slack channel, observe no comments have been added - In
kn-channel
slack channel, observe no comments have been added - In
kn-dls
slack channel, observe the comment has been added
- Pro: no events left behind (infinite retries, dls high-availability, etc...)
- Create an new issue in demo22
- Observe message in
kn-broker
slack channel - Create an new issue in demo21
- No messages is posted
- Pro: only one bucket of events
- Pro: built-in filtering (CloudEvent Attributes)
- Cons: no ordering
stern slack -c user-container --template '{{color .PodColor (printf "%.15s" .PodName)}}: {{.Message}}{{printf "\n"}}'
Start tunnel
ssh -R 80:localhost:8080 localhost.run
Start reverse proxy:
cd local
go run cmd/reverse-proxy/main.go