From 0ff41d800668fa104b58a5a3c4fdf2bf26f511fb Mon Sep 17 00:00:00 2001 From: sushanthakumar Date: Fri, 16 Jun 2023 13:36:35 +0530 Subject: [PATCH] Sample yamls and demo files for kahu Signed-off-by: sushanthakumar --- kahu/demos/openebs-zfs-deploy/sc.yaml | 12 ++++ .../volumesnapshotclass.yaml | 9 +++ kahu/demos/wordpress/kustomization.yaml | 7 ++ kahu/demos/wordpress/mysql-deployment.yaml | 66 ++++++++++++++++++ .../demos/wordpress/wordpress-deployment.yaml | 68 +++++++++++++++++++ kahu/sample-yamls/backup-namespace.yaml | 8 +++ kahu/sample-yamls/backup-specific-kinds.yaml | 15 ++++ .../backup-specific-resource.yaml | 12 ++++ kahu/sample-yamls/backup-with-hooks.yaml | 47 +++++++++++++ kahu/sample-yamls/backuplocation.yaml | 8 +++ kahu/sample-yamls/restore-namespace.yaml | 9 +++ .../restore-with-preserve-nodeport.yaml | 7 ++ 12 files changed, 268 insertions(+) create mode 100644 kahu/demos/openebs-zfs-deploy/sc.yaml create mode 100644 kahu/demos/openebs-zfs-deploy/volumesnapshotclass.yaml create mode 100644 kahu/demos/wordpress/kustomization.yaml create mode 100644 kahu/demos/wordpress/mysql-deployment.yaml create mode 100644 kahu/demos/wordpress/wordpress-deployment.yaml create mode 100644 kahu/sample-yamls/backup-namespace.yaml create mode 100644 kahu/sample-yamls/backup-specific-kinds.yaml create mode 100644 kahu/sample-yamls/backup-specific-resource.yaml create mode 100644 kahu/sample-yamls/backup-with-hooks.yaml create mode 100644 kahu/sample-yamls/backuplocation.yaml create mode 100644 kahu/sample-yamls/restore-namespace.yaml create mode 100644 kahu/sample-yamls/restore-with-preserve-nodeport.yaml diff --git a/kahu/demos/openebs-zfs-deploy/sc.yaml b/kahu/demos/openebs-zfs-deploy/sc.yaml new file mode 100644 index 0000000..881cc7b --- /dev/null +++ b/kahu/demos/openebs-zfs-deploy/sc.yaml @@ -0,0 +1,12 @@ +apiVersion: storage.k8s.io/v1 +kind: StorageClass +metadata: + name: openebs-zfspv +parameters: + recordsize: "4k" + compression: "off" + dedup: "off" + fstype: "zfs" + poolname: "zfspv-pool" +provisioner: zfs.csi.openebs.io +reclaimPolicy: Retain diff --git a/kahu/demos/openebs-zfs-deploy/volumesnapshotclass.yaml b/kahu/demos/openebs-zfs-deploy/volumesnapshotclass.yaml new file mode 100644 index 0000000..8ced350 --- /dev/null +++ b/kahu/demos/openebs-zfs-deploy/volumesnapshotclass.yaml @@ -0,0 +1,9 @@ +apiVersion: snapshot.storage.k8s.io/v1 +kind: VolumeSnapshotClass +metadata: + name: csi-zfs-snapclass + annotations: + snapshot.storage.kubernetes.io/is-default-class: "true" +driver: zfs.csi.openebs.io +deletionPolicy: Delete +parameters: diff --git a/kahu/demos/wordpress/kustomization.yaml b/kahu/demos/wordpress/kustomization.yaml new file mode 100644 index 0000000..d43b9a8 --- /dev/null +++ b/kahu/demos/wordpress/kustomization.yaml @@ -0,0 +1,7 @@ +secretGenerator: +- name: mysql-pass + literals: + - password=test1234 +resources: + - mysql-deployment.yaml + - wordpress-deployment.yaml diff --git a/kahu/demos/wordpress/mysql-deployment.yaml b/kahu/demos/wordpress/mysql-deployment.yaml new file mode 100644 index 0000000..9f7c57f --- /dev/null +++ b/kahu/demos/wordpress/mysql-deployment.yaml @@ -0,0 +1,66 @@ +apiVersion: v1 +kind: Service +metadata: + name: wordpress-mysql + labels: + app: wordpress +spec: + ports: + - port: 3306 + selector: + app: wordpress + tier: mysql + clusterIP: None +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: mysql-pv-claim + labels: + app: wordpress +spec: + storageClassName: openebs-zfspv + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 2Gi +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: wordpress-mysql + labels: + app: wordpress +spec: + selector: + matchLabels: + app: wordpress + tier: mysql + strategy: + type: Recreate + template: + metadata: + labels: + app: wordpress + tier: mysql + spec: + containers: + - image: mysql:5.6 + name: mysql + env: + - name: MYSQL_ROOT_PASSWORD + valueFrom: + secretKeyRef: + name: mysql-pass + key: password + ports: + - containerPort: 3306 + name: mysql + volumeMounts: + - name: mysql-persistent-storage + mountPath: /var/lib/mysql + volumes: + - name: mysql-persistent-storage + persistentVolumeClaim: + claimName: mysql-pv-claim diff --git a/kahu/demos/wordpress/wordpress-deployment.yaml b/kahu/demos/wordpress/wordpress-deployment.yaml new file mode 100644 index 0000000..2703a41 --- /dev/null +++ b/kahu/demos/wordpress/wordpress-deployment.yaml @@ -0,0 +1,68 @@ +apiVersion: v1 +kind: Service +metadata: + name: wordpress + labels: + app: wordpress +spec: + ports: + - port: 80 + selector: + app: wordpress + tier: frontend + type: NodePort +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: wp-pv-claim + labels: + app: wordpress +spec: + storageClassName: openebs-zfspv + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 2Gi +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: wordpress + labels: + app: wordpress +spec: + selector: + matchLabels: + app: wordpress + tier: frontend + strategy: + type: Recreate + template: + metadata: + labels: + app: wordpress + tier: frontend + spec: + containers: + - image: wordpress:4.8-apache + name: wordpress + env: + - name: WORDPRESS_DB_HOST + value: wordpress-mysql + - name: WORDPRESS_DB_PASSWORD + valueFrom: + secretKeyRef: + name: mysql-pass + key: password + ports: + - containerPort: 80 + name: wordpress + volumeMounts: + - name: wordpress-persistent-storage + mountPath: /var/www/html + volumes: + - name: wordpress-persistent-storage + persistentVolumeClaim: + claimName: wp-pv-claim diff --git a/kahu/sample-yamls/backup-namespace.yaml b/kahu/sample-yamls/backup-namespace.yaml new file mode 100644 index 0000000..035a611 --- /dev/null +++ b/kahu/sample-yamls/backup-namespace.yaml @@ -0,0 +1,8 @@ +apiVersion: kahu.io/v1beta1 +kind: Backup +metadata: + name: backup-demo-ns +spec: + excludeResources: [] + includeNamespaces: [default] + metadataLocation: nfs diff --git a/kahu/sample-yamls/backup-specific-kinds.yaml b/kahu/sample-yamls/backup-specific-kinds.yaml new file mode 100644 index 0000000..b69ef47 --- /dev/null +++ b/kahu/sample-yamls/backup-specific-kinds.yaml @@ -0,0 +1,15 @@ +apiVersion: kahu.io/v1beta1 +kind: Backup +metadata: + name: backup-demo-kinds +spec: + excludeResources: [] + includeNamespaces: [kube-system] + metadataLocation: nfs + includeResources: + - name: + kind: Deployment + isRegex: true + - name: + kind: Pod + isRegex: true diff --git a/kahu/sample-yamls/backup-specific-resource.yaml b/kahu/sample-yamls/backup-specific-resource.yaml new file mode 100644 index 0000000..204b24b --- /dev/null +++ b/kahu/sample-yamls/backup-specific-resource.yaml @@ -0,0 +1,12 @@ +apiVersion: kahu.io/v1beta1 +kind: Backup +metadata: + name: backup-demo-resource +spec: + excludeResources: [] + includeNamespaces: [default] + metadataLocation: nfs + includeResources: + - name: pod1234 + kind: Pod + isRegex: false diff --git a/kahu/sample-yamls/backup-with-hooks.yaml b/kahu/sample-yamls/backup-with-hooks.yaml new file mode 100644 index 0000000..368cac3 --- /dev/null +++ b/kahu/sample-yamls/backup-with-hooks.yaml @@ -0,0 +1,47 @@ +apiVersion: kahu.io/v1beta1 +kind: Backup +metadata: + name: backup-demo-003 +spec: + excludeResources: [] + includeNamespaces: [default] + metadataLocation: nfs + includeResources: + - name: + kind: Pod + isRegex: true + hook: + resources: + - name: kahu_hook1 + includeNamespaces: [default] + excludeNamespaces: [test] + includeResources: + - name: busybox + kind: Pod + isRegex: true + pre: + - exec: + container: busybox + command: + - /bin/sh + - -c + - ls -l && hostname + timeout: 5m + onError: Fail + + - name: kahu_hook2 + includeNamespaces: [default] + excludeNamespaces: [test] + includeResources: + - name: busybox + kind: Pod + isRegex: true + post: + - exec: + container: busybox + command: + - /bin/sh + - -c + - ls -l && hostname + timeout: 5m + onError: Fail diff --git a/kahu/sample-yamls/backuplocation.yaml b/kahu/sample-yamls/backuplocation.yaml new file mode 100644 index 0000000..5997230 --- /dev/null +++ b/kahu/sample-yamls/backuplocation.yaml @@ -0,0 +1,8 @@ +apiVersion: kahu.io/v1beta1 +kind: BackupLocation +metadata: + name: nfs +spec: + providerName: nfs-provider + config: {key: "key", password: "password"} + diff --git a/kahu/sample-yamls/restore-namespace.yaml b/kahu/sample-yamls/restore-namespace.yaml new file mode 100644 index 0000000..76134f1 --- /dev/null +++ b/kahu/sample-yamls/restore-namespace.yaml @@ -0,0 +1,9 @@ +apiVersion: kahu.io/v1beta1 +kind: Restore +metadata: + name: restore-demo-1 +spec: + backupName: backup-demo + namespaceMapping: + default: restore-ns + diff --git a/kahu/sample-yamls/restore-with-preserve-nodeport.yaml b/kahu/sample-yamls/restore-with-preserve-nodeport.yaml new file mode 100644 index 0000000..1a9c4ce --- /dev/null +++ b/kahu/sample-yamls/restore-with-preserve-nodeport.yaml @@ -0,0 +1,7 @@ +apiVersion: kahu.io/v1beta1 +kind: Restore +metadata: + name: restore-demo-1 +spec: + backupName: backup-demo + preserveNodePort: true