Skip to content

Instantly share code, notes, and snippets.

Avatar
💩
hacking hacking hacking!

Matthias Wessendorf matzew

💩
hacking hacking hacking!
View GitHub Profile
View strimzi-tls.sh
#!/usr/bin/env bash
set -e
# Turn colors in this script off by setting the NO_COLOR variable in your
# environment to any value:
#
# $ NO_COLOR=1 test.sh
NO_COLOR=${NO_COLOR:-""}
if [ -z "$NO_COLOR" ]; then
View From_CloudEvent_to_Kafka.md

Stream Knative HTTP CloudEvents into Apache Kafka

With Knative eventing, you can use a source, to receive events for a 3rd party system, and have them sent as CloudEvents to a HTTP webserver, like:

apiVersion: sources.knative.dev/v1alpha2
kind: PingSource
metadata:
  name: ping-source
spec:
View logs.md
 k logs -f -l serving.knative.dev/service=map-display -c user-container -n debezium-knative-demo

2020-05-28 10:49:32,396 INFO  [io.sma.rea.mes.ext.MediatorManager] (main) Deployment done... start processing
2020-05-28 10:49:32,405 INFO  [io.sma.rea.mes.imp.ConfiguredChannelFactory] (main) Found incoming connectors: [smallrye-kafka]
2020-05-28 10:49:32,406 INFO  [io.sma.rea.mes.imp.ConfiguredChannelFactory] (main) Found outgoing connectors: [smallrye-kafka]
2020-05-28 10:49:32,406 INFO  [io.sma.rea.mes.imp.ConfiguredChannelFactory] (main) Stream manager initializing...
2020-05-28 10:49:32,409 INFO  [io.sma.rea.mes.ext.MediatorManager] (main) Initializing mediators
2020-05-28 10:49:32,410 INFO  [io.sma.rea.mes.ext.MediatorManager] (main) Connecting mediators
### Starting up ###
View Broker_as_non_admin.md

Creating Knative default Broker as non admin user

Create a consuming service:

apiVersion: serving.knative.dev/v1
kind: Service
metadata:
  name: broker-display1
spec:
View error.json
{"level":"error","ts":"2020-04-03T11:56:12.512Z","logger":"mt-broker-controller","caller":"namespace/reconciler.go:195","msg":"returned an error","knative.dev/traceid":"65900ed8-0a9a-481b-95f0-73500d6e68e6","knative.dev/key":"default","targetMethod":"ReconcileKind","error":"broker: brokers.eventing.knative.dev \"default\" is forbidden: cannot set blockOwnerDeletion if an ownerReference refers to a resource you can't set finalizers on: RBAC: clusterrole.rbac.authorization.k8s.io \"knative-eventing-channel-broker-controller\" not found, <nil>","stacktrace":"knative.dev/eventing/vendor/knative.dev/pkg/client/injection/kube/reconciler/core/v1/namespace.(*reconcilerImpl).Reconcile\n\tknative.dev/eventing/vendor/knative.dev/pkg/client/injection/kube/reconciler/core/v1/namespace/reconciler.go:195\nknative.dev/eventing/vendor/knative.dev/pkg/controller.(*Impl).processNextWorkItem\n\tknative.dev/eventing/vendor/knative.dev/pkg/controller/controller.go:394\nknative.dev/eventing/vendor/knative.dev/pkg/controller.(*Imp
View some-random-data.json
{"avg":7.5,"count":235,"icon":"🌳🌳🌳","latitude":59.9,"longitude":10.8,"max":52.0,"min":-40.8,"stationId":8,"stationName":"Oslo","sum":1766.6,"ts":"2020-02-27T17:09:23.879Z","value":22.9}
{"avg":12.6,"count":263,"icon":"⛄⛄⛄","latitude":53.6,"longitude":10.0,"max":52.1,"min":-23.5,"stationId":1,"stationName":"Hamburg","sum":3325.8999999999987,"ts":"2020-02-27T17:09:26.843Z","value":-5.8}
{"avg":10.8,"count":227,"icon":"🌴🌴🌴","latitude":50.8,"longitude":-1.1,"max":51.9,"min":-29.1,"stationId":7,"stationName":"Porthsmouth","sum":2440.9000000000005,"ts":"2020-02-27T17:09:28.844Z","value":31.0}
{"avg":5.2,"count":224,"icon":"🌱🌱🌱","latitude":52.9,"longitude":-3.9,"max":51.5,"min":-29.0,"stationId":2,"stationName":"Snowdonia","sum":1170.0,"ts":"2020-02-27T17:09:29.844Z","value":5.2}
{"avg":12.6,"count":264,"icon":"🌱🌱🌱","latitude":53.6,"longitude":10.0,"max":52.1,"min":-23.5,"stationId":1,"stationName":"Hamburg","sum":3332.199999999999,"ts":"2020-02-27T17:09:30.844Z","value":6.3}
{"avg":20.2,"count":219,"icon":"🌱🌱🌱","la
View From_Cron_to_Ping.md

Migrating to the PingSource

With the release of 0.13 the CronJobsource is deprecated, and should be converted to the PingSource

Here is an example of a CronJobSource that delivers messages to a given sink:

apiVersion: sources.eventing.knative.dev/v1alpha1
kind: CronJobSource
metadata:
  name: cronjob-source
View Containersource_migration.md

Migration from ContainerSource to SinkBinding

With the Knative 0.13 release the ContainerSource is deprecated, and it is highly to use the SinkBinding instead.

From ContainerSource ...

With older releases (up to 0.12) the ContainerSource usage was like:

apiVersion: sources.eventing.knative.dev/v1alpha1
View broker.log
k logs -f broker-controller-687c699d9f-6gt6r -nknative-eventing
2020/02/27 07:48:17 Registering 4 clients
2020/02/27 07:48:17 Registering 2 informer factories
2020/02/27 07:48:17 Registering 10 informers
2020/02/27 07:48:17 Registering 3 controllers
{"level":"info","ts":"2020-02-27T07:48:17.683Z","caller":"logging/config.go:108","msg":"Successfully created the logger."}
{"level":"info","ts":"2020-02-27T07:48:17.683Z","caller":"logging/config.go:109","msg":"Logging level set to info"}
{"level":"info","ts":"2020-02-27T07:48:17.683Z","logger":"broker-controller","caller":"profiling/server.go:59","msg":"Profiling enabled: false","commit":"598d52a"}
{"level":"info","ts":"2020-02-27T07:48:17.688Z","logger":"broker-controller","caller":"sharedmain/main.go:194","msg":"broker-controller will not run in leader-elected mode","commit":"598d52a"}
{"level":"info","ts":"2020-02-27T07:48:17.688Z","logger":"broker-controller.knative-eventing-namespace-controller","caller":"namespace/controller.go:77","msg":"Setting up event
View kafka-channel.yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
contrib.eventing.knative.dev/release: "v0.12.3"
duck.knative.dev/addressable: "true"
name: kafka-addressable-resolver
rules:
- apiGroups:
- messaging.knative.dev