Skip to content

Commit e79a99e

Browse files
authored
Add some resources required for testing specific test cases (#422)
* Add some resources required for testing specific test cases The ones included in this change allow testing "lifecycle-affinity-required-pods".
1 parent 583109d commit e79a99e

File tree

5 files changed

+120
-0
lines changed

5 files changed

+120
-0
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ install:
1717
./scripts/deploy-test-pods.sh
1818
./scripts/deploy-statefulset-test-pods.sh
1919
./scripts/deploy-pod-disruption-budget.sh
20+
./scripts/deploy-special-resources.sh
2021
./scripts/deploy-test-crds.sh
2122
./scripts/install-olm.sh
2223
./scripts/deploy-community-operator.sh

scripts/clean.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ source "$SCRIPT_DIR"/init-env.sh
88

99
# Delete tnf, partner and operator and litmus
1010
./"$SCRIPT_DIR"/delete-test-pods.sh
11+
./"$SCRIPT_DIR"/delete-special-resources.sh
1112
./"$SCRIPT_DIR"/delete-hpa.sh
1213
./"$SCRIPT_DIR"/delete-test-crds.sh
1314
./"$SCRIPT_DIR"/delete-debug-ds.sh

scripts/delete-special-resources.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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+
"$SCRIPT_DIR"/mo ./test-target/special-resources.yaml >./temp/rendered-test-special-resources.yaml
12+
oc delete --filename ./temp/rendered-test-special-resources.yaml -n "$TNF_EXAMPLE_CNF_NAMESPACE" --ignore-not-found=true
13+
rm ./temp/rendered-test-special-resources.yaml

scripts/deploy-special-resources.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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+
"$SCRIPT_DIR"/mo ./test-target/special-resources.yaml >./temp/rendered-test-special-resources.yaml
12+
oc apply --filename ./temp/rendered-test-special-resources.yaml --namespace "$TNF_EXAMPLE_CNF_NAMESPACE"
13+
rm ./temp/rendered-test-special-resources.yaml

test-target/special-resources.yaml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
2+
apiVersion: apps/v1
3+
kind: Deployment
4+
metadata:
5+
name: special-dp
6+
namespace: {{ TNF_EXAMPLE_CNF_NAMESPACE }}
7+
labels:
8+
test-network-function.com/generic: target
9+
spec:
10+
replicas: 2
11+
selector:
12+
matchLabels:
13+
app: special-dp
14+
template:
15+
metadata:
16+
labels:
17+
test-network-function.com/generic: target
18+
test-network-function.com/container: target
19+
app: special-dp
20+
AffinityRequired: "true"
21+
name: special-dp
22+
spec:
23+
terminationGracePeriodSeconds: 30
24+
automountServiceAccountToken: false
25+
serviceAccountName: test-pod-sa
26+
containers:
27+
- image: quay.io/testnetworkfunction/cnf-test-partner:latest
28+
imagePullPolicy: IfNotPresent
29+
name: test
30+
ports:
31+
- name: "http-probe"
32+
containerPort: 8080
33+
resources:
34+
limits:
35+
memory: 512Mi
36+
cpu: 0.25
37+
lifecycle:
38+
postStart:
39+
exec:
40+
command: ["/bin/sh", "-c", "echo Hello from the postStart handler > /tmp/message"]
41+
preStop:
42+
exec:
43+
command: ["/bin/sh", "-c", "killall -0 tail"]
44+
livenessProbe:
45+
httpGet:
46+
path: /health
47+
port: 8080
48+
httpHeaders:
49+
- name: health-check
50+
value: liveness
51+
initialDelaySeconds: 10
52+
periodSeconds: 5
53+
readinessProbe:
54+
httpGet:
55+
path: /ready
56+
port: 8080
57+
httpHeaders:
58+
- name: health-check
59+
value: readiness
60+
initialDelaySeconds: 10
61+
periodSeconds: 5
62+
startupProbe:
63+
httpGet:
64+
path: /health
65+
port: 8080
66+
httpHeaders:
67+
- name: health-check
68+
value: startup
69+
failureThreshold: 10
70+
periodSeconds: 5
71+
command: ["./bin/app"]
72+
terminationMessagePolicy: FallbackToLogsOnError
73+
affinity:
74+
nodeAffinity:
75+
requiredDuringSchedulingIgnoredDuringExecution:
76+
nodeSelectorTerms:
77+
- matchExpressions:
78+
- key: node-role.kubernetes.io/worker
79+
operator: In
80+
values:
81+
- worker
82+
---
83+
apiVersion: policy/v1
84+
kind: PodDisruptionBudget
85+
metadata:
86+
name: special-pdb
87+
namespace: {{ TNF_EXAMPLE_CNF_NAMESPACE }}
88+
spec:
89+
minAvailable: 1
90+
selector:
91+
matchLabels:
92+
app: special-dp

0 commit comments

Comments
 (0)