Skip to content

Commit

Permalink
Adding Portworx Storage Labs to the Kubernetes Hackfest repo (#393)
Browse files Browse the repository at this point in the history
* creating a new Portworx folder

* updating intro

* Installing Portworx steps

* adding pxbbq files

* deploying pxbbq and adding pxbbq images

* adding modules

* moving yaml files to yaml folder

* first test

* removing individual wrapup modules

* update permissions

* update instance size

* update busybox

* adding troublshooting section

* Removing App IO control

* updating wrap up script

* updating pgbench

* Fix issues for demo

* Update README.md

---------

Co-authored-by: Tommy Falgout <[email protected]>
  • Loading branch information
bhavin04890 and lastcoolnameleft authored Sep 8, 2023
1 parent 003875e commit 8c8526a
Show file tree
Hide file tree
Showing 42 changed files with 1,701 additions and 0 deletions.
826 changes: 826 additions & 0 deletions labs/storage/portworx/README.md

Large diffs are not rendered by default.

Binary file added labs/storage/portworx/images/appio-0.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added labs/storage/portworx/images/appio-1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added labs/storage/portworx/images/appio-2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added labs/storage/portworx/images/appio-3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added labs/storage/portworx/images/grafana-0.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added labs/storage/portworx/images/grafana-1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added labs/storage/portworx/images/pxbbq-1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added labs/storage/portworx/images/pxbbq-2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added labs/storage/portworx/images/pxbbq-3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added labs/storage/portworx/images/pxbbq-4.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added labs/storage/portworx/images/pxbbq-5.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added labs/storage/portworx/images/pxbbq-6.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added labs/storage/portworx/images/pxbbq-7.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added labs/storage/portworx/images/pxbbq-8.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
61 changes: 61 additions & 0 deletions labs/storage/portworx/yaml/autopilot-app.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: pgbench
labels:
app: pgbench
spec:
selector:
matchLabels:
app: pgbench
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
type: RollingUpdate
replicas: 1
template:
metadata:
labels:
app: pgbench
spec:
schedulerName: stork
containers:
- image: postgres:9.5
name: postgres
ports:
- containerPort: 5432
env:
- name: POSTGRES_USER
value: pgbench
- name: POSTGRES_PASSWORD
value: superpostgres
- name: PGBENCH_PASSWORD
value: superpostgres
- name: PGDATA
value: /var/lib/postgresql/data/pgdata
volumeMounts:
- mountPath: /var/lib/postgresql/data
name: pgbenchdb
- name: pgbench
image: portworx/torpedo-pgbench:latest
imagePullPolicy: "Always"
env:
- name: PG_HOST
value: 127.0.0.1
- name: PG_USER
value: pgbench
- name: SIZE
value: "7"
volumeMounts:
- mountPath: /var/lib/postgresql/data
name: pgbenchdb
- mountPath: /pgbench
name: pgbenchstate
volumes:
- name: pgbenchdb
persistentVolumeClaim:
claimName: pgbench-data
- name: pgbenchstate
persistentVolumeClaim:
claimName: pgbench-state
25 changes: 25 additions & 0 deletions labs/storage/portworx/yaml/autopilot-postgres.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: pgbench-data
labels:
app: postgres
spec:
storageClassName: block-sc
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: pgbench-state
spec:
storageClassName: block-sc
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
29 changes: 29 additions & 0 deletions labs/storage/portworx/yaml/autopilotrule.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
apiVersion: autopilot.libopenstorage.org/v1alpha1
kind: AutopilotRule
metadata:
name: volume-resize
spec:
##### selector filters the objects affected by this rule given labels
selector:
matchLabels:
app: postgres
##### namespaceSelector selects the namespaces of the objects affected by this rule
namespaceSelector:
matchLabels:
type: db
##### conditions are the symptoms to evaluate. All conditions are AND'ed
conditions:
# volume usage should be less than 20%
expressions:
- key: "100 * (px_volume_usage_bytes / px_volume_capacity_bytes)"
operator: Gt
values:
- "20"
##### action to perform when condition is true
actions:
- name: openstorage.io.action.volume/resize
params:
# resize volume by scalepercentage of current size
scalepercentage: "20"
# volume capacity should not exceed 50GiB
maxsize: "50Gi"
10 changes: 10 additions & 0 deletions labs/storage/portworx/yaml/block-sc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: block-sc
provisioner: pxd.portworx.com
parameters:
repl: "3"
priority_io: "high"
io_profile: "auto"
allowVolumeExpansion: true
63 changes: 63 additions & 0 deletions labs/storage/portworx/yaml/busyboxpod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: shared-demo
name: shared-busybox
spec:
replicas: 3
selector:
matchLabels:
app: shared-demo
template:
metadata:
labels:
app: shared-demo
spec:
volumes:
- name: shared-vol
persistentVolumeClaim:
claimName: px-sharedv4-pvc
terminationGracePeriodSeconds: 5
containers:
- image: busybox
imagePullPolicy: Always
name: busybox
volumeMounts:
- name: shared-vol
mountPath: "/mnt"
command:
- sh
args:
- -c
- |
while true; do
echo -e "{"time":$(date +%H:%M:%S),"hostname":$(hostname) writing to shared vol }""\n" >> /mnt/shared.log
sleep 1
done
---
apiVersion: v1
kind: Pod
metadata:
name: shared-demo-reader
spec:
volumes:
- name: shared-vol
persistentVolumeClaim:
claimName: px-sharedv4-pvc
terminationGracePeriodSeconds: 5
containers:
- image: busybox
imagePullPolicy: Always
name: busybox
volumeMounts:
- name: shared-vol
mountPath: "/mnt"
command:
- sh
args:
- -c
- |
while true; do
tail -f /mnt/shared.log
done
11 changes: 11 additions & 0 deletions labs/storage/portworx/yaml/file-sc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: file-sc
provisioner: pxd.portworx.com
parameters:
repl: "2"
priority_io: "high"
sharedv4: "true"
sharedv4_svc_type: "ClusterIP"
sharedv4_failover_strategy: "aggressive"
66 changes: 66 additions & 0 deletions labs/storage/portworx/yaml/grafana.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: grafana
namespace: portworx
labels:
app: grafana
spec:
replicas: 1
selector:
matchLabels:
app: grafana
template:
metadata:
labels:
app: grafana
spec:
containers:
- image: grafana/grafana:7.5.17
name: grafana
imagePullPolicy: IfNotPresent
resources:
limits:
cpu: 100m
memory: 100Mi
requests:
cpu: 100m
memory: 100Mi
readinessProbe:
httpGet:
path: /login
port: 3000
volumeMounts:
- name: grafana-dash-config
mountPath: /etc/grafana/provisioning/dashboards
- name: dashboard-templates
mountPath: /var/lib/grafana/dashboards
- name: grafana-source-config
mountPath: /etc/grafana/provisioning/datasources
volumes:
- name: grafana-source-config
configMap:
name: grafana-source-config
- name: grafana-dash-config
configMap:
name: grafana-dashboard-config
- name: dashboard-templates
configMap:
name: grafana-dashboards
---
apiVersion: v1
kind: Service
metadata:
name: grafana-svc
namespace: portworx
labels:
app: grafana
spec:
type: LoadBalancer
selector:
app: grafana
ports:
- protocol: TCP
port: 3000
targetPort: 3000
name: grafana
7 changes: 7 additions & 0 deletions labs/storage/portworx/yaml/group-sc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: group-sc
provisioner: pxd.portworx.com
parameters:
repl: "2"
30 changes: 30 additions & 0 deletions labs/storage/portworx/yaml/install-grafana.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

curl -O https://docs.portworx.com/samples/k8s/pxc/grafana-dashboard-config.yaml
sleep 3
curl -O https://docs.portworx.com/samples/k8s/pxc/grafana-datasource.yaml
sleep 5

kubectl -n portworx create configmap grafana-dashboard-config --from-file=grafana-dashboard-config.yaml
kubectl -n portworx create configmap grafana-source-config --from-file=grafana-datasource.yaml

sleep 5

curl "https://docs.portworx.com/samples/k8s/pxc/portworx-cluster-dashboard.json" -o portworx-cluster-dashboard.json && \
curl "https://docs.portworx.com/samples/k8s/pxc/portworx-node-dashboard.json" -o portworx-node-dashboard.json && \
curl "https://docs.portworx.com/samples/k8s/pxc/portworx-volume-dashboard.json" -o portworx-volume-dashboard.json && \
curl "https://docs.portworx.com/samples/k8s/pxc/portworx-performance-dashboard.json" -o portworx-performance-dashboard.json && \
curl "https://docs.portworx.com/samples/k8s/pxc/portworx-etcd-dashboard.json" -o portworx-etcd-dashboard.json

sleep 5

kubectl -n portworx create configmap grafana-dashboards \
--from-file=portworx-cluster-dashboard.json \
--from-file=portworx-performance-dashboard.json \
--from-file=portworx-node-dashboard.json \
--from-file=portworx-volume-dashboard.json \
--from-file=portworx-etcd-dashboard.json

sleep 5

kubectl apply -f grafana.yaml
7 changes: 7 additions & 0 deletions labs/storage/portworx/yaml/mongo-snapshot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: volumesnapshot.external-storage.k8s.io/v1
kind: VolumeSnapshot
metadata:
name: px-mongo-snapshot
namespace: pxbbq
spec:
persistentVolumeClaimName: mongodb-pvc
Loading

0 comments on commit 8c8526a

Please sign in to comment.