2. Who we are...
Andrea Tarocchi:
● Open source enthusiast
● Apache Camel committer
● Software Engineer at Red Hat
● Twitter: @valdar
● Blog: http://blog.valdar.it/
Nicola Ferraro
● Open source enthusiast
● Apache Camel PMC Member
● Principal Software Engineer at Red Hat
● Twitter: @ni_ferraro
● Blog: https://www.nicolaferraro.me
3. Agenda
● What is Apache Camel K
● Kubernetes Basics
● Camel K Operator
● DEMO
● Camel K anatomy
● Status & future work
5. What is Apache Camel?
● The swiss knife of integration
● >10 years of development - still one of the most active Apache projects
● Java-based integration framework that can be installed on multiple runtimes:
Spring-Boot, Karaf, EAP, Standalone (in a Java Main)
● Based on Enterprise Integration Patterns
● Supports 300+ components
● Uses a powerful DSL
● Can integrate anything
This is just to recap…
We assume you already
know Camel!
6. What is Apache Camel K?
● A platform for directly running integrations on Openshift and
Kubernetes
● Based on (ex Core OS) operator-sdk
● A community-driven project
● A subproject of Apache Camel started on August 31st, 2018
https://github.com/apache/camel-k
7. How?
// Message from a bot transformed and ingested into a kafka
topic, then sent to an API
from(“telegram:bots/bot-id”)
.transform()...
.to(“kafka:topic”)
from(“kafka:topic”)
.to(“http:my-host/api/path”)
1. Create a integration file (Java, Groovy, Kotlin, JS, XML…)
$ kamel run integration.groovy
2. Run it
3. It runs on Kubernetes
Camel DSL, based on
EIPs...
Well… the “kamel” CLI is
optional!
9. Kubernetes Basics (Intro)
De-facto standard for container orchestration.
Deployment
Pod
Container
Sidecar
Containers
replicas=n
Service
User
View
10. Kubernetes Basics (Intro)
De-facto standard for container orchestration.
Deployment
Pod
Container
Sidecar
Containers
replicas=n
Abstracts
Physical
Machines
Load
Balancers
Service
User
View
Physical
View
15. Architecture
Dev Environment Cloud
kamel CLI
Camel K
Operator
“Integration”
Custom
Resource
Running
Pod
Live
updates!
Fast redeploy!
Less than 1 second!
Tailored for cloud-native development experience
16. “Integration” Custom Resource
kind: Integration
apiVersion: camel.apache.org/v1alpha1
metadata:
name: my-integration
spec:
sources:
- name: source.groovy
content: |-
from(“telegram:...”)
.transform()...
.to(“kafka:...”)
from(“telegram:bots/bot-id”)
.transform()...
.to(“kafka:topic”);
from(“kafka:topic”)
.to(“http:my-host/api/path”);
This is what people
care about: Camel DSL
Camel K Operator
1. Choose a runtime
2. Scaffold a project
3. Add boilerplate
4. Add dependencies
5. Create container image
6. Create Kubernetes
resources for deployment
kamel CLI
or others ...
18. Classic scenario:
“When someone uploads a file on Dropbox, I want to upload that file also to a FTP location, publish some file details on a Slack channel and
also send a confirmation email to a specific user”
Our web-based integration platform (Syndesis).
Target: Citizen Integrators
Features:
● Multiple connectors built from Camel
components
● Few clicks to define a integration
● Graphical data mapping capabilities
● Design, expose or consume REST API
● Integrated with Apicur.io “Apicurito” for API
design
● Integrated with 3-scale for API management
25. Operator
25
An operator is "traditionally" defined as software that
encodes a domain knowledge and extends Kubernetes
API through extensions Custom Resource Definition
(CRD) enabling users to create, deploying and manage
Kubernetes applications.
In Camel K we have leveraged this pattern to the next
level and the Camel K Operator is the intelligence that
coordinates all the moving parts:
- It adapts the behavior of the platform to the
environment in which it runs
- It understands the integration code and handles
the workflow to determine dependencies, to build
and deploying your application
- It scaffolds reusable resources
26. Operator Pattern
26
The Operator:
- Create a WATCH on CR Objects
- Evaluate difference of the current state
versus the desired state
- Act
Observe
Evaluate
Reconcile
27. Hierarchical Operator Pattern*
27
Camel K defines 3 main API:
- Integration
- IntegrationKit
- Build
To manage the interactions between them, a
simple reconcile method was not enough and
we ended up with a sort of “Hierarchical
Operator Pattern” where the reconcile phase
may trigger sub operators and supervises them.
Integration
Evaluate
Reconcile
Integration
Kit
Evaluate
Reconcile
* Patent pending :)
29. Integration State Machine
29
The Evaluate phase has the following
responsibilities:
- pre-flight checks
- enrich the integration with defaults values
if not provided by the user
- configure the integration according to the
target platform/environment
- monitor the integration for changes once
it is in its running phase
Evaluate
Run
Deploy
Build
30. Integration State Machine
30
The Build phase has the following
responsibilities:
- instantiates an integration kit sub
operator and monitor it
- assemble a container image with the
dependencies required by the integration
- publish the integration to a container
image registryRun
Deploy
Build
Evaluate
Assemble
Publish
Integration Kit
Evaluate
31. Integration State Machine
31
The Deploy phase owns the following
responsibilities:
- generates deployment resources
according to the platform i.e. :
- deployment
- knative
service/channel/subscription
- service
- ingress/route
- attach sources and resources to the pod
using configmap/secret volume mount
Run Build
Deploy
Evaluate
37. Optimizations: Integration State Machine
37
Evaluate
Run
Deploy
Build
If an IntegrationKit that satisfies the
requirement of an integration exists, the
evaluation phase can move the integration to
the deploy phase.
39. Traits
39
Traits are high level named features of Camel K
that can be enabled/disabled or configured to
customize the behavior of the final integration.
40. 40
kamel run --trait route.enabled=true
Camel K provide sensible defaults for all the
traits, taking into account the integration code
and the details of the target platform where the
integration is going to run into.
In some case user need to provide some hints to
the operator in order to make it working
properly i.e. the operator cannot determine if a
service need to be exposed, for such case you
need to manually enable the route trait:
Traits
42. Runtimes - Goals
● set up routes
● set up properties
● set up logging
● set up context
42
43. Runtimes - Languages
43
Language Technology Notes Native
Java jOOR Compile at runtime Maybe
Groovy GroovyScript
Engine
No
Kotlin Kotlin Script
Runtime
Maybe
JavaScript Graal JS Yes
XML Jaxb Support for route fragments only Yes
YAML Jackson
YAML
Huge hack Yes
45. Tomorrow session camel k + knative:
Apache Camel K: connect your Knative
serverless applications with everything else
Thursday, 12th Sep, 09:00 - 09:50
Laughlin 2 (this very same room!)
46. Future Work
● BDD testing
● Support the new Knative Eventing Broker/Trigger model
● Better support Quarkus (https://github.com/apache/camel-quarkus)
● Integrate with Tekton pipelines
● Enable webhook-based components available in Camel 3
(https://github.com/apache/camel/blob/master/components/camel-telegr
am/src/main/docs/telegram-component.adoc#webhook-mode)
47. We love contributions!
● Project repo: https://github.com/apache/camel-k
● list of tasks to start from
(pick anyone with “easy fix - newcomers” label on them)
50. Camel K
● The swiss knife of integration
● >10 years of development - still one of the most active Apache projects
● Java-based integration framework that can be installed on multiple runtimes:
Spring-Boot, Karaf, EAP, Standalone
● The cornerstone of Red Hat Fuse
● Based on Enterprise Integration Patterns
● Supports 300+ components
● Uses a powerful DSL
● Can integrate anything
http://camel.apache.org/
What is Apache Camel?
50
58. Camel K
Camel Routes with Splitter
from("file:inbox")
.split(body().tokenize("n"))
59. Camel K
Camel Routes with Splitter
from("file:inbox")
.split(body().tokenize("n"))
.marshal(customToXml)
.to("activemq:line"); Custom data
transformation