This is an automated email from the ASF dual-hosted git repository.
tsato pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git
The following commit(s) were added to refs/heads/main by this push:
new db22259ff migrate and improve database example
db22259ff is described below
commit db22259ff0f38763defc7fd61db65a0fbdbd6b53
Author: Kuthumi Pepple <[email protected]>
AuthorDate: Thu Jun 30 16:42:22 2022 +0100
migrate and improve database example
---
examples/databases/PostgresDBAutoDatasource.java | 45 ---------------------
examples/databases/README.md | 3 --
examples/databases/datasource.properties | 3 --
examples/databases/postgres-deploy/README.md | 30 --------------
.../postgres-deploy/postgres-configmap.yaml | 27 -------------
.../postgres-deploy/postgres-deployment.yaml | 47 ----------------------
.../postgres-deploy/postgres-service.yaml | 29 -------------
.../postgres-deploy/postgres-storage.yaml | 46 ---------------------
8 files changed, 230 deletions(-)
diff --git a/examples/databases/PostgresDBAutoDatasource.java
b/examples/databases/PostgresDBAutoDatasource.java
deleted file mode 100644
index 6984e33ee..000000000
--- a/examples/databases/PostgresDBAutoDatasource.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// kamel run PostgresDBAutoDatasource.java --dev
-// --build-property
quarkus.datasource.camel.db-kind=postgresql
-// -p
quarkus.datasource.camel.jdbc.url=jdbc:postgresql://postgres:5432/test
-// -p
quarkus.datasource.camel.username=postgresadmin
-// -p
quarkus.datasource.camel.password=admin123
-// -d
mvn:io.quarkus:quarkus-jdbc-postgresql:1.13.7.Final
-//
-// Alternatively, you can bundle your credentials as a secret properties file:
-//
-// kubectl create secret generic my-datasource
--from-file=datasource.properties
-//
-// kamel run PostgresDBAutoDatasource.java --dev
-// --build-property
quarkus.datasource.camel.db-kind=postgresql
-// --config secret:my-datasource
-// -d
mvn:io.quarkus:quarkus-jdbc-postgresql:1.13.7.Final
-
-import org.apache.camel.builder.RouteBuilder;
-
-public class PostgresDBAutoDatasource extends RouteBuilder {
- @Override
- public void configure() throws Exception {
- from("timer://foo?period=10000")
- .setBody(constant("select * from test"))
- .to("jdbc:camel")
- .to("log:info");
- }
-
-}
\ No newline at end of file
diff --git a/examples/databases/README.md b/examples/databases/README.md
deleted file mode 100644
index 301a077f4..000000000
--- a/examples/databases/README.md
+++ /dev/null
@@ -1,3 +0,0 @@
-# Examples showing how to connect Camel K with databases
-
-Find useful examples about how to develop a Camel K integration connecting to
a database.
\ No newline at end of file
diff --git a/examples/databases/datasource.properties
b/examples/databases/datasource.properties
deleted file mode 100644
index 587ca7fcf..000000000
--- a/examples/databases/datasource.properties
+++ /dev/null
@@ -1,3 +0,0 @@
-quarkus.datasource.camel.jdbc.url=jdbc:postgresql://postgres:5432/test
-quarkus.datasource.camel.username=postgresadmin
-quarkus.datasource.camel.password=admin123
\ No newline at end of file
diff --git a/examples/databases/postgres-deploy/README.md
b/examples/databases/postgres-deploy/README.md
deleted file mode 100644
index 11b280fbd..000000000
--- a/examples/databases/postgres-deploy/README.md
+++ /dev/null
@@ -1,30 +0,0 @@
-# How to deploy a simple Postgres DB to Kubernetes cluster
-
-This is a very simple example to show how to create a Postgres database.
**Note**, this is not ready for any production purpose.
-
-## Create a Kubernetes Deployment
-```
-kubectl create -f postgres-configmap.yaml
-kubectl create -f postgres-storage.yaml
-kubectl create -f postgres-deployment.yaml
-kubectl create -f postgres-service.yaml
-```
-## Test the connection
-
-Connection credentials available in the _postgres-configmap.yaml_ descriptor.
-
-```
-kubectl get svc postgres
-psql -h <IP> -U postgresadmin --password -p <PORT> postgresdb
-```
-## Create a test database and table
-```
-CREATE DATABASE test;
-CREATE TABLE test (data TEXT PRIMARY KEY);
-INSERT INTO test(data) VALUES ('hello'), ('world');
-```
-### Read the test database and table
-```
-SELECT * FROM test;
-```
-
diff --git a/examples/databases/postgres-deploy/postgres-configmap.yaml
b/examples/databases/postgres-deploy/postgres-configmap.yaml
deleted file mode 100644
index 76bc90118..000000000
--- a/examples/databases/postgres-deploy/postgres-configmap.yaml
+++ /dev/null
@@ -1,27 +0,0 @@
-# ---------------------------------------------------------------------------
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ---------------------------------------------------------------------------
-
-apiVersion: v1
-kind: ConfigMap
-metadata:
- name: postgres-config
- labels:
- app: postgres
-data:
- POSTGRES_DB: postgresdb
- POSTGRES_USER: postgresadmin
- POSTGRES_PASSWORD: admin123
\ No newline at end of file
diff --git a/examples/databases/postgres-deploy/postgres-deployment.yaml
b/examples/databases/postgres-deploy/postgres-deployment.yaml
deleted file mode 100644
index 25f6c8548..000000000
--- a/examples/databases/postgres-deploy/postgres-deployment.yaml
+++ /dev/null
@@ -1,47 +0,0 @@
-# ---------------------------------------------------------------------------
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ---------------------------------------------------------------------------
-
-apiVersion: apps/v1
-kind: Deployment
-metadata:
- name: postgres
-spec:
- replicas: 1
- selector:
- matchLabels:
- app: postgres
- template:
- metadata:
- labels:
- app: postgres
- spec:
- containers:
- - name: postgres
- image: postgres:10.4
- imagePullPolicy: "IfNotPresent"
- ports:
- - containerPort: 5432
- envFrom:
- - configMapRef:
- name: postgres-config
- volumeMounts:
- - mountPath: /var/lib/postgresql/data
- name: postgredb
- volumes:
- - name: postgredb
- persistentVolumeClaim:
- claimName: postgres-pv-claim
\ No newline at end of file
diff --git a/examples/databases/postgres-deploy/postgres-service.yaml
b/examples/databases/postgres-deploy/postgres-service.yaml
deleted file mode 100644
index 3496b5c45..000000000
--- a/examples/databases/postgres-deploy/postgres-service.yaml
+++ /dev/null
@@ -1,29 +0,0 @@
-# ---------------------------------------------------------------------------
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ---------------------------------------------------------------------------
-
-apiVersion: v1
-kind: Service
-metadata:
- name: postgres
- labels:
- app: postgres
-spec:
- type: NodePort
- ports:
- - port: 5432
- selector:
- app: postgres
\ No newline at end of file
diff --git a/examples/databases/postgres-deploy/postgres-storage.yaml
b/examples/databases/postgres-deploy/postgres-storage.yaml
deleted file mode 100644
index 200a73975..000000000
--- a/examples/databases/postgres-deploy/postgres-storage.yaml
+++ /dev/null
@@ -1,46 +0,0 @@
-# ---------------------------------------------------------------------------
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ---------------------------------------------------------------------------
-
-kind: PersistentVolume
-apiVersion: v1
-metadata:
- name: postgres-pv-volume
- labels:
- type: local
- app: postgres
-spec:
- storageClassName: manual
- capacity:
- storage: 5Gi
- accessModes:
- - ReadWriteMany
- hostPath:
- path: "/mnt/data"
----
-kind: PersistentVolumeClaim
-apiVersion: v1
-metadata:
- name: postgres-pv-claim
- labels:
- app: postgres
-spec:
- storageClassName: manual
- accessModes:
- - ReadWriteMany
- resources:
- requests:
- storage: 5Gi
\ No newline at end of file