Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/guilhermecamposo/demo_camel_k

Example on how to use Camel K for a production deployment
https://github.com/guilhermecamposo/demo_camel_k

ansible camel camel-k grafana

Last synced: 18 days ago
JSON representation

Example on how to use Camel K for a production deployment

Awesome Lists containing this project

README

        

= 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

=== Ansible requirements

* https://www.ansible.com/[Ansible 3]
- https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html#control-node-requirements[Ansible's requirement]
* https://pypi.org/project/kubernetes/[Python's Kubernetes module]

=== Parameters

[options="header"]
|=======================
| 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
----