Skip to content

Commit

Permalink
Add a PV, a PVC and a volume to the test pods (#420)
Browse files Browse the repository at this point in the history
* Add a PV, a PVC and a volume to the test pods

This allows testing some storage related test cases in the CI.
  • Loading branch information
jmontesi authored Apr 16, 2024
1 parent 4a17f6a commit d17ecbe
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 0 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ install:
./scripts/fix-node-labels.sh
./scripts/deploy-multus-network.sh
./scripts/deploy-resource-quota.sh
./scripts/deploy-storage.sh
./scripts/deploy-test-pods.sh
./scripts/deploy-statefulset-test-pods.sh
./scripts/deploy-pod-disruption-budget.sh
Expand Down
1 change: 1 addition & 0 deletions scripts/clean.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ source "$SCRIPT_DIR"/init-env.sh
./"$SCRIPT_DIR"/delete-resource-quota.sh
./"$SCRIPT_DIR"/delete-pod-disruption-budget.sh
./"$SCRIPT_DIR"/delete-cr-scale-operator.sh
./"$SCRIPT_DIR"/delete-storage.sh
14 changes: 14 additions & 0 deletions scripts/delete-storage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash

# Initialization
SCRIPT_DIR=$(dirname "$0")

# shellcheck disable=SC1091 # Not following.
source "$SCRIPT_DIR"/init-env.sh

mkdir -p ./temp

# shellcheck disable=SC2002 # Useless cat.
cat ./test-target/storage.yaml | "$SCRIPT_DIR"/mo >./temp/rendered-test-storage.yaml
oc delete --filename ./temp/rendered-test-storage.yaml -n "$TNF_EXAMPLE_CNF_NAMESPACE" --ignore-not-found=true
rm ./temp/rendered-test-storage.yaml
14 changes: 14 additions & 0 deletions scripts/deploy-storage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash

# Initialization
SCRIPT_DIR=$(dirname "$0")

# shellcheck disable=SC1091 # Not following.
source "$SCRIPT_DIR"/init-env.sh

mkdir -p ./temp

# shellcheck disable=SC2002 # Useless cat.
cat ./test-target/storage.yaml | "$SCRIPT_DIR"/mo >./temp/rendered-test-storage.yaml
oc apply --filename ./temp/rendered-test-storage.yaml --namespace "$TNF_EXAMPLE_CNF_NAMESPACE"
rm ./temp/rendered-test-storage.yaml
4 changes: 4 additions & 0 deletions test-target/local-pod-under-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ spec:
periodSeconds: 5
command: ["./bin/app"]
terminationMessagePolicy: FallbackToLogsOnError
volumes:
- name: test-volume
persistentVolumeClaim:
claimName: test-pvc
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
Expand Down
30 changes: 30 additions & 0 deletions test-target/storage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: test-pv
labels:
role: test
spec:
capacity:
storage: 10Mi
accessModes:
- ReadWriteOnce
hostPath:
path: /data
persistentVolumeReclaimPolicy: Delete
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: test-pvc
namespace: {{ TNF_EXAMPLE_CNF_NAMESPACE }}
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Mi
selector:
matchLabels:
role: test

0 comments on commit d17ecbe

Please sign in to comment.