mirror of https://github.com/k3s-io/k3s
Merge pull request #61111 from jsafrane/fix-subpath-multizone
Automatic merge from submit-queue (batch tested with PRs 61111, 61069). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Fix subpath e2e tests on multizone cluster. Use dynamically provisioned PV to run GCE PD tests. This will make sure that the pod is scheduled to the right zone and GCE PD can be attached to a node. **Which issue(s) this PR fixes**: Fixes #61101 **Release note**: ```release-note NONE ``` /sig storage @msau42 @verultpull/6/head
commit
32343b7f3d
|
@ -667,7 +667,7 @@ func (s *emptydirSource) cleanupVolume(f *framework.Framework) {
|
||||||
}
|
}
|
||||||
|
|
||||||
type gcepdSource struct {
|
type gcepdSource struct {
|
||||||
diskName string
|
pvc *v1.PersistentVolumeClaim
|
||||||
}
|
}
|
||||||
|
|
||||||
func initGCEPD() volSource {
|
func initGCEPD() volSource {
|
||||||
|
@ -678,21 +678,29 @@ func initGCEPD() volSource {
|
||||||
func (s *gcepdSource) createVolume(f *framework.Framework) volInfo {
|
func (s *gcepdSource) createVolume(f *framework.Framework) volInfo {
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
framework.Logf("Creating GCE PD volume")
|
framework.Logf("Creating GCE PD volume via dynamic provisioning")
|
||||||
s.diskName, err = framework.CreatePDWithRetry()
|
testCase := storageClassTest{
|
||||||
framework.ExpectNoError(err, "Error creating PD")
|
name: "subpath",
|
||||||
|
claimSize: "2G",
|
||||||
|
}
|
||||||
|
|
||||||
|
pvc := newClaim(testCase, f.Namespace.Name, "subpath")
|
||||||
|
s.pvc, err = framework.CreatePVC(f.ClientSet, f.Namespace.Name, pvc)
|
||||||
|
framework.ExpectNoError(err, "Error creating PVC")
|
||||||
|
|
||||||
return volInfo{
|
return volInfo{
|
||||||
source: &v1.VolumeSource{
|
source: &v1.VolumeSource{
|
||||||
GCEPersistentDisk: &v1.GCEPersistentDiskVolumeSource{PDName: s.diskName},
|
PersistentVolumeClaim: &v1.PersistentVolumeClaimVolumeSource{
|
||||||
|
ClaimName: s.pvc.Name,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *gcepdSource) cleanupVolume(f *framework.Framework) {
|
func (s *gcepdSource) cleanupVolume(f *framework.Framework) {
|
||||||
if s.diskName != "" {
|
if s.pvc != nil {
|
||||||
err := framework.DeletePDWithRetry(s.diskName)
|
err := f.ClientSet.CoreV1().PersistentVolumeClaims(f.Namespace.Name).Delete(s.pvc.Name, nil)
|
||||||
framework.ExpectNoError(err, "Error deleting PD")
|
framework.ExpectNoError(err, "Error deleting PVC")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue