mirror of https://github.com/k3s-io/k3s
Merge pull request #8732 from markturansky/missing_pv_support
Fixed CanSupport func across all volumes (for PV)pull/6/head
commit
0bbba1c3d1
|
@ -40,6 +40,9 @@ func TestCanSupport(t *testing.T) {
|
||||||
if !plug.CanSupport(&volume.Spec{Name: "foo", VolumeSource: api.VolumeSource{AWSElasticBlockStore: &api.AWSElasticBlockStoreVolumeSource{}}}) {
|
if !plug.CanSupport(&volume.Spec{Name: "foo", VolumeSource: api.VolumeSource{AWSElasticBlockStore: &api.AWSElasticBlockStoreVolumeSource{}}}) {
|
||||||
t.Errorf("Expected true")
|
t.Errorf("Expected true")
|
||||||
}
|
}
|
||||||
|
if !plug.CanSupport(&volume.Spec{Name: "foo", PersistentVolumeSource: api.PersistentVolumeSource{AWSElasticBlockStore: &api.AWSElasticBlockStoreVolumeSource{}}}) {
|
||||||
|
t.Errorf("Expected true")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGetAccessModes(t *testing.T) {
|
func TestGetAccessModes(t *testing.T) {
|
||||||
|
|
|
@ -40,6 +40,9 @@ func TestCanSupport(t *testing.T) {
|
||||||
if !plug.CanSupport(&volume.Spec{Name: "foo", VolumeSource: api.VolumeSource{GCEPersistentDisk: &api.GCEPersistentDiskVolumeSource{}}}) {
|
if !plug.CanSupport(&volume.Spec{Name: "foo", VolumeSource: api.VolumeSource{GCEPersistentDisk: &api.GCEPersistentDiskVolumeSource{}}}) {
|
||||||
t.Errorf("Expected true")
|
t.Errorf("Expected true")
|
||||||
}
|
}
|
||||||
|
if !plug.CanSupport(&volume.Spec{Name: "foo", PersistentVolumeSource: api.PersistentVolumeSource{GCEPersistentDisk: &api.GCEPersistentDiskVolumeSource{}}}) {
|
||||||
|
t.Errorf("Expected true")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGetAccessModes(t *testing.T) {
|
func TestGetAccessModes(t *testing.T) {
|
||||||
|
|
|
@ -40,6 +40,9 @@ func TestCanSupport(t *testing.T) {
|
||||||
if !plug.CanSupport(&volume.Spec{Name: "foo", VolumeSource: api.VolumeSource{Glusterfs: &api.GlusterfsVolumeSource{}}}) {
|
if !plug.CanSupport(&volume.Spec{Name: "foo", VolumeSource: api.VolumeSource{Glusterfs: &api.GlusterfsVolumeSource{}}}) {
|
||||||
t.Errorf("Expected true")
|
t.Errorf("Expected true")
|
||||||
}
|
}
|
||||||
|
if !plug.CanSupport(&volume.Spec{Name: "foo", PersistentVolumeSource: api.PersistentVolumeSource{Glusterfs: &api.GlusterfsVolumeSource{}}}) {
|
||||||
|
t.Errorf("Expected true")
|
||||||
|
}
|
||||||
if plug.CanSupport(&volume.Spec{Name: "foo", VolumeSource: api.VolumeSource{}}) {
|
if plug.CanSupport(&volume.Spec{Name: "foo", VolumeSource: api.VolumeSource{}}) {
|
||||||
t.Errorf("Expected false")
|
t.Errorf("Expected false")
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,9 @@ func TestCanSupport(t *testing.T) {
|
||||||
if !plug.CanSupport(&volume.Spec{Name: "foo", VolumeSource: api.VolumeSource{HostPath: &api.HostPathVolumeSource{}}}) {
|
if !plug.CanSupport(&volume.Spec{Name: "foo", VolumeSource: api.VolumeSource{HostPath: &api.HostPathVolumeSource{}}}) {
|
||||||
t.Errorf("Expected true")
|
t.Errorf("Expected true")
|
||||||
}
|
}
|
||||||
|
if !plug.CanSupport(&volume.Spec{Name: "foo", PersistentVolumeSource: api.PersistentVolumeSource{HostPath: &api.HostPathVolumeSource{}}}) {
|
||||||
|
t.Errorf("Expected true")
|
||||||
|
}
|
||||||
if plug.CanSupport(&volume.Spec{Name: "foo", VolumeSource: api.VolumeSource{}}) {
|
if plug.CanSupport(&volume.Spec{Name: "foo", VolumeSource: api.VolumeSource{}}) {
|
||||||
t.Errorf("Expected false")
|
t.Errorf("Expected false")
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,9 @@ func TestCanSupport(t *testing.T) {
|
||||||
if plug.Name() != "kubernetes.io/iscsi" {
|
if plug.Name() != "kubernetes.io/iscsi" {
|
||||||
t.Errorf("Wrong name: %s", plug.Name())
|
t.Errorf("Wrong name: %s", plug.Name())
|
||||||
}
|
}
|
||||||
|
if plug.CanSupport(&volume.Spec{Name: "foo", VolumeSource: api.VolumeSource{}}) {
|
||||||
|
t.Errorf("Expected false")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGetAccessModes(t *testing.T) {
|
func TestGetAccessModes(t *testing.T) {
|
||||||
|
|
|
@ -53,7 +53,7 @@ func (plugin *RBDPlugin) Name() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (plugin *RBDPlugin) CanSupport(spec *volume.Spec) bool {
|
func (plugin *RBDPlugin) CanSupport(spec *volume.Spec) bool {
|
||||||
if spec.VolumeSource.RBD == nil {
|
if spec.VolumeSource.RBD == nil && spec.PersistentVolumeSource.RBD == nil {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
// see if rbd is there
|
// see if rbd is there
|
||||||
|
|
|
@ -37,6 +37,9 @@ func TestCanSupport(t *testing.T) {
|
||||||
if plug.Name() != "kubernetes.io/rbd" {
|
if plug.Name() != "kubernetes.io/rbd" {
|
||||||
t.Errorf("Wrong name: %s", plug.Name())
|
t.Errorf("Wrong name: %s", plug.Name())
|
||||||
}
|
}
|
||||||
|
if plug.CanSupport(&volume.Spec{Name: "foo", VolumeSource: api.VolumeSource{}}) {
|
||||||
|
t.Errorf("Expected false")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type fakeDiskManager struct{}
|
type fakeDiskManager struct{}
|
||||||
|
|
Loading…
Reference in New Issue