Skip to content

Commit

Permalink
Merge pull request kubernetes#50243 from mborsz/node
Browse files Browse the repository at this point in the history
Automatic merge from submit-queue (batch tested with PRs 50091, 50231, 50238, 50236, 50243)

Fix storage tests for multizone test configuration.

**What this PR does / why we need it**:
This PR modifies "[sig-storage] Volumes PD should be mountable with (ext3|ext4)" tests to schedule pods in zone, where PD is created.
This is to make the test work in multizone environment.

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #

**Special notes for your reviewer**:

**Release note**:
```release-note
```
  • Loading branch information
Kubernetes Submit Queue committed Aug 7, 2017
2 parents 2d5729e + 6d789ee commit fddc7f3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
9 changes: 7 additions & 2 deletions test/e2e/framework/volume_util.go
Expand Up @@ -100,6 +100,8 @@ type VolumeTestConfig struct {
ServerNodeName string
// ClientNodeName is the spec.nodeName to run client pod on. Default is any node.
ClientNodeName string
// NodeSelector to use in pod spec (server, client and injector pods).
NodeSelector map[string]string
}

// VolumeTest contains a volume to mount into a client pod and its
Expand Down Expand Up @@ -286,6 +288,7 @@ func StartVolumeServer(client clientset.Interface, config VolumeTestConfig) *v1.
Volumes: volumes,
RestartPolicy: restartPolicy,
NodeName: config.ServerNodeName,
NodeSelector: config.NodeSelector,
},
}

Expand Down Expand Up @@ -390,8 +393,9 @@ func TestVolumeClient(client clientset.Interface, config VolumeTestConfig, fsGro
Level: "s0:c0,c1",
},
},
Volumes: []v1.Volume{},
NodeName: config.ClientNodeName,
Volumes: []v1.Volume{},
NodeName: config.ClientNodeName,
NodeSelector: config.NodeSelector,
},
}
podsNamespacer := client.CoreV1().Pods(config.Namespace)
Expand Down Expand Up @@ -476,6 +480,7 @@ func InjectHtml(client clientset.Interface, config VolumeTestConfig, volume v1.V
VolumeSource: volume,
},
},
NodeSelector: config.NodeSelector,
},
}

Expand Down
6 changes: 6 additions & 0 deletions test/e2e/storage/volumes.go
Expand Up @@ -54,6 +54,7 @@ import (
"k8s.io/apimachinery/pkg/types"
clientset "k8s.io/client-go/kubernetes"
"k8s.io/kubernetes/pkg/cloudprovider/providers/vsphere"
kubeletapis "k8s.io/kubernetes/pkg/kubelet/apis"
"k8s.io/kubernetes/test/e2e/framework"
)

Expand Down Expand Up @@ -429,6 +430,11 @@ var _ = SIGDescribe("Volumes", func() {
config = framework.VolumeTestConfig{
Namespace: namespace.Name,
Prefix: "pd",
// PD will be created in framework.TestContext.CloudConfig.Zone zone,
// so pods should be also scheduled there.
NodeSelector: map[string]string{
kubeletapis.LabelZoneFailureDomain: framework.TestContext.CloudConfig.Zone,
},
}
})

Expand Down

0 comments on commit fddc7f3

Please sign in to comment.