Skip to content

Commit d17ecbe

Browse files
authored
Add a PV, a PVC and a volume to the test pods (#420)
* Add a PV, a PVC and a volume to the test pods This allows testing some storage related test cases in the CI.
1 parent 4a17f6a commit d17ecbe

File tree

6 files changed

+64
-0
lines changed

6 files changed

+64
-0
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ install:
1313
./scripts/fix-node-labels.sh
1414
./scripts/deploy-multus-network.sh
1515
./scripts/deploy-resource-quota.sh
16+
./scripts/deploy-storage.sh
1617
./scripts/deploy-test-pods.sh
1718
./scripts/deploy-statefulset-test-pods.sh
1819
./scripts/deploy-pod-disruption-budget.sh

scripts/clean.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ source "$SCRIPT_DIR"/init-env.sh
1818
./"$SCRIPT_DIR"/delete-resource-quota.sh
1919
./"$SCRIPT_DIR"/delete-pod-disruption-budget.sh
2020
./"$SCRIPT_DIR"/delete-cr-scale-operator.sh
21+
./"$SCRIPT_DIR"/delete-storage.sh

scripts/delete-storage.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env bash
2+
3+
# Initialization
4+
SCRIPT_DIR=$(dirname "$0")
5+
6+
# shellcheck disable=SC1091 # Not following.
7+
source "$SCRIPT_DIR"/init-env.sh
8+
9+
mkdir -p ./temp
10+
11+
# shellcheck disable=SC2002 # Useless cat.
12+
cat ./test-target/storage.yaml | "$SCRIPT_DIR"/mo >./temp/rendered-test-storage.yaml
13+
oc delete --filename ./temp/rendered-test-storage.yaml -n "$TNF_EXAMPLE_CNF_NAMESPACE" --ignore-not-found=true
14+
rm ./temp/rendered-test-storage.yaml

scripts/deploy-storage.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env bash
2+
3+
# Initialization
4+
SCRIPT_DIR=$(dirname "$0")
5+
6+
# shellcheck disable=SC1091 # Not following.
7+
source "$SCRIPT_DIR"/init-env.sh
8+
9+
mkdir -p ./temp
10+
11+
# shellcheck disable=SC2002 # Useless cat.
12+
cat ./test-target/storage.yaml | "$SCRIPT_DIR"/mo >./temp/rendered-test-storage.yaml
13+
oc apply --filename ./temp/rendered-test-storage.yaml --namespace "$TNF_EXAMPLE_CNF_NAMESPACE"
14+
rm ./temp/rendered-test-storage.yaml

test-target/local-pod-under-test.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ spec:
7373
periodSeconds: 5
7474
command: ["./bin/app"]
7575
terminationMessagePolicy: FallbackToLogsOnError
76+
volumes:
77+
- name: test-volume
78+
persistentVolumeClaim:
79+
claimName: test-pvc
7680
affinity:
7781
podAntiAffinity:
7882
requiredDuringSchedulingIgnoredDuringExecution:

test-target/storage.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
apiVersion: v1
2+
kind: PersistentVolume
3+
metadata:
4+
name: test-pv
5+
labels:
6+
role: test
7+
spec:
8+
capacity:
9+
storage: 10Mi
10+
accessModes:
11+
- ReadWriteOnce
12+
hostPath:
13+
path: /data
14+
persistentVolumeReclaimPolicy: Delete
15+
---
16+
apiVersion: v1
17+
kind: PersistentVolumeClaim
18+
metadata:
19+
name: test-pvc
20+
namespace: {{ TNF_EXAMPLE_CNF_NAMESPACE }}
21+
spec:
22+
accessModes:
23+
- ReadWriteOnce
24+
resources:
25+
requests:
26+
storage: 10Mi
27+
selector:
28+
matchLabels:
29+
role: test
30+

0 commit comments

Comments
 (0)