Skip to content

Commit

Permalink
Merge branch 'knative:main' into linkedln-page-addition
Browse files Browse the repository at this point in the history
  • Loading branch information
shivamgupta2020 authored May 28, 2024
2 parents f972d8f + 61d4aa7 commit dc34097
Show file tree
Hide file tree
Showing 7 changed files with 139 additions and 33 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/knative-go-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ on:
jobs:
test:
uses: knative/actions/.github/workflows/reusable-go-test.yaml@main
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
1 change: 1 addition & 0 deletions OWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ approvers:
reviewers:
- docs-writers
- docs-reviewers
- ux-wg-leads
1 change: 1 addition & 0 deletions blog/config/nav.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ nav:
- releases/announcing-knative-v0-3-release.md
- releases/announcing-knative-v0-2-release.md
- Articles:
- articles/knative-meets-apache-camel.md
- articles/knative-backstage-plugins.md
- articles/demystifying-activator-on-path.md
- articles/knative-eventing-vision.md
Expand Down
99 changes: 99 additions & 0 deletions blog/docs/articles/knative-meets-apache-camel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# Event Sourcing with Apache Camel K and Knative Eventing

**Author: Matthias Weßendorf, Senior Principal Software Engineer @ Red Hat**

## Why Apache Camel K?

The [Apache Camel](https://camel.apache.org/){:target="_blank"} is a popular Open Source integration framework that empowers you to quickly and easily integrate various systems consuming or producing data. With [Apache Camel K](https://camel.apache.org/camel-k/latest){:target="_blank"} the project provides a lightweight integration framework built from Apache Camel that runs natively on Kubernetes and is specifically designed for serverless and microservice architectures.

The Camel K framework also supports Knative, allowing developers to [bind](https://camel.apache.org/camel-k/latest/kamelets/kamelets-user.html#kamelets-usage-binding){:target="_blank"} any Kamelet to a Knative component. A Kamelet can act as "source" of data or alternatively as "sink". There are several Kamelets available for integrating and connecting to 3rd party services or products, such as Amazon Web Services (AWS), Google Cloud or even tradition message systems like AMQP 1.0 or JMS brokers like Apache Artemis. The full list of Kamelets can be found in the [documentation](https://camel.apache.org/camel-kamelets/latest/index.html){:target="_blank"}.

## Installation

The [Installation](https://camel.apache.org/camel-k/next/installation/installation.html) from Apache Camel K offers a few choices, such as CLI, Kustomize, OLM or Helm. Example of Helm installation:

```
$ helm repo add camel-k https://apache.github.io/camel-k/charts/
$ helm install my-camel-k camel-k/camel-k
```

Besides Camel K we also need to have Knative Eventing installed, as described in the [documentation](https://knative.dev/docs/install/yaml-install/eventing/install-eventing-with-yaml/){:target="_blank"}.

## Creating a Knative Broker instance

We are using a Knative Broker as the heart of our system, acting as an [Event Mesh](https://knative.dev/docs/eventing/event-mesh/){:target="_blank"} for both event producers and event consumers:

```yaml
apiVersion: eventing.knative.dev/v1
kind: Broker
metadata:
namespace: default
name: demo-broker
```
Now event producers can send events to it and event consumers can receive events.
## Using Kamelets as Event Sources
In order to bind a Kamelet to a Knative component, like the above broker, we are using the `Pipe` API. A Pipe allows to declaratively move data from a system described by a Kamelet _towards_ a Knative destination **or** _from_ a Knative destination to another (external) system described by a Kamelet.

Below is a `Pipe` that uses a ready-to-use `Kamelet`, a `timer-source`

```yaml
apiVersion: camel.apache.org/v1
kind: Pipe
metadata:
name: timer-source-pipe
spec:
source:
ref:
kind: Kamelet
apiVersion: camel.apache.org/v1
name: timer-source
properties:
message: Hello Knative Eventing!
sink:
properties:
cloudEventsType: com.corp.my.timer.source
ref:
kind: Broker
apiVersion: eventing.knative.dev/v1
name: demo-broker
```

The `timer-source` Kamelet is referenced as the `source` of the `Pipe` and sends periodically (default is `1000ms`) the value of its `message` property to the outbound `sink`. Here we use the Knative Broker, which accepts CloudEvents. The conversion of the message payload to CloudEvents format is done by Apache Camel for us. On the `sink` we can also define the `type` of the CloudEvent to be send.

## Using Kamelets as Event Consumers

In order to consume messages from the Knative broker, using Apache Camel K, we need a different `Pipe` where the above Broker acts as the source of events and a Kamelet is used as sink to receive the CloudEvents:

```yaml
apiVersion: camel.apache.org/v1
kind: Pipe
metadata:
name: log-sink-pipe
spec:
source:
ref:
kind: Broker
apiVersion: eventing.knative.dev/v1
name: demo-broker
properties:
type: com.corp.my.timer.source
sink:
ref:
kind: Kamelet
apiVersion: camel.apache.org/v1
name: log-sink
```

The `demo-broker` is referenced as the `source` of the `Pipe` and within the `properties` we define which CloudEvent `type` we are interested in. On a matching CloudEvent, the event is routed to the referenced `sink`. In this example we are using a simple `log-sink` Kamelet, which will just print the received data on its standard out log.


!!! note

In order for the above to work, the Apache Camel K operator will indeed create a Knative `Trigger` from the `Pipe` data, where the `spec.broker` will match our `demo-broker` and the `spec.filter.attributes.types` field will be set to `com.corp.my.timer.source` to ensure only matching CloudEvent types are being forwarded.

## Conclusion

With Apache Camel K the Knative Eventing ecosystem benefits from a huge number of predefined Kamelets for integration with a lot of services and products. Sending events from Google Cloud to AWS is possible. Knative Eventing acts as the heart of the routing, with the Knative Broker and Trigger APIs as the Event Mesh for your Kubernetes cluster!
5 changes: 5 additions & 0 deletions blog/docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ Details on the 1.14 release of the Knative project.

[Read more :octicons-arrow-right-24:](releases/announcing-knative-v1-14-release.md){ .md-button }

### Knative meets Apache Camel K!
Event Sourcing with Apache Camel K and Knative Eventing.

[Read more :octicons-arrow-right-24:](articles/knative-meets-apache-camel.md){ .md-button }

### Knative Completes Third-Party Security Audit
A third-party audit by Ada Logics found a small number of issues, including [one CVE](https://github.com/knative/serving/security/advisories/GHSA-qmvj-4qr9-v547).

Expand Down
33 changes: 17 additions & 16 deletions docs/stylesheets/extra.css
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
:root {
--md-primary-fg-color: #f3f1f2;
--home-color: #0071c7;
--md-primary-fg-color--dark: #0865AD;
--md-primary-fg-color--light: #6695CA;
--nav-item-color: #4d4d4d;
}

.md-clipboard {
color: #024c93;
color: var(--md-primary-fg-color--dark);
}

.highlight.no-copy .md-clipboard {
Expand Down Expand Up @@ -62,7 +63,7 @@ a.md-header__button.md-logo img {
}

.md-header__source {
color: #034b95;
color: var(--md-primary-fg-color--dark);
}

.md-search__input {
Expand Down Expand Up @@ -106,7 +107,7 @@ a.md-header__button.md-logo img {
.md-tabs__list li:nth-last-child(1),
.md-tabs__list li:nth-last-child(2),
.md-tabs__list li:nth-last-child(3) {
background-color: #024c93;
background-color: var(--md-primary-fg-color--dark);
color: white;
padding: 0 2em;
}
Expand All @@ -129,7 +130,7 @@ a.md-header__button.md-logo img {
}

.md-typeset a {
color: #024c93;
color: var(--md-primary-fg-color--dark);
word-break: break-word;
font-weight: 600;
}
Expand Down Expand Up @@ -291,7 +292,7 @@ a.md-header__button.md-logo img {
}

.cookienotice .buttons .ok {
background: #6695ca;
background: var(--md-primary-fg-color--light);
color: #fff;
margin-right: 15px;
padding: .25rem .5rem;
Expand Down Expand Up @@ -321,18 +322,18 @@ a.md-header__button.md-logo img {
}

.modal-dialog .md-button {
color: #024c93;
color: var(--md-primary-fg-color--dark);
}

.modal-dialog .md-button--primary {
color: white;
background-color: #024c93;
background-color: var(--md-primary-fg-color--dark);
}

/* Tame the footer and make the prev/next stand out */
.md-footer {
color: var(--md-typeset-a-color);
background-color: #024c93;
background-color: var(--md-primary-fg-color--dark);
}

.md-footer .md-footer-copyright {
Expand Down Expand Up @@ -392,13 +393,13 @@ a.md-header__button.md-logo img {
}

.testimonials h1 {
color: #024c93;
color: var(--md-primary-fg-color--dark);
margin-bottom: -26px;
}

.testimonials h2 {
font-size: 2em;
color: #024c93;
color: var(--md-primary-fg-color--dark);
margin-bottom: -12px;
}

Expand All @@ -418,12 +419,12 @@ a.md-header__button.md-logo img {
margin: auto 0;
text-align: start;
padding: 0 2em;
color: #497bb2;
color: var(--md-primary-fg-color--light);
font-weight: 500;
line-height: 1.1;
font-family: inherit;
font-size: .85rem;
border-left: #4db3d9 4.5px solid;
border-left: var(--md-default-fg-color--light) 4.5px solid;
}

.testimonials .testimonial img {
Expand All @@ -436,14 +437,14 @@ a.md-header__button.md-logo img {
}

.testimonials .testimonial.blue {
border-top: #4db3d9 2.5px solid;
border-top: var(--md-primary-fg-color--light) 2.5px solid;
padding-top: 60px;
}

.testimonials .testimonial.blue .quote {
font-size: 1.3rem;
font-weight: 500;
color: #4db3d9;
color: var(--md-primary-fg-color--light);
border: none;
}

Expand All @@ -461,7 +462,7 @@ a.md-header__button.md-logo img {
}

.testimonials a {
color: #175494;
color: var(--md-primary-fg-color--dark);
}

.testimonials .find-links {
Expand Down
31 changes: 14 additions & 17 deletions overrides/assets/stylesheets/home.css
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,7 @@ section.home-container {

body {
color: white;
background: var(--md-primary-fg-color);
background: #5063d0;
background: #0071c7;
background: var(--home-color);
background: var(--md-primary-fg-color--dark);
}

.home-container .md-button,
Expand All @@ -101,14 +98,14 @@ body {

.home-container .md-button,
.need-to-know-more-container .md-button {
background-color: #52b3dd;
border-color: #52b3dd;
background-color: var(--md-primary-fg-color--light);
border-color: var(--md-primary-fg-color--light);
}

.home-container .md-button--primary {
margin-top: 0.5rem;
background-color: #024c93;
border-color: #024c93;
background-color: var(--md-primary-fg-color--dark);
border-color: var(--md-primary-fg-color--dark);
}

h2.secondary-headline, h3.trusted-by {
Expand All @@ -117,7 +114,7 @@ h2.secondary-headline, h3.trusted-by {
}

.home-container h1 {
color: #024c93;
color: var(--md-primary-fg-color--dark);
margin-top: 1em;
margin-bottom: 0;
}
Expand Down Expand Up @@ -197,7 +194,7 @@ h2.secondary-headline, h3.trusted-by {
/* need to know more section css */
.need-to-know-more-container, .knative-components-container,
.whats-next-container {
background-color: #024c93;
background-color: var(--md-primary-fg-color--dark);
}

.need-to-know-more-container h1, .whats-next-container h1 {
Expand All @@ -214,12 +211,12 @@ h2.secondary-headline, h3.trusted-by {
/* why serverless container css */
.why-serverless-container, .trying-it-all-container {
background-color: #f3f1f2;
color: var(--md-default-fg-color--light);
color: var(--md-primary-fg-color--light);
}

.why-serverless-container h1, .trying-it-all-container h1,
.case-studies-container h1 {
color: #024c93;
color: var(--md-primary-fg-color--dark);
}

.why-serverless-container .normal-text,
Expand Down Expand Up @@ -311,7 +308,7 @@ h2.secondary-headline, h3.trusted-by {
}

.trying-it-all-container .md-typeset h2 {
color: #024c93;
color: var(--md-primary-fg-color--dark);
line-height: 1;
margin-bottom: 1rem;
}
Expand All @@ -337,7 +334,7 @@ h2.secondary-headline, h3.trusted-by {
.trying-it-all-container .md-typeset .md-button.call-to-action {
font-size: x-large;
padding: 0.5rem 2em;
background-color: #024c93;
background-color: var(--md-primary-fg-color--dark);
color: white;
margin-top: 1em;
}
Expand Down Expand Up @@ -399,7 +396,7 @@ h2.secondary-headline, h3.trusted-by {
.case-studies-container .normal-text {
text-align: start;
padding: 0 2em;
color: #497bb2;
color: var(--md-primary-fg-color--light);
font-weight: 600;
font-style: italic;
line-height: 1.1;
Expand Down Expand Up @@ -465,7 +462,7 @@ h2.secondary-headline, h3.trusted-by {

.cncf-notice-container h3 {
font-weight: bold;
color: var(--md-default-fg-color--light);
color: var(--md-primary-fg-color--light);
margin-top: 0;
}

Expand Down Expand Up @@ -518,4 +515,4 @@ footer nav.md-footer__inner {

footer .md-footer-meta .md-footer-meta__inner {
padding: 1em 0;
}
}

0 comments on commit dc34097

Please sign in to comment.