Apache Camel K

~1 sec. build and deploy
on Kubernetes

 

Peter Palaga

@ppalaga

Peter Palaga

  • Senior engineer at Red Hat Middleware
    • Red Hat Fuse on EAP (WildFly Camel)
    • JBoss EAP (WildFly)
  • Author of
    • srcdeps - source dependencies for Maven and Gradle
    • Maven and Gradle plugins for .editorconfig

Agenda

  • Apache Camel intro
  • Apache Camel K

What is Apache Camel?

http://camel.apache.org/

Since 2007

Huge community

  • 466 contributors
  • ~2500 stars on Github
  • ~3300 forks on Github
  • >1000 subscribers on users mailing list
Apache Camel is...

An integration library



Systems integration
Apache Camel is based on

Enterprise Integration Patterns (EIP)

EIPs
https://www.enterpriseintegrationpatterns.com/
Apache Camel can...

integrate anything

through its

~280 components

ahc ahc-ws amqp apns as2 asn1 asterisk atmos atmosphere-websocket atom atomix avro aws aws-xray azure bam barcode base64 beanio beanstalk bean-validator bindy blueprint bonita boon box braintree cache caffeine cassandraql castor cdi chronicle chunk cmis cm-sms coap cometd consul context corda core-osgi core-xml couchbase couchdb crypto crypto-cms csv cxf cxf-transport digitalocean disruptor dns docker dozer drill dropbox eclipse ehcache ejb elasticsearch elasticsearch5 elasticsearch-rest elsql etcd eventadmin exec facebook fastjson fhir flatpack flink fop freemarker ftp ganglia geocoder git github google-bigquery google-calendar google-drive google-mail google-pubsub google-sheets gora grape groovy groovy-dsl grpc gson guava-eventbus guice hawtdb hazelcast hbase hdfs hdfs2 headersmap hessian hipchat hl7 http http4 http-common hystrix ibatis ical iec60870 ignite infinispan influxdb ipfs irc ironmq jackson jacksonxml jasypt javaspace jaxb jbpm jcache jclouds jcr jdbc jetty jetty9 jetty-common jgroups jibx jing jira jms jmx johnzon jolt josql jpa jsch jsonpath json-validator jt400 juel jxpath kafka kestrel krati kubernetes kura ldap ldif leveldb linkedin lra lucene lumberjack lzf mail master metrics micrometer milo mina mina2 mllp mongodb mongodb3 mongodb-gridfs mqtt msv mustache mvel mybatis nagios nats netty netty4 netty4-http netty-http nsq ognl olingo2 olingo4 openshift openstack opentracing optaplanner paho paxlogging pdf pgevent printer protobuf pubnub quartz quartz2 quickfix rabbitmq reactive-streams reactor restlet rest-swagger ribbon rmi routebox rss ruby rx rxjava2 salesforce sap-netweaver saxon scala schematron scr script service servicenow servlet servletlistener shiro sip sjms sjms2 slack smpp snakeyaml snmp soap solr spark spark-rest splunk spring spring-batch spring-boot spring-cloud spring-cloud-consul spring-cloud-netflix spring-cloud-zookeeper spring-integration spring-javaconfig spring-ldap spring-redis spring-security spring-ws sql ssh stax stomp stream stringtemplate swagger swagger-java syslog tagsoup tarfile telegram test test-blueprint test-cdi testcontainers testcontainers-spring test-karaf testng test-spring thrift tika twilio twitter undertow univocity-parsers urlrewrite velocity vertx weather web3j websocket wordpress xchange xmlbeans xmljson xmlrpc xmlsecurity xmpp xstream yammer yql zendesk zipfile zipkin zookeeper zookeeper-master

Filetypes:

  • Plaintext, XML, HTML, CSV, JSON, ZIP, ...
  • Apache Tika (MS Office, OpenDocument, ...)

Protocols:

  • AMQP, DNS, FTP, HTTP, IRC, SSH, TCP/UDP, ...
  • REST, GRPC, git, ...
  • IoT: CoAP, MQTT, PubNub

Public Clouds:   

  • AWS: S3, SQS, Kinesis, ...
  • Azure: Blob, Queue, ...
  • Google: BigQuery, PubSub

Enterprise:

  • Caches: Hazelcast, Infinispan, Redis, ...
  • Cassandra, MongoDB, Kafka
  • JDBC, SQL, JPA, CDI, EJB, JMS, JMX, OpenTracing, OptaPlanner, Syslog,

APIs:

  • Social: Facebook, Twitter, LinkedIn
  • Box, Dropbox, Google Calendar/Drive/Mail/Docs
  • Salesforce, SAP, ServiceNow, FHIR
  • GitHub, Jira, Telegram

Misc:

  • Barcode
  • Base64, JsonPath, Freemarker, Groovy, Mustache, Ruby
  • Docker, etcd, Kubernetes, OpenShift,
Routes defined via

Domain Specific Languages (DSL)

Java XML
class MyCamelRouter extends RouteBuilder {
  @Override
  public void configure() throws Exception {
    from("twitter-search:"
        + "word1,word2")
      .log("Got a tweet: ${body}")
      .to("telegram:bots");
  }
}
<routes
  xmlns="http://camel.apache.org/schema/spring">
  <route id="my-route">
    <from uri="twitter-search:word1,word2"/>
    <log message="Got a tweet: ${body}"/>
    <to uri="telegram:bots"/>
  </route>
</routes>

Groovy, Scala, Kotlin, ...

Apache Camel is...

Runnable on


Spring Boot Spring Boot Apache Karaf WildFly
Standalone WildFly

Apache Camel 3

Overall goals:

  • ~September 2019
  • Tidy up APIs & cleanup of technical debt
  • Backwards compatible (as much as possible)
  • Light-weight & modular camel-core
  • Fluent Builder Endpoint configuration (Java & XML)
  • New Cloud EIP Patterns
  • Java 11 support
  • New website/documentation
  • Quarkus extensions
  • Camel-K
Apache Camel

Demo

Twitter → Telegram forwarding

  • Tweets containing Camel and #VDBUH2019
  • Telegram bot: camelDemoBot
Plz. tweet something about Camel and #VDBUH2019

Traditional way

of deploying Apache Camel on Kubernetes/OpenShift:
  • fabric8-maven-plugin to build the image
  • 1+ min to build and deploy a simple app
Plz. tweet something about Camel and #VDBUH2019
Apache Camel

New areas of interest

  • Low code/no code integrations: Syndesis
  • A "glue" for Serverless Functions


⮤ characterized by:

  • Fast prototyping
  • Simple or no business logic
  • Low memory and CPU usage esp. during startup
Plz. tweet something about Camel and #VDBUH2019

Welcome

Apache Camel K!

For fast development of simple routes

Subproject of Apache Camel
since Aug. 31st. 2018

Camel K demo

Camel K internals

Kubernetes Operators

  • An Application Management concept
  • Does what a human operator would have to do
    • Based on declarative input


Introduced around Kubernetes 1.7, https://coreos.com/operators
A Kubernetes Operator

How it works

Via Kubernetes API:

  • Monitors the cluster
  • Reacts:
    • Add/remove/modify resources (pods/services/custom CRDs)
    • Scale up/down
    • Call endpoints of the running applications
  • Implements custom logic
Kubernetes

Custom Resource Definitions (CRD)

Built-in resources
  • pods, services, ...
  • oc create, oc get, oc delete
CRDs
  • Extend the cluster model
  • oc create, oc get, oc delete
  • Declarative input for operators

Camel K Operator

Camel K internals
Apache Camel K

Image resolution (1/2)

Choose IntegrationRuntime based on DSL used

  • Generic JVM (covers JavaScript)
  • Java
    } Sets of
    depen-
    dencies
  • Groovy
  • Kotlin
  • Spring Boot
  • XML
Apache Camel K

Image resolution (2/2)

  • Based on the used Camel components
    • Either takes an available Image (buildless deploy)
    • Or builds a new image

  • Route definition not a part of the image
    • Either takes an available Image (buildless deploy)
    • Mounted to the container as a ConfigMap

Camel K limitations

  • Not a 100% replacement for traditional Apache Camel
  • No built in means for testing

Apache Camel K wrap up

  • Operator based Kubernetes runtime for Camel
  • Fast prototyping
  • Routes with simple/no business logic
Apache Camel K

Project info



Feedback and contributions welcome!