Skip to content

Commit bec6879

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 bec6879

7 files changed

Lines changed: 29 additions & 442 deletions

File tree

e2e/nvmeof-deploy.go

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ func createNVMeoFStorageClass(
181181
Port int `json:"port"`
182182
}{
183183
{
184-
Hostname: gwHost, // FIXME: is this required?
184+
Hostname: gwHost, // short-hostname, without domain
185185
Address: gwIP,
186186
Port: 4420,
187187
},
@@ -242,3 +242,31 @@ func createNVMeoFCredentials(f *framework.Framework) {
242242
err = createRBDSecret(f, nvmeofNodePluginSecretName, nvmeofKeyringNodePluginUsername, key)
243243
Expect(err).ShouldNot(HaveOccurred())
244244
}
245+
246+
// getNVMeofGateway returns the service name and pod IP address of the NVMe-oF gateway
247+
// in the rook-ceph namespace with label "app=rook-ceph-nvmeof".
248+
func getNVMeofGateway(c kubernetes.Interface) (string, string) {
249+
ctx := context.TODO()
250+
labelSelector := "app=rook-ceph-nvmeof"
251+
252+
// Get the service
253+
svcList, err := c.CoreV1().Services(rookNamespace).List(ctx, metav1.ListOptions{
254+
LabelSelector: labelSelector,
255+
})
256+
Expect(err).ShouldNot(HaveOccurred())
257+
Expect(svcList.Items).NotTo(BeEmpty(), "no service found with label %s in namespace %s", labelSelector, rookNamespace)
258+
259+
serviceName := svcList.Items[0].Name
260+
261+
// Get the pod
262+
podList, err := c.CoreV1().Pods(rookNamespace).List(ctx, metav1.ListOptions{
263+
LabelSelector: labelSelector,
264+
})
265+
Expect(err).ShouldNot(HaveOccurred())
266+
Expect(podList.Items).NotTo(BeEmpty(), "no pod found with label %s in namespace %s", labelSelector, rookNamespace)
267+
268+
podIP := podList.Items[0].Status.PodIP
269+
Expect(podIP).NotTo(BeEmpty(), "pod IP is empty for pod %s", podList.Items[0].Name)
270+
271+
return serviceName, podIP
272+
}

e2e/nvmeof-gateway.go

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

e2e/nvmeof.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,6 @@ var _ = ginkgo.Describe("nvmeof", func() {
7070

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

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

125122
deleteNVMeoFPlugin()
126-
deleteGateway(f)
127123
deleteNVMeofStorageClass(f, nvmeofStorageClass)
128124
}, ginkgo.OncePerOrdered)
129125

e2e/nvmeof/config.yaml

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

0 commit comments

Comments
 (0)