Build and Deploy Cloud Native Camel Quarkus Routes

Build and Deploy Cloud Native Camel Quarkus Routes With Tekton and Knative Omar Al-Safi APACHECON @HOME Spt, 29 th – Oct. 1 st 2020

About Omar Al-Safi ● ● Open Source Software Engineer at Talend Apache Camel PMC and Commiter Based in Germany Twitter: @omarsmak Github: omarsmak

Agenda ● What is Cloud Native? ● Introduction to Graal. VM Native Image. ● Introduction to Camel Quarkus. ● Introduction to Knative. ● Introduction to Tekton. ● Put it all together with a Demo.

What is Cloud Native?

What is Cloud Native? • Open source stack.

What is Cloud Native? • Open source stack. • Microservices in containers.

What is Cloud Native? • Open source stack. • Microservices in containers. • Dynamically ocheratsted.

What is Cloud Native? • Open source stack. • Microservices in containers. • Dynamically ocheratsted. • Optimized resource utilization.

Introduction To Native Image

What is Graal. VM

What is Graal. VM • Java VM based on Hot. Spot/Open. JDK.

What is Graal. VM • Java VM based on Hot. Spot/Open. JDK. • High performance runtime.

What is Graal. VM • Java VM based on Hot. Spot/Open. JDK. • High performance runtime. • Ahead-of-time (AOT) compilation through Native Image.

What is Graal. VM • Java VM based on Hot. Spot/Open. JDK. • High performance runtime. • Ahead-of-time (AOT) compilation through Native Image. • Ideal for Microservices and Cloud Native applications.

What is Graal. VM • Java VM based on Hot. Spot/Open. JDK. • High performance runtime. • Ahead-of-time (AOT) compilation through Native Image. • Ideal for Microservices and Cloud Native applications. • Multiple languages interoperability.

What is Graal. VM • Java VM based on Hot. Spot/Open. JDK. • High performance runtime. • Ahead-of-time (AOT) compilation through Native Image. • Ideal for Microservices and Cloud Native applications. • Multiple languages interoperability. • Includes as well a Just-in-time (JIT) mode.

Graal. VM Architecture

AOT vs JIT * From: Thomas Wuerthinger performance benchmarks https: //twitter. com/thomaswue/status/1145603781108928513

Graal. VM Native Image Utility Input Output Application Ahead-of-Time Compilation Libraries Point-to Analysis JDK Run Initializations Substrate VM Heap Snapshotting Native executable Image Heap Writing

Introduction To

Java Density Problem Node Traditional Cloud-Native Java Stack Node. JS Go Go Go Node. JS Go Go Go CONTAINER ORCHESTRATION * From Apache Camel 3: the next generation of enterprise integration by Claus Ibsen & Andrea Cosentino

Java Fast Scaling Problem SCALE-UP SCALE-DOWN SCALE-TOZERO * From Apache Camel 3: the next generation of enterprise integration by Claus Ibsen & Andrea Cosentino

What is Quarkus

What is Quarkus • Kubernetes-native full stack Java framework.

What is Quarkus • Kubernetes-native full stack Java framework. • Container first.

What is Quarkus • Kubernetes-native full stack Java framework. • Container first. • Besides Open. JDK Hot. Spot, utilizes Graal. VM Native Image very efficiently.

Quarkus Performance

What is Camel Quarkus?

What is Camel Quarkus? • A runtime to run Apache Camel components on top of Quarkus.

What is Camel Quarkus? • A runtime to run Apache Camel components on top of Quarkus. • Utilizes all performance optimizations brought by Quarkus.

What is Camel Quarkus? • A runtime to run Apache Camel components on top of Quarkus. • Utilizes all performance optimizations brought by Quarkus. • Allows Camel routes to be compiled natively using Graal. VM Native Image.

Performance Comparison from(timer("foo"). period(1000)). log("Hello World From Apache. Con");

Performance Comparison Camel Spring. Boot Memory used (RSS) ~400 MB Startup time ~ 3 s

Performance Comparison Camel Spring. Boot Camel Quarkus Memory used (RSS) ~400 MB Memory used (RSS) ~200 MB Startup time ~ 3 s Startup time ~ 0. 9 s

Performance Comparison Camel Spring. Boot Camel Quarkus Native Memory used (RSS) ~400 MB Memory used (RSS) ~200 MB Memory used (RSS) ~30 MB Startup time ~ 3 s Startup time ~ 0. 9 s Startup time ~ 0. 3 s

Introduction To Knative

What is Knative?

What is Knative? • A simplified set of tools to manage containers on Kubernetes.

What is Knative? • A simplified set of tools to manage containers on Kubernetes. • Allows developers to focus on coding.

What is Knative? • A simplified set of tools to manage containers on Kubernetes. • Allows developers to focus on coding. • Built as Kubernetes extension with CRD. • Utilizes Kubernetes goodies. • Integrates with other non-Knative services.

What is Knative?

Knative Components Serving Deploy your application to K 8 s Eventing Common events infrastructure between services

Knative Serving Knative Service Revision 1 Config ● Deploy app as pod with revision

Knative Serving Knative Service Route User Revision 1 Config ● Deploy app as pod with revision. ● Network auto-setup.

Knative Serving Knative Service Route User Revision 1 1 Revision Config ● Deploy app as pod with revision. ● Network auto-setup. ● Revision are scaled up/down ○ Based on load ○ Down to zero

Knative Serving Knative Service Route Revision 1 1 Revision Config User Revision 2 1 Revision Config ● Deploy app as pod with revision. ● Network auto-setup. ● Revision are scaled up/down ● ○ Based on load ○ Down to zero Create revisions and auto migrate

Knative Serving Knative Service Route 90% Revision 1 1 Revision Config User 10% Revision 2 1 Revision Config ● Deploy app as pod with revision. ● Network auto-setup. ● Revision are scaled up/down ○ Based on load ○ Down to zero ● Create revisions and auto migrate ● Traffic splitting

Knative Serving Knative Service Route 90% Revision 1 1 Revision Config User 10% Route Tag Revision 2 1 Revision 3 1 Revision Config ● Deploy app as pod with revision. ● Network auto-setup. ● Revision are scaled up/down ○ Based on load ○ Down to zero ● Create revisions and auto migrate ● Traffic splitting ● Dedicated URLs to Revisions which allows other uses cases like blue/green deployment. Tester * From Stop Calling Knative Serverless! - Doug Davis, IBM

Knative Eventing Event Source publish Event Source ● Event Source is K 8 s resource producing events as Cloud. Event via HTTP POST.

Knative Eventing Event Source publish Adapter Event Source ● Event Source is K 8 s resource producing events as Cloud. Event via HTTP POST. ○ Adapter often used to convert events into Cloud. Events.

Knative Eventing Event Source publish Adapter Broker Event Source ● Event Source is K 8 s resource producing events as Cloud. Event via HTTP POST. ○ Adapter often used to convert events into Cloud. Events. ● Broker is central events hub, e. g: Kafka.

Knative Eventing ingress Trigger Event Source publish Adapter Broker ingress Trigger Event Source ● Event Source is K 8 s resource producing events as Cloud. Event via HTTP POST. ○ Adapter often used to convert events into Cloud. Events. ● Broker is central events hub, e. g: Kafka. ● Trigger subscribe events from a Broker.

Knative Eventing filter= ingress Trigger Event Source publish Adapter Broker ingress Trigger filter= Event Source ● Event Source is K 8 s resource producing events as Cloud. Event via HTTP POST. ○ Adapter often used to convert events into Cloud. Events. ● Broker is central events hub, e. g: Kafka. ● Trigger subscribe events from a Broker. ○ Filter for specific events.

Knative Eventing filter= subscribe ingress Trigger Event Source Service subscribe publish Adapter Broker ingress Trigger filter= Event Source ● Event Source is K 8 s resource producing events as Cloud. Event via HTTP POST. ○ Adapter often used to convert events into Cloud. Events. ● Broker is central events hub, e. g: Kafka. ● Trigger subscribe events from a Broker. ○ Filter for specific events. ○ Send events to Service as Cloud. Event via HTTP POST. Service

Introduction To

What is Tekton?

What is Tekton? • A Kubernetes native framework for creating continuous integration and delivery (CI/CD) pipelines.

What is Tekton? • A Kubernetes native framework for creating continuous integration and delivery (CI/CD) pipelines. • It used to be part of Knative tools.

What is Tekton? • A Kubernetes native framework for creating continuous integration and delivery (CI/CD) pipelines. • It used to be part of Knative tools. • Just like Knative, built as Kubernetes extension with Custom Resource Definition (CRD).

Tekton Building Blocks ● Step is the smallest block, contains images, commands, arguments and corresponds to Step Container a K 8 s container.

Tekton Building Blocks ● Step is the smallest block, contains images, Task commands, arguments and corresponds to Node a K 8 s container. Step Container . . . Step ● Task is a sequence of steps that run in sequential order and on the same node.

Tekton Building Blocks Pipeline ● Step is the smallest block, contains images, Task commands, arguments and corresponds to Node a K 8 s container. Step Container . . . ● Task is a sequence of steps that run in sequential order and on the same node. Step . . . Task * From Next Generation CI/CD with GKE and Tekton (Cloud Next '19) ● Pipeline contains multiple tasks, sequential or parallel. Executes tasks on different nodes.

Put it all together with a Demo

Demo Overview • Camel route with REST component on top of Camel Quarkus runtime. • Trigger the Tekton pipeline using an Event. Listener. • Build the Camel route natively using Graal. VM Native Image in Tekton using Kaniko. • Deploy the route from Tekton pipeline as Knative Service. • The route is accessible through HTTP/GET.

Demo Overview Pipeline Build image from git source trigger Camel Quarkus Rest Kn Service Event. Listener Deploy service to Knative HTTP GET /hello? q= User


Any Questions ? Demo project: https: //github. com/omarsmak/camel-talkexamples/tree/master/camel-quarkus-rest
- Slides: 67