mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-09 13:12:20 +00:00
PersistentVolume & PersistentVolumeClaim API types
This commit is contained in:
@@ -60,6 +60,10 @@ func init() {
|
||||
&Secret{},
|
||||
&SecretList{},
|
||||
&DeleteOptions{},
|
||||
&PersistentVolume{},
|
||||
&PersistentVolumeList{},
|
||||
&PersistentVolumeClaim{},
|
||||
&PersistentVolumeClaimList{},
|
||||
)
|
||||
// Future names are supported
|
||||
api.Scheme.AddKnownTypeWithName("v1beta2", "Node", &Minion{})
|
||||
@@ -93,4 +97,8 @@ func (*Namespace) IsAnAPIObject() {}
|
||||
func (*NamespaceList) IsAnAPIObject() {}
|
||||
func (*Secret) IsAnAPIObject() {}
|
||||
func (*SecretList) IsAnAPIObject() {}
|
||||
func (*PersistentVolume) IsAnAPIObject() {}
|
||||
func (*PersistentVolumeList) IsAnAPIObject() {}
|
||||
func (*PersistentVolumeClaim) IsAnAPIObject() {}
|
||||
func (*PersistentVolumeClaimList) IsAnAPIObject() {}
|
||||
func (*DeleteOptions) IsAnAPIObject() {}
|
||||
|
@@ -58,7 +58,7 @@ type Volume struct {
|
||||
Source VolumeSource `json:"source,omitempty" description:"location and type of volume to mount; at most one of HostDir, EmptyDir, GCEPersistentDisk, or GitRepo; default is EmptyDir"`
|
||||
}
|
||||
|
||||
// VolumeSource represents the source location of a valume to mount.
|
||||
// VolumeSource represents the source location of a volume to mount.
|
||||
// Only one of its members may be specified.
|
||||
//
|
||||
// https://github.com/GoogleCloudPlatform/kubernetes/blob/master/docs/volumes.md#types-of-volumes
|
||||
@@ -82,7 +82,84 @@ type VolumeSource struct {
|
||||
NFS *NFSVolumeSource `json:"nfs" description:"NFS volume that will be mounted in the host machine"`
|
||||
}
|
||||
|
||||
// used by VolumeSources to describe their mounting/access modes
|
||||
// Similar to VolumeSource but meant for the administrator who creates PVs.
|
||||
// Exactly one of its members must be set.
|
||||
type PersistentVolumeSource struct {
|
||||
// GCEPersistentDisk represents a GCE Disk resource that is attached to a
|
||||
// kubelet's host machine and then exposed to the pod.
|
||||
GCEPersistentDisk *GCEPersistentDiskVolumeSource `json:"persistentDisk" description:"GCE disk resource provisioned by an admin"`
|
||||
// HostPath represents a directory on the host.
|
||||
// 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"`
|
||||
}
|
||||
|
||||
type PersistentVolume struct {
|
||||
TypeMeta `json:",inline"`
|
||||
|
||||
//Spec defines a persistent volume owned by the cluster
|
||||
Spec PersistentVolumeSpec `json:"spec,omitempty" description:"specification of a persistent volume as provisioned by an administrator"`
|
||||
|
||||
// Status represents the current information about persistent volume.
|
||||
Status PersistentVolumeStatus `json:"status,omitempty" description:"current status of a persistent volume; populated by the system, read-only"`
|
||||
}
|
||||
|
||||
type PersistentVolumeSpec struct {
|
||||
// Resources represents the actual resources of the volume
|
||||
Capacity ResourceList `json:"capacity,omitempty" description:"a description of the persistent volume's resources and capacity"`
|
||||
// Source represents the location and type of a volume to mount.
|
||||
// AccessModeTypes are inferred from the Source.
|
||||
PersistentVolumeSource `json:",inline" description:"the actual volume backing the persistent volume"`
|
||||
// holds the binding reference to a PersistentVolumeClaim
|
||||
ClaimRef *ObjectReference `json:"claimRef,omitempty" description:"the binding reference to a persistent volume claim"`
|
||||
}
|
||||
|
||||
type PersistentVolumeStatus struct {
|
||||
// Phase indicates if a volume is available, bound to a claim, or released by a claim
|
||||
Phase PersistentVolumePhase `json:"phase,omitempty" description:"the current phase of a persistent volume"`
|
||||
}
|
||||
|
||||
type PersistentVolumeList struct {
|
||||
TypeMeta `json:",inline"`
|
||||
Items []PersistentVolume `json:"items,omitempty" description:"list of persistent volumes"`
|
||||
}
|
||||
|
||||
// PersistentVolumeClaim is a user's request for and claim to a persistent volume
|
||||
type PersistentVolumeClaim struct {
|
||||
TypeMeta `json:",inline"`
|
||||
|
||||
// Spec defines the volume requested by a pod author
|
||||
Spec PersistentVolumeClaimSpec `json:"spec,omitempty" description: "the desired characteristics of a volume"`
|
||||
|
||||
// Status represents the current information about a claim
|
||||
Status PersistentVolumeClaimStatus `json:"status,omitempty" description:"the current status of a persistent volume claim; read-only"`
|
||||
}
|
||||
|
||||
type PersistentVolumeClaimList struct {
|
||||
TypeMeta `json:",inline"`
|
||||
Items []PersistentVolumeClaim `json:"items,omitempty" description: "a list of persistent volume claims"`
|
||||
}
|
||||
|
||||
// PersistentVolumeClaimSpec describes the common attributes of storage devices
|
||||
// and allows a Source for provider-specific attributes
|
||||
type PersistentVolumeClaimSpec struct {
|
||||
// Contains the types of access modes required
|
||||
AccessModes []AccessModeType `json:"accessModes,omitempty" description:"the desired access modes the volume should have"`
|
||||
// Resources represents the minimum resources required
|
||||
Resources ResourceRequirements `json:"resources,omitempty" description:"the desired resources the volume should have"`
|
||||
}
|
||||
|
||||
type PersistentVolumeClaimStatus struct {
|
||||
// Phase represents the current phase of PersistentVolumeClaim
|
||||
Phase PersistentVolumeClaimPhase `json:"phase,omitempty" description:"the current phase of the claim"`
|
||||
// AccessModes contains all ways the volume backing the PVC can be mounted
|
||||
AccessModes []AccessModeType `json:"accessModes,omitempty" description:"the actual access modes the volume has"`
|
||||
// Represents the actual resources of the underlying volume
|
||||
Capacity ResourceList `json:"capacity,omitempty" description:"the actual resources the volume has"`
|
||||
// VolumeRef is a reference to the PersistentVolume bound to the PersistentVolumeClaim
|
||||
VolumeRef *ObjectReference `json:"volumeRef,omitempty" description:"a reference to the backing persistent volume, when bound"`
|
||||
}
|
||||
|
||||
type AccessModeType string
|
||||
|
||||
const (
|
||||
@@ -94,6 +171,27 @@ const (
|
||||
ReadWriteMany AccessModeType = "ReadWriteMany"
|
||||
)
|
||||
|
||||
type PersistentVolumePhase string
|
||||
|
||||
const (
|
||||
// used for PersistentVolumes that are not yet bound
|
||||
VolumeAvailable PersistentVolumePhase = "Available"
|
||||
// used for PersistentVolumes that are bound
|
||||
VolumeBound PersistentVolumePhase = "Bound"
|
||||
// used for PersistentVolumes where the bound PersistentVolumeClaim was deleted
|
||||
// released volumes must be recycled before becoming available again
|
||||
VolumeReleased PersistentVolumePhase = "Released"
|
||||
)
|
||||
|
||||
type PersistentVolumeClaimPhase string
|
||||
|
||||
const (
|
||||
// used for PersistentVolumeClaims that are not yet bound
|
||||
ClaimPending PersistentVolumeClaimPhase = "Pending"
|
||||
// used for PersistentVolumeClaims that are bound
|
||||
ClaimBound PersistentVolumeClaimPhase = "Bound"
|
||||
)
|
||||
|
||||
// HostPathVolumeSource represents bare host directory volume.
|
||||
//
|
||||
// https://github.com/GoogleCloudPlatform/kubernetes/blob/master/docs/volumes.md#hostdir
|
||||
@@ -282,6 +380,8 @@ type Capabilities struct {
|
||||
type ResourceRequirements struct {
|
||||
// Limits describes the maximum amount of compute resources required.
|
||||
Limits ResourceList `json:"limits,omitempty" description:"Maximum amount of compute resources allowed"`
|
||||
// Requests describes the minimum amount of compute resources required.
|
||||
Requests ResourceList `json:"requests,omitempty" description:"Minimum amount of resources requested"`
|
||||
}
|
||||
|
||||
// Container represents a single container that is expected to be run on the host.
|
||||
@@ -781,6 +881,8 @@ const (
|
||||
ResourceCPU ResourceName = "cpu"
|
||||
// Memory, in bytes. (500Gi = 500GiB = 500 * 1024 * 1024 * 1024)
|
||||
ResourceMemory ResourceName = "memory"
|
||||
// Volume size, in bytes (e,g. 5Gi = 5GiB = 5 * 1024 * 1024 * 1024)
|
||||
ResourceStorage ResourceName = "storage"
|
||||
)
|
||||
|
||||
type ResourceList map[ResourceName]util.IntOrString
|
||||
|
Reference in New Issue
Block a user