Skip to content

Commit

Permalink
Test submariner connectivity
Browse files Browse the repository at this point in the history
Add a real connectivity test, creating nginx deployment on one cluster,
exporting the service using submariner, and accessing nginx from the
second cluster.

We run the test in both ways, deploying on dr1 and accessing from dr2,
and deploying on dr2 and accessing from dr1. Both tests run concurrently
by separating deploy and wait steps.

The entire test takes 15 seconds, but on the first run after deploying
there is more than 60 seconds delay before service DNS name can be
resolved, and the test takes 85 seconds. We don't see any delay when
running on the regional-dr environment.

Example run with submariner.yaml:

    $ drenv start envs/submariner.yaml
    2023-06-21 18:27:00,108 INFO    [submariner] Starting environment
    2023-06-21 18:27:00,135 INFO    [hub] Starting minikube cluster
    2023-06-21 18:27:01,165 INFO    [dr1] Starting minikube cluster
    2023-06-21 18:27:02,160 INFO    [dr2] Starting minikube cluster
    2023-06-21 18:27:38,610 INFO    [hub] Cluster started in 38.47 seconds
    2023-06-21 18:27:38,611 INFO    [hub/0] Running addons/submariner/start
    2023-06-21 18:27:58,850 INFO    [dr1] Cluster started in 57.69 seconds
    2023-06-21 18:28:20,728 INFO    [dr2] Cluster started in 78.57 seconds
    2023-06-21 18:29:10,467 INFO    [hub/0] addons/submariner/start completed in 91.86 seconds
    2023-06-21 18:29:10,467 INFO    [hub/0] Running addons/submariner/test
    2023-06-21 18:30:35,047 INFO    [hub/0] addons/submariner/test completed in 84.58 seconds
    2023-06-21 18:30:35,048 INFO    [submariner] Environment started in 214.94 seconds

Example run with regional-dr.yaml:

    $ drenv start envs/regional-dr.yaml
    2023-06-21 18:54:05,517 INFO    [rdr] Starting environment
    ...
    2023-06-21 18:55:27,894 INFO    [hub/1] Running addons/submariner/start
    ...
    2023-06-21 18:59:42,084 INFO    [hub/1] addons/submariner/start completed in 254.19 seconds
    2023-06-21 18:59:42,084 INFO    [hub/1] Running addons/submariner/test
    ...
    2023-06-21 19:00:10,954 INFO    [hub/1] addons/submariner/test completed in 28.87 seconds
    2023-06-21 19:01:47,030 INFO    [rdr] Environment started in 461.51 seconds

Signed-off-by: Nir Soffer <nsoffer@redhat.com>
  • Loading branch information
nirs committed Jun 22, 2023
1 parent 1c2b427 commit aabf679
Show file tree
Hide file tree
Showing 15 changed files with 374 additions and 16 deletions.
24 changes: 24 additions & 0 deletions test/addons/submariner/base/dst/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# SPDX-FileCopyrightText: The RamenDR authors
# SPDX-License-Identifier: Apache-2.0

---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
namespace: nginx
spec:
replicas: 1
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- image: nginx
name: nginx
ports:
- containerPort: 80
8 changes: 8 additions & 0 deletions test/addons/submariner/base/dst/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# SPDX-FileCopyrightText: The RamenDR authors
# SPDX-License-Identifier: Apache-2.0

---
resources:
- namespace.yaml
- deploy.yaml
- service.yaml
8 changes: 8 additions & 0 deletions test/addons/submariner/base/dst/namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# SPDX-FileCopyrightText: The RamenDR authors
# SPDX-License-Identifier: Apache-2.0

---
apiVersion: v1
kind: Namespace
metadata:
name: nginx
15 changes: 15 additions & 0 deletions test/addons/submariner/base/dst/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# SPDX-FileCopyrightText: The RamenDR authors
# SPDX-License-Identifier: Apache-2.0

---
apiVersion: v1
kind: Service
metadata:
name: nginx
namespace: nginx
spec:
ports:
- port: 80
selector:
app: nginx
type: ClusterIP
7 changes: 7 additions & 0 deletions test/addons/submariner/base/src/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# SPDX-FileCopyrightText: The RamenDR authors
# SPDX-License-Identifier: Apache-2.0

---
resources:
- namespace.yaml
- pod.yaml
8 changes: 8 additions & 0 deletions test/addons/submariner/base/src/namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# SPDX-FileCopyrightText: The RamenDR authors
# SPDX-License-Identifier: Apache-2.0

---
apiVersion: v1
kind: Namespace
metadata:
name: nginx
20 changes: 20 additions & 0 deletions test/addons/submariner/base/src/pod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# SPDX-FileCopyrightText: The RamenDR authors
# SPDX-License-Identifier: Apache-2.0
#
---
apiVersion: v1
kind: Pod
metadata:
name: test
namespace: nginx
spec:
containers:
- name: test
image: quay.io/submariner/nettest
command:
- sh
- -c
- |
trap exit TERM
sleep 300 &
wait
7 changes: 7 additions & 0 deletions test/addons/submariner/ns1/dst/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# SPDX-FileCopyrightText: The RamenDR authors
# SPDX-License-Identifier: Apache-2.0

---
resources:
- ../../base/dst
namespace: ns1
7 changes: 7 additions & 0 deletions test/addons/submariner/ns1/src/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# SPDX-FileCopyrightText: The RamenDR authors
# SPDX-License-Identifier: Apache-2.0

---
resources:
- ../../base/src
namespace: ns1
7 changes: 7 additions & 0 deletions test/addons/submariner/ns2/dst/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# SPDX-FileCopyrightText: The RamenDR authors
# SPDX-License-Identifier: Apache-2.0

---
resources:
- ../../base/dst
namespace: ns2
7 changes: 7 additions & 0 deletions test/addons/submariner/ns2/src/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# SPDX-FileCopyrightText: The RamenDR authors
# SPDX-License-Identifier: Apache-2.0

---
resources:
- ../../base/src
namespace: ns2
1 change: 0 additions & 1 deletion test/addons/submariner/start
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import os
import sys
import time

import drenv
from drenv import cluster as drenv_cluster
Expand Down
Loading

0 comments on commit aabf679

Please sign in to comment.