test scripts

This commit is contained in:
Philipp Richter
2025-01-14 17:19:34 +01:00
parent 90ea9c530b
commit 77a4a47552
10 changed files with 224 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
#!/bin/bash
export INDEX
export NODENAME
for INDEX in {0,1}{0,1,2,3,4,5,6,7,8,9} ; do
echo "PVC: $INDEX"
envsubst < test-block-00.yaml | oc apply -f -
done
NODENAME="ocp-a-play-phy-worker-1-g1.cloud.svc.co.at"
for INDEX in {0,1}{0,1,2,3,4,5,6,7,8,9} ; do
echo "Shell: $INDEX"
envsubst < test-shell-00.yaml | oc apply -f -
done

View File

@@ -0,0 +1,14 @@
#!/bin/bash
while : ; do
./switch.sh 1
#sleep 480
sleep 120
echo "$(date +'%Y-%m-%d %H:%M:%S') Pods State not in running state"
oc get pods -n test-richph | grep -v "Running"
./switch.sh 2
# sleep 480
sleep 120
echo "$(date +'%Y-%m-%d %H:%M:%S') Pods State not in running state"
oc get pods -n test-richph | grep -v "Running"
done

View File

@@ -0,0 +1,15 @@
#!/bin/bash
export INDEX
export NODENAME
for INDEX in {0,1}{0,1,2,3,4,5,6,7,8,9} ; do
echo "PVC: $INDEX"
envsubst < test-block-00.yaml | oc delete -f -
done
NODENAME="ocp-a-play-phy-worker-1-g1.cloud.svc.co.at"
for INDEX in {0,1}{0,1,2,3,4,5,6,7,8,9} ; do
echo "Shell: $INDEX"
envsubst < test-shell-00.yaml | oc delete -f -
done

View File

@@ -0,0 +1,7 @@
#!/bin/bash
export INDEX
for INDEX in {0,1}{0,1,2,3,4,5,6,7,8,9} ; do
oc patch deployments test-shell-$INDEX -n test-richph -p '{"spec": {"template": {"spec": {"nodeSelector": null }}}}' >/dev/null
done

View File

@@ -0,0 +1,10 @@
#!/bin/bash
export INDEX
export NODENAME
SCALE=${1:-0}
for INDEX in {0,1}{0,1,2,3,4,5,6,7,8,9} ; do
echo "Shell: $INDEX"
oc scale --replicas=$SCALE deployment/test-shell-$INDEX -n test-richph
done

View File

@@ -0,0 +1,28 @@
#!/bin/bash
export INDEX
export NODENAME
case $1 in
1)
NODENAME1="ocp-a-play-phy-worker-1-g1.cloud.svc.co.at"
NODENAME2="ocp-b-play-phy-worker-1-g1.cloud.svc.co.at"
;;
2)
NODENAME1="ocp-b-play-phy-worker-1-g1.cloud.svc.co.at"
NODENAME2="ocp-a-play-phy-worker-1-g1.cloud.svc.co.at"
;;
esac
NODENAME="$NODENAME1"
echo "$(date +'%Y-%m-%d %H:%M:%S') Move 0x to $NODENAME"
for INDEX in 0{0,1,2,3,4,5,6,7,8,9} ; do
oc patch deployments test-shell-$INDEX -n test-richph -p '{"spec": {"template": {"spec": {"nodeSelector": {"kubernetes.io/hostname": "'$NODENAME'"}}}}}' >/dev/null
done
NODENAME="$NODENAME2"
echo "$(date +'%Y-%m-%d %H:%M:%S') Move 1x to $NODENAME"
for INDEX in 1{0,1,2,3,4,5,6,7,8,9} ; do
oc patch deployments test-shell-$INDEX -n test-richph -p '{"spec": {"template": {"spec": {"nodeSelector": {"kubernetes.io/hostname": "'$NODENAME'"}}}}}' >/dev/null
done

View File

@@ -0,0 +1,13 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: test-block-$INDEX
namespace: test-richph
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
storageClassName: powermax-x
volumeMode: Block

View File

@@ -0,0 +1,45 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: test-shell-$INDEX
namespace: test-richph
spec:
progressDeadlineSeconds: 600
replicas: 0
revisionHistoryLimit: 10
selector:
matchLabels:
app: test-shell-$INDEX
template:
metadata:
labels:
app: test-shell-$INDEX
deploymentconfig: test-shell-$INDEX
spec:
containers:
- args:
- tail
- -f
- /dev/null
image: ocp-play-quay.cloud.svc.co.at/rhel8/support-tools:latest
imagePullPolicy: IfNotPresent
name: tools
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeDevices:
- devicePath: /dev/test-block
name: test-block
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
nodeSelector:
kubernetes.io/hostname: $NODENAME
volumes:
- name: test-block
persistentVolumeClaim:
claimName: test-block-$INDEX
strategy:
type: Recreate