Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Cloud-Native Integration with Camel K - DevNation London
1. A lightweight integration platform, born on Kubernetes, with
serverless superpowers
Cloud Native Integration
with Camel K
Nicola Ferraro
Principal Software Engineer
DevNation London
01/10/2019
1
2. 1. A brief history of Apache Camel
2. Camel K
3. Demo
4. Camel K and Knative
5. What’s next?
Agenda
3. About me
I work on:
- Apache Camel and Camel K
- Syndesis
- Red Hat Fuse
- Fabric8 Dev Tools
Nicola Ferraro
Principal Software Engineer at Red Hat
Twitter: @ni_ferraro
4. ● 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 (almost) anything
http://camel.apache.org/
What is Apache Camel?
13. ● 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
What is Apache Camel K?
https://github.com/apache/camel-k
15. Architecture
Dev Environment Remote Cloud
kamel CLI
Camel K
Operator
“Integration”
Custom
Resource
Running Pod
Live updates!
Fast redeploy!
Less than 1 second!
There… Where what you
want to integrate live!
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 ...
17. Features: Code Driven
from(“netty4-http://0.0.0.0:8080”)
.process(new YourBusinessLogic())
.to(“knative:channel/words”)
Camel K
OperatorThe operator reasons on your code:
Uhm, you likely
want to expose the
integration!
ingress
service
But if you don’t like the sensible defaults, you can
use traits to override its behavior:
kamel run --trait ingress.enabled=false integr.groovy
18. The operator reads your code to deploy it best:
Features: Code Driven
from(“netty4-http://0.0.0.0:8080”)
.process(new YourBusinessLogic())
.to(“knative:channel/words”)
● Dependencies
● Sources and targets
● Your business logic
deployment
Config map
service
ingress
channel
Container
image
Camel K
Operator
19. Features: Highly Customizable
There are traits (configuration options) for everything:
● affinity
● builder
● camel
● classpath
● container
● debug
● dependencies
● deployer
● deployment
● environment
● gc
● ingress
● istio
● jolokia
● knative
● knative-service
● owner
● probes
● prometheus
● rest-dsl
● route
● service
E.g. To configure
monitoring
E.g. To configure
specific knative
behaviours
20. Features: Fast Deploy (shared container images)
20
Evaluate
Run
Deploy
Build
If an IntegrationKit (~ Container Image) that
satisfies the requirement of an integration
exists, the evaluation phase can move the
integration to the deploy phase.
How? Container Images
contain only libraries.
DSL code is loaded at
runtime!
Operator Phases
23. 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
27. Camel K
Demo
Let’s build a Telegram Chat Bot in few minutes.
@camelkbot
Code: https://github.com/nicolaferraro/camel-k-chuck-bot
With circuit breakers and
retries!
29. Serverless: what does it mean?
No! It does not mean:
“No servers”
And no! It does not
mean:
“The servers of
someone else”
They call it
“Serverless” because
you don’t manage the
servers...
30. Serverless
Easy to
make fun
of...
Here’s my personal definition of “serverless”.
Serverless is a programming model based on:
...
1) Auto-scaling services/functions
(including scaling to zero)
2) Event-driven execution model
32. kind: Integration
apiVersion: camel.apache.org/v1alpha1
metadata:
name: my-integration
spec:
sources:
- name: source.groovy
content: |-
from(“knative:channel/a”)
.to(“http:my-host/api/path”)
from(“knative:channel/a”)
.to(“http:my-host/api/path”);
Camel K Operator
Knative
profile?
kind: Service
apiVersion: serving.knative.dev/v1alpha1
yes
kind: Deployment
# standard one
no
33. Kubernetes Namespace
There’s no container if no one needs it!
rest().post(“/path”)
.to(“xx:system1”)
.to(“xx:system2”)
300+ components!
System 1
System 2
Knative
Service
Camel
34. Kubernetes Namespace
A container is created only when needed!
rest().post(“/path”)
.to(“xx:system1”)
.to(“xx:system2”)
300+ components!
System 1
System 2
Knative
Service
Request Pod
Camel
44. 44
Yet to be optimized
Memory Startup time (Camel
context)
What’s next: 1 - Quarkus
45. What’s next: 2 - Push based endpoints
Pull based endpoint
from(“slack:#yourRoom”)
.to(“log:info”)
Pod
Get message
Continuously!Long
running...
Slack Server
PodCamel K
Setup webhook
Push message
Scaling
from zero!
Push based endpoint
from(“webhook:slack:#yourRoom”)
.to(“log:info”)
Slack Server
46. What’s next: 3 - Tekton // BDD // Knative
Integration with Tekton Pipelines:
● Initial implementation and tutorial:
https://camel.apache.org/camel-k/latest/tutorials/tekton/tekton.html
BDD Testing:
● How do you test Camel K integrations? We’re implementing a solution based
on BDD Testing (Cucumber Gherkin)
Knative:
● Knative is not final yet. We work together with the Knative Community
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)