mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-25 03:21:15 +00:00
Added ISCSI to PV structs
This commit is contained in:
parent
5074e98ee9
commit
4c9eac6c3d
@ -220,6 +220,9 @@ type PersistentVolumeSource struct {
|
||||
// This is useful for development and testing only.
|
||||
// on-host storage is not supported in any way
|
||||
HostPath *HostPathVolumeSource `json:"hostPath"`
|
||||
// ISCSIVolumeSource represents an ISCSI resource that is attached to a
|
||||
// kubelet's host machine and then exposed to the pod.
|
||||
ISCSI *ISCSIVolumeSource `json:"iscsi"`
|
||||
// Glusterfs represents a Glusterfs volume that is attached to a host and exposed to the pod
|
||||
Glusterfs *GlusterfsVolumeSource `json:"glusterfs"`
|
||||
// NFS represents an NFS mount on the host that shares a pod's lifetime
|
||||
|
@ -1606,6 +1606,9 @@ func init() {
|
||||
if err := s.Convert(&in.HostPath, &out.HostPath, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.Convert(&in.ISCSI, &out.ISCSI, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.Convert(&in.Glusterfs, &out.Glusterfs, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
@ -1624,6 +1627,9 @@ func init() {
|
||||
if err := s.Convert(&in.HostPath, &out.HostPath, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.Convert(&in.ISCSI, &out.ISCSI, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.Convert(&in.Glusterfs, &out.Glusterfs, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -245,6 +245,9 @@ type PersistentVolumeSource struct {
|
||||
// This is useful for development and testing only.
|
||||
// on-host storage is not supported in any way.
|
||||
HostPath *HostPathVolumeSource `json:"hostPath" description:"a HostPath provisioned by a developer or tester; for develment use only"`
|
||||
// ISCSI represents an ISCSI Disk resource that is attached to a
|
||||
// kubelet's host machine and then exposed to the pod.
|
||||
ISCSI *ISCSIVolumeSource `json:"iscsi" description:"an iSCSI disk resource provisioned by an admin"`
|
||||
// Glusterfs represents a Glusterfs volume that is attached to a host and exposed to the pod
|
||||
Glusterfs *GlusterfsVolumeSource `json:"glusterfs" description:"Glusterfs volume resource provisioned by an admin"`
|
||||
// NFS represents an NFS mount on the host
|
||||
|
@ -143,6 +143,9 @@ type PersistentVolumeSource struct {
|
||||
// This is useful for development and testing only.
|
||||
// on-host storage is not supported in any way.
|
||||
HostPath *HostPathVolumeSource `json:"hostPath" description:"a HostPath provisioned by a developer or tester; for develment use only"`
|
||||
// ISCSI represents an ISCSI Disk resource that is attached to a
|
||||
// kubelet's host machine and then exposed to the pod.
|
||||
ISCSI *ISCSIVolumeSource `json:"iscsi" description:"an iSCSI disk resource provisioned by an admin"`
|
||||
// Glusterfs represents a Glusterfs volume that is attached to a host and exposed to the pod
|
||||
Glusterfs *GlusterfsVolumeSource `json:"glusterfs" description:"Glusterfs volume resource provisioned by an admin"`
|
||||
// NFS represents an NFS mount on the host
|
||||
|
@ -105,6 +105,9 @@ type PersistentVolumeSource struct {
|
||||
// This is useful for development and testing only.
|
||||
// on-host storage is not supported in any way.
|
||||
HostPath *HostPathVolumeSource `json:"hostPath" description:"a HostPath provisioned by a developer or tester; for develment use only"`
|
||||
// ISCSI represents an ISCSI Disk resource that is attached to a
|
||||
// kubelet's host machine and then exposed to the pod.
|
||||
ISCSI *ISCSIVolumeSource `json:"iscsi" description:"an iSCSI disk resource provisioned by an admin"`
|
||||
// Glusterfs represents a Glusterfs volume that is attached to a host and exposed to the pod
|
||||
Glusterfs *GlusterfsVolumeSource `json:"glusterfs" description:"Glusterfs volume resource provisioned by an admin"`
|
||||
// NFS represents an NFS mount on the host
|
||||
|
@ -245,6 +245,9 @@ type PersistentVolumeSource struct {
|
||||
// This is useful for development and testing only.
|
||||
// on-host storage is not supported in any way.
|
||||
HostPath *HostPathVolumeSource `json:"hostPath" description:"a HostPath provisioned by a developer or tester; for develment use only"`
|
||||
// ISCSI represents an ISCSI Disk resource that is attached to a
|
||||
// kubelet's host machine and then exposed to the pod.
|
||||
ISCSI *ISCSIVolumeSource `json:"iscsi" description:"an iSCSI disk resource provisioned by an admin"`
|
||||
// Glusterfs represents a Glusterfs volume that is attached to a host and exposed to the pod
|
||||
Glusterfs *GlusterfsVolumeSource `json:"glusterfs" description:"Glusterfs volume resource provisioned by an admin"`
|
||||
// NFS represents an NFS mount on the host
|
||||
|
@ -461,6 +461,10 @@ func ValidatePersistentVolume(pv *api.PersistentVolume) errs.ValidationErrorList
|
||||
numVolumes++
|
||||
allErrs = append(allErrs, validateAWSElasticBlockStoreVolumeSource(pv.Spec.AWSElasticBlockStore).Prefix("awsElasticBlockStore")...)
|
||||
}
|
||||
if pv.Spec.ISCSI != nil {
|
||||
numVolumes++
|
||||
allErrs = append(allErrs, validateISCSIVolumeSource(pv.Spec.ISCSI).Prefix("iscsi")...)
|
||||
}
|
||||
if pv.Spec.Glusterfs != nil {
|
||||
numVolumes++
|
||||
allErrs = append(allErrs, validateGlusterfs(pv.Spec.Glusterfs).Prefix("glusterfs")...)
|
||||
|
@ -39,6 +39,28 @@ func TestCanSupport(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetAccessModes(t *testing.T) {
|
||||
plugMgr := volume.VolumePluginMgr{}
|
||||
plugMgr.InitPlugins(ProbeVolumePlugins(), volume.NewFakeVolumeHost("/tmp/fake", nil, nil))
|
||||
|
||||
plug, err := plugMgr.FindPersistentPluginByName("kubernetes.io/iscsi")
|
||||
if err != nil {
|
||||
t.Errorf("Can't find the plugin by name")
|
||||
}
|
||||
if !contains(plug.GetAccessModes(), api.ReadWriteOnce) || !contains(plug.GetAccessModes(), api.ReadOnlyMany) {
|
||||
t.Errorf("Expected two AccessModeTypes: %s and %s", api.ReadWriteOnce, api.ReadOnlyMany)
|
||||
}
|
||||
}
|
||||
|
||||
func contains(modes []api.AccessModeType, mode api.AccessModeType) bool {
|
||||
for _, m := range modes {
|
||||
if m == mode {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type fakeDiskManager struct {
|
||||
attachCalled bool
|
||||
detachCalled bool
|
||||
|
Loading…
Reference in New Issue
Block a user