mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-12-03 06:43:53 +00:00
Portworx Volume Driver in Kubernetes
- Add a new type PortworxVolumeSource - Implement the kubernetes volume plugin for Portworx Volumes under pkg/volume/portworx - The Portworx Volume Driver uses the libopenstorage/openstorage specifications and apis for volume operations. Changes for k8s configuration and examples for portworx volumes. - Add PortworxVolume hooks in kubectl, kube-controller-manager and validation. - Add a README for PortworxVolume usage as PVs, PVCs and StorageClass. - Add example spec files Handle code review comments. - Modified READMEs to incorporate to suggestions. - Add a test for ReadWriteMany access mode. - Use util.UnmountPath in TearDown. - Add ReadOnly flag to PortworxVolumeSource - Use hostname:port instead of unix sockets - Delete the mount dir in TearDown. - Fix link issue in persistentvolumes README - In unit test check for mountpath after Setup is done. - Add PVC Claim Name as a Portworx Volume Label Generated code and documentation. - Updated swagger spec - Updated api-reference docs - Updated generated code under pkg/api/v1 Godeps update for Portworx Volume Driver - Adds github.com/libopenstorage/openstorage - Adds go.pedge.io/pb/go/google/protobuf - Updates Godep Licenses
This commit is contained in:
@@ -296,6 +296,9 @@ type VolumeSource struct {
|
||||
PhotonPersistentDisk *PhotonPersistentDiskVolumeSource
|
||||
// Items for all in one resources secrets, configmaps, and downward API
|
||||
Projected *ProjectedVolumeSource
|
||||
// PortworxVolume represents a portworx volume attached and mounted on kubelets host machine
|
||||
// +optional
|
||||
PortworxVolume *PortworxVolumeSource
|
||||
}
|
||||
|
||||
// Similar to VolumeSource but meant for the administrator who creates PVs.
|
||||
@@ -358,6 +361,9 @@ type PersistentVolumeSource struct {
|
||||
AzureDisk *AzureDiskVolumeSource
|
||||
// PhotonPersistentDisk represents a Photon Controller persistent disk attached and mounted on kubelets host machine
|
||||
PhotonPersistentDisk *PhotonPersistentDiskVolumeSource
|
||||
// PortworxVolume represents a portworx volume attached and mounted on kubelets host machine
|
||||
// +optional
|
||||
PortworxVolume *PortworxVolumeSource
|
||||
}
|
||||
|
||||
type PersistentVolumeClaimVolumeSource struct {
|
||||
@@ -1001,6 +1007,21 @@ type PhotonPersistentDiskVolumeSource struct {
|
||||
FSType string
|
||||
}
|
||||
|
||||
// PortworxVolumeSource represents a Portworx volume resource.
|
||||
type PortworxVolumeSource struct {
|
||||
// VolumeID uniquely identifies a Portworx volume
|
||||
VolumeID string
|
||||
// FSType represents the filesystem type to mount
|
||||
// Must be a filesystem type supported by the host operating system.
|
||||
// Ex. "ext4", "xfs". Implicitly inferred to be "ext4" if unspecified.
|
||||
// +optional
|
||||
FSType string
|
||||
// Defaults to false (read/write). ReadOnly here will force
|
||||
// the ReadOnly setting in VolumeMounts.
|
||||
// +optional
|
||||
ReadOnly bool
|
||||
}
|
||||
|
||||
type AzureDataDiskCachingMode string
|
||||
|
||||
const (
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2128,6 +2128,10 @@ message PersistentVolumeSource {
|
||||
|
||||
// PhotonPersistentDisk represents a PhotonController persistent disk attached and mounted on kubelets host machine
|
||||
optional PhotonPersistentDiskVolumeSource photonPersistentDisk = 17;
|
||||
|
||||
// PortworxVolume represents a portworx volume attached and mounted on kubelets host machine
|
||||
// +optional
|
||||
optional PortworxVolumeSource portworxVolume = 18;
|
||||
}
|
||||
|
||||
// PersistentVolumeSpec is the specification of a persistent volume.
|
||||
@@ -2790,6 +2794,22 @@ message PodTemplateSpec {
|
||||
optional PodSpec spec = 2;
|
||||
}
|
||||
|
||||
// PortworxVolumeSource represents a Portworx volume resource.
|
||||
message PortworxVolumeSource {
|
||||
// VolumeID uniquely identifies a Portworx volume
|
||||
optional string volumeID = 1;
|
||||
|
||||
// FSType represents the filesystem type to mount
|
||||
// Must be a filesystem type supported by the host operating system.
|
||||
// Ex. "ext4", "xfs". Implicitly inferred to be "ext4" if unspecified.
|
||||
optional string fsType = 2;
|
||||
|
||||
// Defaults to false (read/write). ReadOnly here will force
|
||||
// the ReadOnly setting in VolumeMounts.
|
||||
// +optional
|
||||
optional bool readOnly = 3;
|
||||
}
|
||||
|
||||
// Preconditions must be fulfilled before an operation (update, delete, etc.) is carried out.
|
||||
// +k8s:openapi-gen=false
|
||||
message Preconditions {
|
||||
@@ -3811,7 +3831,11 @@ message VolumeSource {
|
||||
optional PhotonPersistentDiskVolumeSource photonPersistentDisk = 23;
|
||||
|
||||
// Items for all in one resources secrets, configmaps, and downward API
|
||||
optional ProjectedVolumeSource projected = 24;
|
||||
optional ProjectedVolumeSource projected = 25;
|
||||
|
||||
// PortworxVolume represents a portworx volume attached and mounted on kubelets host machine
|
||||
// +optional
|
||||
optional PortworxVolumeSource portworxVolume = 24;
|
||||
}
|
||||
|
||||
// Represents a vSphere volume resource.
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -328,6 +328,9 @@ type VolumeSource struct {
|
||||
PhotonPersistentDisk *PhotonPersistentDiskVolumeSource `json:"photonPersistentDisk,omitempty" protobuf:"bytes,23,opt,name=photonPersistentDisk"`
|
||||
// Items for all in one resources secrets, configmaps, and downward API
|
||||
Projected *ProjectedVolumeSource `json:"projected,omitempty"`
|
||||
// PortworxVolume represents a portworx volume attached and mounted on kubelets host machine
|
||||
// +optional
|
||||
PortworxVolume *PortworxVolumeSource `json:"portworxVolume,omitempty" protobuf:"bytes,24,opt,name=portworxVolume"`
|
||||
}
|
||||
|
||||
// PersistentVolumeClaimVolumeSource references the user's PVC in the same namespace.
|
||||
@@ -413,6 +416,9 @@ type PersistentVolumeSource struct {
|
||||
AzureDisk *AzureDiskVolumeSource `json:"azureDisk,omitempty" protobuf:"bytes,16,opt,name=azureDisk"`
|
||||
// PhotonPersistentDisk represents a PhotonController persistent disk attached and mounted on kubelets host machine
|
||||
PhotonPersistentDisk *PhotonPersistentDiskVolumeSource `json:"photonPersistentDisk,omitempty" protobuf:"bytes,17,opt,name=photonPersistentDisk"`
|
||||
// PortworxVolume represents a portworx volume attached and mounted on kubelets host machine
|
||||
// +optional
|
||||
PortworxVolume *PortworxVolumeSource `json:"portworxVolume,omitempty" protobuf:"bytes,18,opt,name=portworxVolume"`
|
||||
}
|
||||
|
||||
// +genclient=true
|
||||
@@ -1107,6 +1113,20 @@ type AzureDiskVolumeSource struct {
|
||||
ReadOnly *bool `json:"readOnly,omitempty" protobuf:"varint,5,opt,name=readOnly"`
|
||||
}
|
||||
|
||||
// PortworxVolumeSource represents a Portworx volume resource.
|
||||
type PortworxVolumeSource struct {
|
||||
// VolumeID uniquely identifies a Portworx volume
|
||||
VolumeID string `json:"volumeID" protobuf:"bytes,1,opt,name=volumeID"`
|
||||
// FSType represents the filesystem type to mount
|
||||
// Must be a filesystem type supported by the host operating system.
|
||||
// Ex. "ext4", "xfs". Implicitly inferred to be "ext4" if unspecified.
|
||||
FSType string `json:"fsType,omitempty" protobuf:"bytes,2,opt,name=fsType"`
|
||||
// Defaults to false (read/write). ReadOnly here will force
|
||||
// the ReadOnly setting in VolumeMounts.
|
||||
// +optional
|
||||
ReadOnly bool `json:"readOnly,omitempty" protobuf:"varint,3,opt,name=readOnly"`
|
||||
}
|
||||
|
||||
// Adapts a ConfigMap into a volume.
|
||||
//
|
||||
// The contents of the target ConfigMap's Data field will be presented in a
|
||||
|
||||
@@ -1122,6 +1122,7 @@ var map_PersistentVolumeSource = map[string]string{
|
||||
"quobyte": "Quobyte represents a Quobyte mount on the host that shares a pod's lifetime",
|
||||
"azureDisk": "AzureDisk represents an Azure Data Disk mount on the host and bind mount to the pod.",
|
||||
"photonPersistentDisk": "PhotonPersistentDisk represents a PhotonController persistent disk attached and mounted on kubelets host machine",
|
||||
"portworxVolume": "PortworxVolume represents a portworx volume attached and mounted on kubelets host machine",
|
||||
}
|
||||
|
||||
func (PersistentVolumeSource) SwaggerDoc() map[string]string {
|
||||
@@ -1399,6 +1400,17 @@ func (PodTemplateSpec) SwaggerDoc() map[string]string {
|
||||
return map_PodTemplateSpec
|
||||
}
|
||||
|
||||
var map_PortworxVolumeSource = map[string]string{
|
||||
"": "PortworxVolumeSource represents a Portworx volume resource.",
|
||||
"volumeID": "VolumeID uniquely identifies a Portworx volume",
|
||||
"fsType": "FSType represents the filesystem type to mount Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\". Implicitly inferred to be \"ext4\" if unspecified.",
|
||||
"readOnly": "Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts.",
|
||||
}
|
||||
|
||||
func (PortworxVolumeSource) SwaggerDoc() map[string]string {
|
||||
return map_PortworxVolumeSource
|
||||
}
|
||||
|
||||
var map_Preconditions = map[string]string{
|
||||
"": "Preconditions must be fulfilled before an operation (update, delete, etc.) is carried out.",
|
||||
"uid": "Specifies the target UID.",
|
||||
@@ -1897,6 +1909,7 @@ var map_VolumeSource = map[string]string{
|
||||
"azureDisk": "AzureDisk represents an Azure Data Disk mount on the host and bind mount to the pod.",
|
||||
"photonPersistentDisk": "PhotonPersistentDisk represents a PhotonController persistent disk attached and mounted on kubelets host machine",
|
||||
"projected": "Items for all in one resources secrets, configmaps, and downward API",
|
||||
"portworxVolume": "PortworxVolume represents a portworx volume attached and mounted on kubelets host machine",
|
||||
}
|
||||
|
||||
func (VolumeSource) SwaggerDoc() map[string]string {
|
||||
|
||||
@@ -275,6 +275,8 @@ func RegisterConversions(scheme *runtime.Scheme) error {
|
||||
Convert_api_PodTemplateList_To_v1_PodTemplateList,
|
||||
Convert_v1_PodTemplateSpec_To_api_PodTemplateSpec,
|
||||
Convert_api_PodTemplateSpec_To_v1_PodTemplateSpec,
|
||||
Convert_v1_PortworxVolumeSource_To_api_PortworxVolumeSource,
|
||||
Convert_api_PortworxVolumeSource_To_v1_PortworxVolumeSource,
|
||||
Convert_v1_Preconditions_To_api_Preconditions,
|
||||
Convert_api_Preconditions_To_v1_Preconditions,
|
||||
Convert_v1_PreferAvoidPodsEntry_To_api_PreferAvoidPodsEntry,
|
||||
@@ -2706,6 +2708,7 @@ func autoConvert_v1_PersistentVolumeSource_To_api_PersistentVolumeSource(in *Per
|
||||
out.Quobyte = (*api.QuobyteVolumeSource)(unsafe.Pointer(in.Quobyte))
|
||||
out.AzureDisk = (*api.AzureDiskVolumeSource)(unsafe.Pointer(in.AzureDisk))
|
||||
out.PhotonPersistentDisk = (*api.PhotonPersistentDiskVolumeSource)(unsafe.Pointer(in.PhotonPersistentDisk))
|
||||
out.PortworxVolume = (*api.PortworxVolumeSource)(unsafe.Pointer(in.PortworxVolume))
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -2731,6 +2734,7 @@ func autoConvert_api_PersistentVolumeSource_To_v1_PersistentVolumeSource(in *api
|
||||
out.VsphereVolume = (*VsphereVirtualDiskVolumeSource)(unsafe.Pointer(in.VsphereVolume))
|
||||
out.AzureDisk = (*AzureDiskVolumeSource)(unsafe.Pointer(in.AzureDisk))
|
||||
out.PhotonPersistentDisk = (*PhotonPersistentDiskVolumeSource)(unsafe.Pointer(in.PhotonPersistentDisk))
|
||||
out.PortworxVolume = (*PortworxVolumeSource)(unsafe.Pointer(in.PortworxVolume))
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -3341,6 +3345,28 @@ func autoConvert_api_PodTemplateSpec_To_v1_PodTemplateSpec(in *api.PodTemplateSp
|
||||
return nil
|
||||
}
|
||||
|
||||
func autoConvert_v1_PortworxVolumeSource_To_api_PortworxVolumeSource(in *PortworxVolumeSource, out *api.PortworxVolumeSource, s conversion.Scope) error {
|
||||
out.VolumeID = in.VolumeID
|
||||
out.FSType = in.FSType
|
||||
out.ReadOnly = in.ReadOnly
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_v1_PortworxVolumeSource_To_api_PortworxVolumeSource(in *PortworxVolumeSource, out *api.PortworxVolumeSource, s conversion.Scope) error {
|
||||
return autoConvert_v1_PortworxVolumeSource_To_api_PortworxVolumeSource(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_api_PortworxVolumeSource_To_v1_PortworxVolumeSource(in *api.PortworxVolumeSource, out *PortworxVolumeSource, s conversion.Scope) error {
|
||||
out.VolumeID = in.VolumeID
|
||||
out.FSType = in.FSType
|
||||
out.ReadOnly = in.ReadOnly
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_api_PortworxVolumeSource_To_v1_PortworxVolumeSource(in *api.PortworxVolumeSource, out *PortworxVolumeSource, s conversion.Scope) error {
|
||||
return autoConvert_api_PortworxVolumeSource_To_v1_PortworxVolumeSource(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1_Preconditions_To_api_Preconditions(in *Preconditions, out *api.Preconditions, s conversion.Scope) error {
|
||||
out.UID = (*types.UID)(unsafe.Pointer(in.UID))
|
||||
return nil
|
||||
@@ -4458,6 +4484,7 @@ func autoConvert_v1_VolumeSource_To_api_VolumeSource(in *VolumeSource, out *api.
|
||||
out.AzureDisk = (*api.AzureDiskVolumeSource)(unsafe.Pointer(in.AzureDisk))
|
||||
out.PhotonPersistentDisk = (*api.PhotonPersistentDiskVolumeSource)(unsafe.Pointer(in.PhotonPersistentDisk))
|
||||
out.Projected = (*api.ProjectedVolumeSource)(unsafe.Pointer(in.Projected))
|
||||
out.PortworxVolume = (*api.PortworxVolumeSource)(unsafe.Pointer(in.PortworxVolume))
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -4490,6 +4517,7 @@ func autoConvert_api_VolumeSource_To_v1_VolumeSource(in *api.VolumeSource, out *
|
||||
out.AzureDisk = (*AzureDiskVolumeSource)(unsafe.Pointer(in.AzureDisk))
|
||||
out.PhotonPersistentDisk = (*PhotonPersistentDiskVolumeSource)(unsafe.Pointer(in.PhotonPersistentDisk))
|
||||
out.Projected = (*ProjectedVolumeSource)(unsafe.Pointer(in.Projected))
|
||||
out.PortworxVolume = (*PortworxVolumeSource)(unsafe.Pointer(in.PortworxVolume))
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -155,6 +155,7 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error {
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_PodTemplate, InType: reflect.TypeOf(&PodTemplate{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_PodTemplateList, InType: reflect.TypeOf(&PodTemplateList{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_PodTemplateSpec, InType: reflect.TypeOf(&PodTemplateSpec{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_PortworxVolumeSource, InType: reflect.TypeOf(&PortworxVolumeSource{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_Preconditions, InType: reflect.TypeOf(&Preconditions{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_PreferAvoidPodsEntry, InType: reflect.TypeOf(&PreferAvoidPodsEntry{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_PreferredSchedulingTerm, InType: reflect.TypeOf(&PreferredSchedulingTerm{})},
|
||||
@@ -2015,6 +2016,11 @@ func DeepCopy_v1_PersistentVolumeSource(in interface{}, out interface{}, c *conv
|
||||
*out = new(PhotonPersistentDiskVolumeSource)
|
||||
**out = **in
|
||||
}
|
||||
if in.PortworxVolume != nil {
|
||||
in, out := &in.PortworxVolume, &out.PortworxVolume
|
||||
*out = new(PortworxVolumeSource)
|
||||
**out = **in
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
@@ -2513,6 +2519,15 @@ func DeepCopy_v1_PodTemplateSpec(in interface{}, out interface{}, c *conversion.
|
||||
}
|
||||
}
|
||||
|
||||
func DeepCopy_v1_PortworxVolumeSource(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*PortworxVolumeSource)
|
||||
out := out.(*PortworxVolumeSource)
|
||||
*out = *in
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func DeepCopy_v1_Preconditions(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*Preconditions)
|
||||
@@ -3420,6 +3435,11 @@ func DeepCopy_v1_VolumeSource(in interface{}, out interface{}, c *conversion.Clo
|
||||
return err
|
||||
}
|
||||
}
|
||||
if in.PortworxVolume != nil {
|
||||
in, out := &in.PortworxVolume, &out.PortworxVolume
|
||||
*out = new(PortworxVolumeSource)
|
||||
**out = **in
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,6 +158,7 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error {
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_api_PodTemplate, InType: reflect.TypeOf(&PodTemplate{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_api_PodTemplateList, InType: reflect.TypeOf(&PodTemplateList{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_api_PodTemplateSpec, InType: reflect.TypeOf(&PodTemplateSpec{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_api_PortworxVolumeSource, InType: reflect.TypeOf(&PortworxVolumeSource{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_api_Preconditions, InType: reflect.TypeOf(&Preconditions{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_api_PreferAvoidPodsEntry, InType: reflect.TypeOf(&PreferAvoidPodsEntry{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_api_PreferredSchedulingTerm, InType: reflect.TypeOf(&PreferredSchedulingTerm{})},
|
||||
@@ -2059,6 +2060,11 @@ func DeepCopy_api_PersistentVolumeSource(in interface{}, out interface{}, c *con
|
||||
*out = new(PhotonPersistentDiskVolumeSource)
|
||||
**out = **in
|
||||
}
|
||||
if in.PortworxVolume != nil {
|
||||
in, out := &in.PortworxVolume, &out.PortworxVolume
|
||||
*out = new(PortworxVolumeSource)
|
||||
**out = **in
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
@@ -2557,6 +2563,15 @@ func DeepCopy_api_PodTemplateSpec(in interface{}, out interface{}, c *conversion
|
||||
}
|
||||
}
|
||||
|
||||
func DeepCopy_api_PortworxVolumeSource(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*PortworxVolumeSource)
|
||||
out := out.(*PortworxVolumeSource)
|
||||
*out = *in
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func DeepCopy_api_Preconditions(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
{
|
||||
in := in.(*Preconditions)
|
||||
@@ -3447,6 +3462,11 @@ func DeepCopy_api_VolumeSource(in interface{}, out interface{}, c *conversion.Cl
|
||||
return err
|
||||
}
|
||||
}
|
||||
if in.PortworxVolume != nil {
|
||||
in, out := &in.PortworxVolume, &out.PortworxVolume
|
||||
*out = new(PortworxVolumeSource)
|
||||
**out = **in
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
@@ -917,6 +917,7 @@ var (
|
||||
AzureDisk FSType = "azureDisk"
|
||||
PhotonPersistentDisk FSType = "photonPersistentDisk"
|
||||
Projected FSType = "projected"
|
||||
PortworxVolume FSType = "portworxVolume"
|
||||
All FSType = "*"
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user