aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bootstrap/pv-template.yml45
-rwxr-xr-xbootstrap/pv.sh11
-rw-r--r--bootstrap/pvc.yml45
3 files changed, 101 insertions, 0 deletions
diff --git a/bootstrap/pv-template.yml b/bootstrap/pv-template.yml
new file mode 100644
index 0000000..73b4f99
--- /dev/null
+++ b/bootstrap/pv-template.yml
@@ -0,0 +1,45 @@
+---
+apiVersion: v1
+kind: PersistentVolume
+metadata:
+ name: datadir-kafka-0
+ labels:
+ app: kafka
+ petindex: "0"
+spec:
+ accessModes:
+ - ReadWriteOnce
+ capacity:
+ storage: 100Mi
+ hostPath:
+ path: /tmp/k8s-data/datadir-kafka-0
+---
+apiVersion: v1
+kind: PersistentVolume
+metadata:
+ name: datadir-kafka-1
+ labels:
+ app: kafka
+ petindex: "1"
+spec:
+ accessModes:
+ - ReadWriteOnce
+ capacity:
+ storage: 100Mi
+ hostPath:
+ path: /tmp/k8s-data/datadir-kafka-1
+---
+apiVersion: v1
+kind: PersistentVolume
+metadata:
+ name: datadir-kafka-2
+ labels:
+ app: kafka
+ petindex: "2"
+spec:
+ accessModes:
+ - ReadWriteOnce
+ capacity:
+ storage: 100Mi
+ hostPath:
+ path: /tmp/k8s-data/datadir-kafka-2
diff --git a/bootstrap/pv.sh b/bootstrap/pv.sh
new file mode 100755
index 0000000..78bf7f5
--- /dev/null
+++ b/bootstrap/pv.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+echo "Note that in for example GKE a PetSet will have PersistentVolume(s) and PersistentVolumeClaim(s) created for it automatically"
+
+dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )"
+path="$dir/data"
+echo "Please enter a path where to store data during local testing: ($path)"
+read newpath
+[ -n "$newpath" ] && path=$newpath
+
+cat bootstrap/pv-template.yml | sed "s|/tmp/k8s-data|$path|" | kubectl create -f -
diff --git a/bootstrap/pvc.yml b/bootstrap/pvc.yml
new file mode 100644
index 0000000..f1dac65
--- /dev/null
+++ b/bootstrap/pvc.yml
@@ -0,0 +1,45 @@
+---
+kind: PersistentVolumeClaim
+apiVersion: v1
+metadata:
+ name: datadir-kafka-0
+spec:
+ accessModes:
+ - ReadWriteOnce
+ resources:
+ requests:
+ storage: 100Mi
+ selector:
+ matchLabels:
+ app: kafka
+ petindex: "0"
+---
+kind: PersistentVolumeClaim
+apiVersion: v1
+metadata:
+ name: datadir-kafka-1
+spec:
+ accessModes:
+ - ReadWriteOnce
+ resources:
+ requests:
+ storage: 100Mi
+ selector:
+ matchLabels:
+ app: kafka
+ petindex: "1"
+---
+kind: PersistentVolumeClaim
+apiVersion: v1
+metadata:
+ name: datadir-kafka-2
+spec:
+ accessModes:
+ - ReadWriteOnce
+ resources:
+ requests:
+ storage: 100Mi
+ selector:
+ matchLabels:
+ app: kafka
+ petindex: "2"