Skip to content

Commit

Permalink
Improve kuttl tests
Browse files Browse the repository at this point in the history
Create the NAD for the octavia amphora controllers
Ensure that the HM addresses and routes are set
  • Loading branch information
gthiemonge committed Oct 28, 2024
1 parent b54fc8d commit e05e570
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
resources:
- octavia-nad.yaml
24 changes: 24 additions & 0 deletions config/samples/network-attachment-definition/octavia-nad.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: k8s.cni.cncf.io/v1
kind: NetworkAttachmentDefinition
metadata:
name: octavia
spec:
config: |
{
"cniVersion": "0.3.1",
"name": "octavia",
"type": "bridge",
"bridge": "octbr",
"ipam": {
"type": "whereabouts",
"range": "172.23.0.0/24",
"range_start": "172.23.0.30",
"range_end": "172.23.0.70",
"routes": [
{
"dst": "172.24.0.0/16",
"gw" : "172.23.0.150"
}
]
}
}
17 changes: 17 additions & 0 deletions tests/kuttl/common/assert_sample_deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -244,3 +244,20 @@ commands:
fi
done
exit 0
- script: |
# Check that the octavia-healthmanager pod has 2 IP addresses on the octavia interface and a route to lb-mgmt-subunet
pod=$(oc get pods -n $NAMESPACE -l service=octavia-healthmanager --field-selector=status.phase=Running -o name | head -1)
if [ "$pod" = "" ]; then
exit 1
fi
# Note: $pod already includes the resource type (ex: pod/octavia-healthmanager-xxxxx)
node_name=$(oc get -n $NAMESPACE $pod -o go-template='{{.spec.nodeName}}')
octavia_fixed_ip=$(oc get configmaps -n $NAMESPACE octavia-hmport-map -o json | jq -r '.data["hm_'$node_name'"]')
n_matches=$(oc logs -n $NAMESPACE -c init "$pod" |
grep -e "addr 172.23.*/24 dev octavia" \
-e "addr $octavia_fixed_ip/32 dev octavia" \
-e "route 172.24.0.0/16 via 172.23.0.150 dev octavia" | wc -l)
if [ "$n_matches" != "3" ]; then
exit 1
fi
exit 0
4 changes: 4 additions & 0 deletions tests/kuttl/tests/octavia_scale/00-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: k8s.cni.cncf.io/v1
kind: NetworkAttachmentDefinition
metadata:
name: octavia
5 changes: 5 additions & 0 deletions tests/kuttl/tests/octavia_scale/00-test-resources.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- script: |
oc kustomize ../../../../config/samples/network-attachment-definition | oc apply -n $NAMESPACE -f -
1 change: 0 additions & 1 deletion tests/kuttl/tests/octavia_scale/01-deploy-octavia.yaml

This file was deleted.

5 changes: 5 additions & 0 deletions tests/kuttl/tests/octavia_scale/01-deploy-octavia.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- script: |
oc kustomize ../../../../config/samples | oc apply -n $NAMESPACE -f -

0 comments on commit e05e570

Please sign in to comment.