Skip to content

Commit 26a00f9

Browse files
committed
add ipv6 support to the e2e nfs tests
nfs mount command need to use the IP enclosed with square brackets if is an IPv6 address
1 parent e01f553 commit 26a00f9

File tree

5 files changed

+34
-30
lines changed

5 files changed

+34
-30
lines changed

test/e2e/common/volumes.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,14 @@ var _ = ginkgo.Describe("[sig-storage] GCP Volumes", func() {
7777
////////////////////////////////////////////////////////////////////////
7878
ginkgo.Describe("NFSv4", func() {
7979
ginkgo.It("should be mountable for NFSv4", func() {
80-
config, _, serverIP := e2evolume.NewNFSServer(c, namespace.Name, []string{})
80+
config, _, serverHost := e2evolume.NewNFSServer(c, namespace.Name, []string{})
8181
defer e2evolume.TestServerCleanup(f, config)
8282

8383
tests := []e2evolume.Test{
8484
{
8585
Volume: v1.VolumeSource{
8686
NFS: &v1.NFSVolumeSource{
87-
Server: serverIP,
87+
Server: serverHost,
8888
Path: "/",
8989
ReadOnly: true,
9090
},
@@ -101,14 +101,14 @@ var _ = ginkgo.Describe("[sig-storage] GCP Volumes", func() {
101101

102102
ginkgo.Describe("NFSv3", func() {
103103
ginkgo.It("should be mountable for NFSv3", func() {
104-
config, _, serverIP := e2evolume.NewNFSServer(c, namespace.Name, []string{})
104+
config, _, serverHost := e2evolume.NewNFSServer(c, namespace.Name, []string{})
105105
defer e2evolume.TestServerCleanup(f, config)
106106

107107
tests := []e2evolume.Test{
108108
{
109109
Volume: v1.VolumeSource{
110110
NFS: &v1.NFSVolumeSource{
111-
Server: serverIP,
111+
Server: serverHost,
112112
Path: "/exports",
113113
ReadOnly: true,
114114
},

test/e2e/framework/volume/fixtures.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ import (
4444
"fmt"
4545
"path/filepath"
4646
"strconv"
47+
"strings"
4748
"time"
4849

4950
v1 "k8s.io/api/core/v1"
@@ -143,7 +144,7 @@ type Test struct {
143144
}
144145

145146
// NewNFSServer is a NFS-specific wrapper for CreateStorageServer.
146-
func NewNFSServer(cs clientset.Interface, namespace string, args []string) (config TestConfig, pod *v1.Pod, ip string) {
147+
func NewNFSServer(cs clientset.Interface, namespace string, args []string) (config TestConfig, pod *v1.Pod, host string) {
147148
config = TestConfig{
148149
Namespace: namespace,
149150
Prefix: "nfs",
@@ -155,8 +156,11 @@ func NewNFSServer(cs clientset.Interface, namespace string, args []string) (conf
155156
if len(args) > 0 {
156157
config.ServerArgs = args
157158
}
158-
pod, ip = CreateStorageServer(cs, config)
159-
return config, pod, ip
159+
pod, host = CreateStorageServer(cs, config)
160+
if strings.Contains(host, ":") {
161+
host = "[" + host + "]"
162+
}
163+
return config, pod, host
160164
}
161165

162166
// NewGlusterfsServer is a GlusterFS-specific wrapper for CreateStorageServer. Also creates the gluster endpoints object.

test/e2e/storage/drivers/in_tree.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ type nfsDriver struct {
8181
}
8282

8383
type nfsVolume struct {
84-
serverIP string
85-
serverPod *v1.Pod
86-
f *framework.Framework
84+
serverHost string
85+
serverPod *v1.Pod
86+
f *framework.Framework
8787
}
8888

8989
var _ testsuites.TestDriver = &nfsDriver{}
@@ -129,7 +129,7 @@ func (n *nfsDriver) GetVolumeSource(readOnly bool, fsType string, e2evolume test
129129
framework.ExpectEqual(ok, true, "Failed to cast test volume to NFS test volume")
130130
return &v1.VolumeSource{
131131
NFS: &v1.NFSVolumeSource{
132-
Server: nv.serverIP,
132+
Server: nv.serverHost,
133133
Path: "/",
134134
ReadOnly: readOnly,
135135
},
@@ -141,7 +141,7 @@ func (n *nfsDriver) GetPersistentVolumeSource(readOnly bool, fsType string, e2ev
141141
framework.ExpectEqual(ok, true, "Failed to cast test volume to NFS test volume")
142142
return &v1.PersistentVolumeSource{
143143
NFS: &v1.NFSVolumeSource{
144-
Server: nv.serverIP,
144+
Server: nv.serverHost,
145145
Path: "/",
146146
ReadOnly: readOnly,
147147
},
@@ -199,12 +199,12 @@ func (n *nfsDriver) CreateVolume(config *testsuites.PerTestConfig, volType testp
199199
case testpatterns.InlineVolume:
200200
fallthrough
201201
case testpatterns.PreprovisionedPV:
202-
c, serverPod, serverIP := e2evolume.NewNFSServer(cs, ns.Name, []string{})
202+
c, serverPod, serverHost := e2evolume.NewNFSServer(cs, ns.Name, []string{})
203203
config.ServerConfig = &c
204204
return &nfsVolume{
205-
serverIP: serverIP,
206-
serverPod: serverPod,
207-
f: f,
205+
serverHost: serverHost,
206+
serverPod: serverPod,
207+
f: f,
208208
}
209209
case testpatterns.DynamicPV:
210210
// Do nothing

test/e2e/storage/nfs_persistent_volume-disruptive.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,15 @@ var _ = utils.SIGDescribe("NFSPersistentVolumes[Disruptive][Flaky]", func() {
7878

7979
f := framework.NewDefaultFramework("disruptive-pv")
8080
var (
81-
c clientset.Interface
82-
ns string
83-
nfsServerPod *v1.Pod
84-
nfsPVconfig e2epv.PersistentVolumeConfig
85-
pvcConfig e2epv.PersistentVolumeClaimConfig
86-
nfsServerIP, clientNodeIP string
87-
clientNode *v1.Node
88-
volLabel labels.Set
89-
selector *metav1.LabelSelector
81+
c clientset.Interface
82+
ns string
83+
nfsServerPod *v1.Pod
84+
nfsPVconfig e2epv.PersistentVolumeConfig
85+
pvcConfig e2epv.PersistentVolumeClaimConfig
86+
nfsServerHost, clientNodeIP string
87+
clientNode *v1.Node
88+
volLabel labels.Set
89+
selector *metav1.LabelSelector
9090
)
9191

9292
ginkgo.BeforeEach(func() {
@@ -99,13 +99,13 @@ var _ = utils.SIGDescribe("NFSPersistentVolumes[Disruptive][Flaky]", func() {
9999
volLabel = labels.Set{e2epv.VolumeSelectorKey: ns}
100100
selector = metav1.SetAsLabelSelector(volLabel)
101101
// Start the NFS server pod.
102-
_, nfsServerPod, nfsServerIP = e2evolume.NewNFSServer(c, ns, []string{"-G", "777", "/exports"})
102+
_, nfsServerPod, nfsServerHost = e2evolume.NewNFSServer(c, ns, []string{"-G", "777", "/exports"})
103103
nfsPVconfig = e2epv.PersistentVolumeConfig{
104104
NamePrefix: "nfs-",
105105
Labels: volLabel,
106106
PVSource: v1.PersistentVolumeSource{
107107
NFS: &v1.NFSVolumeSource{
108-
Server: nfsServerIP,
108+
Server: nfsServerHost,
109109
Path: "/exports",
110110
ReadOnly: false,
111111
},

test/e2e/storage/persistent_volumes.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,17 +123,17 @@ var _ = utils.SIGDescribe("PersistentVolumes", func() {
123123

124124
var (
125125
nfsServerPod *v1.Pod
126-
serverIP string
126+
serverHost string
127127
)
128128

129129
ginkgo.BeforeEach(func() {
130-
_, nfsServerPod, serverIP = e2evolume.NewNFSServer(c, ns, []string{"-G", "777", "/exports"})
130+
_, nfsServerPod, serverHost = e2evolume.NewNFSServer(c, ns, []string{"-G", "777", "/exports"})
131131
pvConfig = e2epv.PersistentVolumeConfig{
132132
NamePrefix: "nfs-",
133133
Labels: volLabel,
134134
PVSource: v1.PersistentVolumeSource{
135135
NFS: &v1.NFSVolumeSource{
136-
Server: serverIP,
136+
Server: serverHost,
137137
Path: "/exports",
138138
ReadOnly: false,
139139
},

0 commit comments

Comments
 (0)