Skip to content

Commit 74692f7

Browse files
committed
Improve kuttl tests
Create the NAD for the octavia amphora controllers Ensure that the HM addresses and routes are set
1 parent b54fc8d commit 74692f7

File tree

6 files changed

+57
-1
lines changed

6 files changed

+57
-1
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
resources:
2+
- octavia-nad.yaml
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
apiVersion: k8s.cni.cncf.io/v1
2+
kind: NetworkAttachmentDefinition
3+
metadata:
4+
name: octavia
5+
spec:
6+
config: |
7+
{
8+
"cniVersion": "0.3.1",
9+
"name": "octavia",
10+
"type": "bridge",
11+
"bridge": "octbr",
12+
"ipam": {
13+
"type": "whereabouts",
14+
"range": "172.23.0.0/24",
15+
"range_start": "172.23.0.30",
16+
"range_end": "172.23.0.70",
17+
"routes": [
18+
{
19+
"dst": "172.24.0.0/16",
20+
"gw" : "172.23.0.150"
21+
}
22+
]
23+
}
24+
}

tests/kuttl/common/assert_sample_deployment.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,3 +244,20 @@ commands:
244244
fi
245245
done
246246
exit 0
247+
- script: |
248+
# Check that the octavia-healthmanager pod has 2 IP addresses on the octavia interface and a route to lb-mgmt-subunet
249+
pod=$(oc get pods -n $NAMESPACE -l service=octavia-healthmanager --field-selector=status.phase=Running -o name | head -1)
250+
if [ "$pod" = "" ]; then
251+
exit 1
252+
fi
253+
# Note: $pod already includes the resource type (ex: pod/octavia-healthmanager-xxxxx)
254+
node_name=$(oc get -n $NAMESPACE $pod -o go-template='{{.spec.nodeName}}')
255+
octavia_fixed_ip=$(oc get configmaps -n $NAMESPACE octavia-hmport-map -o json | jq -r ".data.hm_$node_name")
256+
n_matches=$(oc logs -n $NAMESPACE -c init "$pod" |
257+
grep -e "addr 172.23.*/24 dev octavia" \
258+
-e "addr $octavia_fixed_ip/32 dev octavia" \
259+
-e "route 172.24.0.0/16 via 172.23.0.150 dev octavia" | wc -l)
260+
if [ "$n_matches" != "3" ]; then
261+
exit 1
262+
fi
263+
exit 0
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
apiVersion: k8s.cni.cncf.io/v1
2+
kind: NetworkAttachmentDefinition
3+
metadata:
4+
name: octavia
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
apiVersion: kuttl.dev/v1beta1
2+
kind: TestStep
3+
commands:
4+
- script: |
5+
oc kustomize ../../../../config/samples/network-attachment-definition | oc apply -n $NAMESPACE -f -

tests/kuttl/tests/octavia_scale/01-deploy-octavia.yaml

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
apiVersion: kuttl.dev/v1beta1
2+
kind: TestStep
3+
commands:
4+
- script: |
5+
oc kustomize ../../../../config/samples | oc apply -n $NAMESPACE -f -

0 commit comments

Comments
 (0)