3 min read

Knative OSS Diaries – week #29

This past week felt like 3 months, so this blog post is more about the highlights than what actually happened. Monday and Tuesday I was still recovering from COVID 🤒, but I got some really good news:

  • I got accepted to talk at Devoxx UK with my friend Thomas Vitale, we will be talking about Knative func + Knative + Spring Cloud Functions + Spring Native. I am super excited with this opportunity as it is close to home and I will manage to finally meet and present with Thomas. I am sure that we will be building a demo out in the open and we will probably need help on testing it and suggestions on how to improve it. If you are interested get in touch!
  • A new chapter of my book Continuous Delivery for Kubernetes was released as part of the MEAP program. This chapter is about Event-Driven architectures and how Knative Eventing can help you building those when you are working with Kubernetes.
  • I got an invitation to join Whitney Lee to do a Twitch session around Knative Eventing for VMware Tanzu TV Enlightning sessions, where we will try to explain Knative Eventing concepts with some cool live drawings. If you haven't checked out her session about Dockerfiles and CloudNative Buildpacks with Cora Iberkleid you should!

Knative Func weekly

This short week I spend some time working on an example to connect different functions together, to be able to show people some low-level details about how functions work, what do you need from Knative Eventing to connect them and also some differences between different frameworks in different languages. You can find the step-by-step tutorial (still in draft) in my GitHub repository: https://github.com/salaboy/from-monolith-to-k8s/blob/master/knative/func.md .

You can find the functions projects that I've created here:

Both of these functions are doing the same, in different languages but both accept a CloudEvent (UppercaseRequestedEvent), do some processing and then return a CloudEvent (UpperCasedEvent).

If we are using Knative Eventing, we can create a Broker and some triggers to route events to our functions.

With this simple setup, every time that we put a UppercaseRequestedEvent into the Broker, both functions will receive a copy of the event, do some processing and then place it in the Broker one UpperCasedEvent each. At this point, we are not doing anything with UpperCasedEvent, we can definitely can. For this, we need a new function and trigger, so functions can be chained together by just subscribing to another function output event:

Here we chain functions based on the CloudEvents that they produce, but we also include more than one function per func project which require us to have a routing mechanism inside the project which can decide to which internal function the CloudEvent needs to be routed. If you are using Spring Cloud Functions, you can use their provided router that can be configured to inspect the CloudEvent headers and route based on their values, for example, based on the CloudEvent Type (ce-type):

spring.cloud.function.definition=functionRouter spring.cloud.function.routing-expression=headers['ce-type']

https://github.com/salaboy/fmtok8s-java-function/blob/main/src/main/resources/application.properties

To get this example working I needed to tweak a bit some of the projects involved, issues and pull requests were created 🥳:

Luckily, most of the changes in Spring Cloud Functions were included in the 3.2.2 Release.

A couple of issues and PRs to keep an eye on for the next couple of weeks:

CD Events Proposal and Knative Integration

My friend Ishan Khare is making solid progress on building a PoC with a new large use case using CD Events with Knative and Crossplane. More news about this soon, as we might be presenting together at CDCon if our proposal gets accepted!

Also, I just found this issue 🥳 CDEvents day at KubeCon EU!: https://github.com/cdfoundation/sig-events/issues/115

Repos:

See you all next week!