mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 14:37:00 +00:00
Merge pull request #7734 from markturansky/iscsi_pv2
Added ISCSI to PV structs
This commit is contained in:
commit
9b2a0df811
@ -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
|
||||
|
@ -2245,6 +2245,14 @@ func convert_v1beta3_PersistentVolumeSource_To_api_PersistentVolumeSource(in *Pe
|
||||
} else {
|
||||
out.HostPath = nil
|
||||
}
|
||||
if in.ISCSI != nil {
|
||||
out.ISCSI = new(newer.ISCSIVolumeSource)
|
||||
if err := convert_v1beta3_ISCSIVolumeSource_To_api_ISCSIVolumeSource(in.ISCSI, out.ISCSI, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.ISCSI = nil
|
||||
}
|
||||
if in.Glusterfs != nil {
|
||||
out.Glusterfs = new(newer.GlusterfsVolumeSource)
|
||||
if err := convert_v1beta3_GlusterfsVolumeSource_To_api_GlusterfsVolumeSource(in.Glusterfs, out.Glusterfs, s); err != nil {
|
||||
@ -2292,6 +2300,14 @@ func convert_api_PersistentVolumeSource_To_v1beta3_PersistentVolumeSource(in *ne
|
||||
} else {
|
||||
out.HostPath = nil
|
||||
}
|
||||
if in.ISCSI != nil {
|
||||
out.ISCSI = new(ISCSIVolumeSource)
|
||||
if err := convert_api_ISCSIVolumeSource_To_v1beta3_ISCSIVolumeSource(in.ISCSI, out.ISCSI, s); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
out.ISCSI = nil
|
||||
}
|
||||
if in.Glusterfs != nil {
|
||||
out.Glusterfs = new(GlusterfsVolumeSource)
|
||||
if err := convert_api_GlusterfsVolumeSource_To_v1beta3_GlusterfsVolumeSource(in.Glusterfs, out.Glusterfs, s); err != nil {
|
||||
|
@ -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