mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-29 21:29:24 +00:00
Merge pull request #64447 from jsafrane/block-provision
Automatic merge from submit-queue (batch tested with PRs 63348, 63839, 63143, 64447, 64567). 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>. Add block volume support to internal provisioners. **What this PR does / why we need it**: Internal provisioners now create filesystem PVs when block PVs are requested. This leads to unbindable PVCs. In this PR, volume plugins that support block volumes provision block PVs when block is requested. All the other provisioners return clear error in `kubectl describe pvc`: ``` Events: Type Reason Age From Message ---- ------ ---- ---- ------- Warning ProvisioningFailed 7s (x2 over 18s) persistentvolume-controller Failed to provision volume with StorageClass "standard": kubernetes.io/cinder does not support block volume provisioning ``` ```release-note NONE ``` cc @kubernetes/vmware for vsphere changes cc @andyzhangx for Azure changes /assign @copejon @mtanino
This commit is contained in:
@@ -57,6 +57,7 @@ type storageClassTest struct {
|
||||
pvCheck func(volume *v1.PersistentVolume) error
|
||||
nodeName string
|
||||
attach bool
|
||||
volumeMode *v1.PersistentVolumeMode
|
||||
}
|
||||
|
||||
const (
|
||||
@@ -120,6 +121,10 @@ func testDynamicProvisioning(t storageClassTest, client clientset.Interface, cla
|
||||
Expect(pv.Spec.PersistentVolumeReclaimPolicy).To(Equal(*class.ReclaimPolicy))
|
||||
Expect(pv.Spec.MountOptions).To(Equal(class.MountOptions))
|
||||
}
|
||||
if t.volumeMode != nil {
|
||||
Expect(pv.Spec.VolumeMode).NotTo(BeNil())
|
||||
Expect(*pv.Spec.VolumeMode).To(Equal(*t.volumeMode))
|
||||
}
|
||||
|
||||
// Run the checker
|
||||
if t.pvCheck != nil {
|
||||
@@ -818,6 +823,34 @@ var _ = utils.SIGDescribe("Dynamic Provisioning", func() {
|
||||
testDynamicProvisioning(test, c, claim, class)
|
||||
})
|
||||
})
|
||||
|
||||
Describe("Block volume provisioning [Feature:BlockVolume]", func() {
|
||||
It("should create and delete block persistent volumes", func() {
|
||||
|
||||
// TODO: add openstack once Cinder volume plugin supports block volumes
|
||||
framework.SkipUnlessProviderIs("gce", "aws", "gke", "vsphere", "azure")
|
||||
|
||||
By("creating a claim with default class")
|
||||
block := v1.PersistentVolumeBlock
|
||||
test := storageClassTest{
|
||||
name: "default",
|
||||
claimSize: "2Gi",
|
||||
expectedSize: "2Gi",
|
||||
volumeMode: &block,
|
||||
}
|
||||
// gce or gke
|
||||
if getDefaultPluginName() == "kubernetes.io/gce-pd" {
|
||||
// using GB not GiB as e2e test unit since gce-pd returns GB,
|
||||
// or expectedSize may be greater than claimSize.
|
||||
test.claimSize = "2G"
|
||||
test.expectedSize = "2G"
|
||||
}
|
||||
|
||||
claim := newClaim(test, ns, "default")
|
||||
claim.Spec.VolumeMode = &block
|
||||
testDynamicProvisioning(test, c, claim, nil)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
func getDefaultStorageClassName(c clientset.Interface) string {
|
||||
|
||||
Reference in New Issue
Block a user