This is an automated email from the ASF dual-hosted git repository.

pcongiusti pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit 48ac704bec5019cfb410b621aecc55a23d430056
Author: Pasquale Congiusti <[email protected]>
AuthorDate: Thu Dec 2 11:40:46 2021 +0100

    chore(examples): volumes usage
---
 examples/README.md                   |  1 +
 examples/volumes/README.md           |  3 +++
 examples/volumes/minikube-pvc.yaml   | 10 ++++++++++
 examples/volumes/pvc-consumer.groovy | 30 ++++++++++++++++++++++++++++++
 examples/volumes/pvc-producer.groovy | 33 +++++++++++++++++++++++++++++++++
 5 files changed, 77 insertions(+)

diff --git a/examples/README.md b/examples/README.md
index 0ad9cf0..b740950 100644
--- a/examples/README.md
+++ b/examples/README.md
@@ -17,6 +17,7 @@ In this section you will find the most basic examples. Useful 
to start learning
 | Open API | `Open API` support | [see examples](./openapi/)|
 | Rest | Produce/Consume `REST`ful services | [see examples](./rest/)|
 | Modeline | [Camel K modeline 
support](https://camel.apache.org/camel-k/latest/cli/modeline.html) | [see 
examples](./modeline/)|
+| Volumes | Produce/Consume files attached to a `PVC` | [see 
examples](./volumes/)|
 
 ## Component usage examples
 
diff --git a/examples/volumes/README.md b/examples/volumes/README.md
new file mode 100644
index 0000000..347199a
--- /dev/null
+++ b/examples/volumes/README.md
@@ -0,0 +1,3 @@
+# Camel K Volumes examples
+
+In this section you will find examples about usage of `Persistent Volumes`.
diff --git a/examples/volumes/minikube-pvc.yaml 
b/examples/volumes/minikube-pvc.yaml
new file mode 100644
index 0000000..fcd3bef
--- /dev/null
+++ b/examples/volumes/minikube-pvc.yaml
@@ -0,0 +1,10 @@
+kind: PersistentVolumeClaim
+apiVersion: v1
+metadata:
+  name: my-pv-claim
+spec:
+  accessModes:
+    - ReadWriteOnce
+  resources:
+    requests:
+      storage: 5Mi
\ No newline at end of file
diff --git a/examples/volumes/pvc-consumer.groovy 
b/examples/volumes/pvc-consumer.groovy
new file mode 100644
index 0000000..86799d8
--- /dev/null
+++ b/examples/volumes/pvc-consumer.groovy
@@ -0,0 +1,30 @@
+// camel-k: language=groovy
+/*
+ * 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.
+ */
+
+//
+// To run this integrations use:
+// 
+// on minikube environment, you can create a sample PVC named my-pv-claim by 
executing:
+//
+// kubectl apply -f minikube-pvc.yaml
+//
+// kamel run --volume my-pv-claim:/tmp/data pvc-consumer.groovy --dev
+//
+
+from('file:/tmp/data/')
+    .log('Consuming: ${body}')
diff --git a/examples/volumes/pvc-producer.groovy 
b/examples/volumes/pvc-producer.groovy
new file mode 100644
index 0000000..19d4877
--- /dev/null
+++ b/examples/volumes/pvc-producer.groovy
@@ -0,0 +1,33 @@
+// camel-k: language=groovy
+/*
+ * 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.
+ */
+
+//
+// To run this integrations use:
+// 
+// on minikube environment, you can create a sample PVC named my-pv-claim by 
executing:
+//
+// kubectl apply -f minikube-pvc.yaml
+//
+// kamel run --volume my-pv-claim:/tmp/data pvc-producer.groovy --dev
+//
+
+from('timer:foo')
+   .setBody()
+        .simple('Hello Camel K')
+    .log('Producing: ${body}')
+    .to('file:/tmp/data/')

Reply via email to