Skip to content

Commit 920da07

Browse files
committed
e2e: use the NVMe-oF gateway that is deployed by Rook
The IP-address of the gateway is configured in the StorageClass. This is required as the short-hostname can not be resolved in DNS. The gateway and Ceph-CSI get deployed in different namespaces, which means the domain names differ. The same issue happens in sripts/k8s-storage/create-storageclasses.sh. Signed-off-by: Niels de Vos <ndevos@ibm.com>
1 parent 7af508a commit 920da07

7 files changed

Lines changed: 32 additions & 443 deletions

File tree

e2e/nvmeof-deploy.go

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import (
2929
apierrs "k8s.io/apimachinery/pkg/api/errors"
3030
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
3131
"k8s.io/apimachinery/pkg/util/wait"
32+
"k8s.io/client-go/kubernetes"
3233
"k8s.io/kubernetes/test/e2e/framework"
3334
)
3435

@@ -181,7 +182,7 @@ func createNVMeoFStorageClass(
181182
Port int `json:"port"`
182183
}{
183184
{
184-
Hostname: gwHost, // FIXME: is this required?
185+
Hostname: gwHost, // short-hostname, without domain
185186
Address: gwIP,
186187
Port: 4420,
187188
},
@@ -242,3 +243,31 @@ func createNVMeoFCredentials(f *framework.Framework) {
242243
err = createRBDSecret(f, nvmeofNodePluginSecretName, nvmeofKeyringNodePluginUsername, key)
243244
Expect(err).ShouldNot(HaveOccurred())
244245
}
246+
247+
// getNVMeofGateway returns the service name and pod IP address of the NVMe-oF gateway
248+
// in the rook-ceph namespace with label "app=rook-ceph-nvmeof".
249+
func getNVMeofGateway(c kubernetes.Interface) (string, string) {
250+
ctx := context.TODO()
251+
labelSelector := "app=rook-ceph-nvmeof"
252+
253+
// Get the service
254+
svcList, err := c.CoreV1().Services(rookNamespace).List(ctx, metav1.ListOptions{
255+
LabelSelector: labelSelector,
256+
})
257+
Expect(err).ShouldNot(HaveOccurred())
258+
Expect(svcList.Items).NotTo(BeEmpty(), "no service found with label %s in namespace %s", labelSelector, rookNamespace)
259+
260+
serviceName := svcList.Items[0].Name
261+
262+
// Get the pod
263+
podList, err := c.CoreV1().Pods(rookNamespace).List(ctx, metav1.ListOptions{
264+
LabelSelector: labelSelector,
265+
})
266+
Expect(err).ShouldNot(HaveOccurred())
267+
Expect(podList.Items).NotTo(BeEmpty(), "no pod found with label %s in namespace %s", labelSelector, rookNamespace)
268+
269+
podIP := podList.Items[0].Status.PodIP
270+
Expect(podIP).NotTo(BeEmpty(), "pod IP is empty for pod %s", podList.Items[0].Name)
271+
272+
return serviceName, podIP
273+
}

e2e/nvmeof-gateway.go

Lines changed: 0 additions & 125 deletions
This file was deleted.

e2e/nvmeof.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ import (
3131
)
3232

3333
const (
34-
nvmeofPool = "nvmeofpool"
34+
// FIXME: if this tests runs parallel with RBD, a dedicated pool is needed
35+
nvmeofPool = defaultRBDPool
3536
)
3637

3738
var _ = ginkgo.Describe("nvmeof", func() {
@@ -70,9 +71,6 @@ var _ = ginkgo.Describe("nvmeof", func() {
7071

7172
framework.Logf("NVMe-oF testing supported, Ceph version: %s", version)
7273

73-
// FIXME: gateway should get deployed by Rook
74-
deployGateway(f, deployTimeout)
75-
7674
// No need to create the namespace if ceph-csi is deployed via helm or operator.
7775
if cephCSINamespace != defaultNs && !(helmTest || operatorDeployment) {
7876
err := createNamespace(f.ClientSet, cephCSINamespace)
@@ -123,7 +121,6 @@ var _ = ginkgo.Describe("nvmeof", func() {
123121
}
124122

125123
deleteNVMeoFPlugin()
126-
deleteGateway(f)
127124
deleteNVMeofStorageClass(f, nvmeofStorageClass)
128125
}, ginkgo.OncePerOrdered)
129126

e2e/nvmeof/config.yaml

Lines changed: 0 additions & 118 deletions
This file was deleted.

0 commit comments

Comments
 (0)