Skip to content

Example on how to use Camel K for a production deployment

Notifications You must be signed in to change notification settings

GuilhermeCamposo/demo_camel_k

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Demo Camel K

Camel K demonstration on how to create REST API integrations and connect to databases.

Installation

Products utilized

  • Camel K Operator 1.10

  • Grafana Operator v5

  • OpenShift 4.13

Parameters

Parameter Example Value Definition

token

sha256~vFanQbthlPKfsaldJT3bdLXIyEkd7ypO_XPygY1DNtQ

access token for a user with cluster-admin privileges

server

https://api.my-cluster.com:6443

OpenShift cluster API URL

Running the installation

You will need an user with permission to create a project and install operators on cluster level. Export the user’s token and the server API address as environment variables, then run the following command under the ansible folder:

cd demos_camel_k/ansible/

ansible-playbook -e token=${token} -e server=${server} playbook.yml

Running the example

First you need to prepare the environment by creating the database used by the application:

# make sure you're logged in the right cluster
oc login

oc new-app --name postgresqldb -e POSTGRESQL_USER=redhat -e POSTGRESQL_PASSWORD=redhat  -e POSTGRESQL_DATABASE=camelk quay.io/gcamposo/postgresql-camelk:latest -n demo-camelk-api

now you can create the integrations following the instructions:

cd demos_camel_k/camel_k

oc create cm camel-k-api --from-file=openapi.yml

kamel run API.java

kamel run Client.java

Running Kaoto version(yaml)

oc project demo-camelk-api

kamel run API.yaml --dependency=mvn:io.quarkus:quarkus-jdbc-postgresql --dependency=camel:jdbc --dependency=camel:jslt --trait=route.enabled=true --trait=logging.json=false --trait=prometheus.enabled=true --open-api=file:openapi.yml --build-property=quarkus.datasource.camel.db-kind=postgresql --resource=file:spec.json --property=file:db.properties

Testing the integration

export ROUTE=$(oc get route api -o jsonpath='{.spec.host}')

#List messages saved in the db
curl $ROUTE/v1/camelk

About

Example on how to use Camel K for a production deployment

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published