2 Copyright 2017 The Kubernetes Authors.
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
8 http://www.apache.org/licenses/LICENSE-2.0
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
21 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
25 // +genclient:nonNamespaced
26 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
28 // StorageClass describes the parameters for a class of storage for
29 // which PersistentVolumes can be dynamically provisioned.
31 // StorageClasses are non-namespaced; the name of the storage class
32 // according to etcd is in ObjectMeta.Name.
33 type StorageClass struct {
34 metav1.TypeMeta `json:",inline"`
35 // Standard object's metadata.
36 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata
38 metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
40 // Provisioner indicates the type of the provisioner.
41 Provisioner string `json:"provisioner" protobuf:"bytes,2,opt,name=provisioner"`
43 // Parameters holds the parameters for the provisioner that should
44 // create volumes of this storage class.
46 Parameters map[string]string `json:"parameters,omitempty" protobuf:"bytes,3,rep,name=parameters"`
48 // Dynamically provisioned PersistentVolumes of this storage class are
49 // created with this reclaimPolicy. Defaults to Delete.
51 ReclaimPolicy *v1.PersistentVolumeReclaimPolicy `json:"reclaimPolicy,omitempty" protobuf:"bytes,4,opt,name=reclaimPolicy,casttype=k8s.io/api/core/v1.PersistentVolumeReclaimPolicy"`
53 // Dynamically provisioned PersistentVolumes of this storage class are
54 // created with these mountOptions, e.g. ["ro", "soft"]. Not validated -
55 // mount of the PVs will simply fail if one is invalid.
57 MountOptions []string `json:"mountOptions,omitempty" protobuf:"bytes,5,opt,name=mountOptions"`
59 // AllowVolumeExpansion shows whether the storage class allow volume expand
61 AllowVolumeExpansion *bool `json:"allowVolumeExpansion,omitempty" protobuf:"varint,6,opt,name=allowVolumeExpansion"`
63 // VolumeBindingMode indicates how PersistentVolumeClaims should be
64 // provisioned and bound. When unset, VolumeBindingImmediate is used.
65 // This field is only honored by servers that enable the VolumeScheduling feature.
67 VolumeBindingMode *VolumeBindingMode `json:"volumeBindingMode,omitempty" protobuf:"bytes,7,opt,name=volumeBindingMode"`
69 // Restrict the node topologies where volumes can be dynamically provisioned.
70 // Each volume plugin defines its own supported topology specifications.
71 // An empty TopologySelectorTerm list means there is no topology restriction.
72 // This field is only honored by servers that enable the VolumeScheduling feature.
74 AllowedTopologies []v1.TopologySelectorTerm `json:"allowedTopologies,omitempty" protobuf:"bytes,8,rep,name=allowedTopologies"`
77 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
79 // StorageClassList is a collection of storage classes.
80 type StorageClassList struct {
81 metav1.TypeMeta `json:",inline"`
82 // Standard list metadata
83 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata
85 metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
87 // Items is the list of StorageClasses
88 Items []StorageClass `json:"items" protobuf:"bytes,2,rep,name=items"`
91 // VolumeBindingMode indicates how PersistentVolumeClaims should be bound.
92 type VolumeBindingMode string
95 // VolumeBindingImmediate indicates that PersistentVolumeClaims should be
96 // immediately provisioned and bound. This is the default mode.
97 VolumeBindingImmediate VolumeBindingMode = "Immediate"
99 // VolumeBindingWaitForFirstConsumer indicates that PersistentVolumeClaims
100 // should not be provisioned and bound until the first Pod is created that
101 // references the PeristentVolumeClaim. The volume provisioning and
102 // binding will occur during Pod scheduing.
103 VolumeBindingWaitForFirstConsumer VolumeBindingMode = "WaitForFirstConsumer"
107 // +genclient:nonNamespaced
108 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
110 // VolumeAttachment captures the intent to attach or detach the specified volume
111 // to/from the specified node.
113 // VolumeAttachment objects are non-namespaced.
114 type VolumeAttachment struct {
115 metav1.TypeMeta `json:",inline"`
117 // Standard object metadata.
118 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata
120 metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
122 // Specification of the desired attach/detach volume behavior.
123 // Populated by the Kubernetes system.
124 Spec VolumeAttachmentSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"`
126 // Status of the VolumeAttachment request.
127 // Populated by the entity completing the attach or detach
128 // operation, i.e. the external-attacher.
130 Status VolumeAttachmentStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
133 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
135 // VolumeAttachmentList is a collection of VolumeAttachment objects.
136 type VolumeAttachmentList struct {
137 metav1.TypeMeta `json:",inline"`
138 // Standard list metadata
139 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata
141 metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
143 // Items is the list of VolumeAttachments
144 Items []VolumeAttachment `json:"items" protobuf:"bytes,2,rep,name=items"`
147 // VolumeAttachmentSpec is the specification of a VolumeAttachment request.
148 type VolumeAttachmentSpec struct {
149 // Attacher indicates the name of the volume driver that MUST handle this
150 // request. This is the name returned by GetPluginName().
151 Attacher string `json:"attacher" protobuf:"bytes,1,opt,name=attacher"`
153 // Source represents the volume that should be attached.
154 Source VolumeAttachmentSource `json:"source" protobuf:"bytes,2,opt,name=source"`
156 // The node that the volume should be attached to.
157 NodeName string `json:"nodeName" protobuf:"bytes,3,opt,name=nodeName"`
160 // VolumeAttachmentSource represents a volume that should be attached.
161 // Right now only PersistenVolumes can be attached via external attacher,
162 // in future we may allow also inline volumes in pods.
163 // Exactly one member can be set.
164 type VolumeAttachmentSource struct {
165 // Name of the persistent volume to attach.
167 PersistentVolumeName *string `json:"persistentVolumeName,omitempty" protobuf:"bytes,1,opt,name=persistentVolumeName"`
169 // Placeholder for *VolumeSource to accommodate inline volumes in pods.
172 // VolumeAttachmentStatus is the status of a VolumeAttachment request.
173 type VolumeAttachmentStatus struct {
174 // Indicates the volume is successfully attached.
175 // This field must only be set by the entity completing the attach
176 // operation, i.e. the external-attacher.
177 Attached bool `json:"attached" protobuf:"varint,1,opt,name=attached"`
179 // Upon successful attach, this field is populated with any
180 // information returned by the attach operation that must be passed
181 // into subsequent WaitForAttach or Mount calls.
182 // This field must only be set by the entity completing the attach
183 // operation, i.e. the external-attacher.
185 AttachmentMetadata map[string]string `json:"attachmentMetadata,omitempty" protobuf:"bytes,2,rep,name=attachmentMetadata"`
187 // The last error encountered during attach operation, if any.
188 // This field must only be set by the entity completing the attach
189 // operation, i.e. the external-attacher.
191 AttachError *VolumeError `json:"attachError,omitempty" protobuf:"bytes,3,opt,name=attachError,casttype=VolumeError"`
193 // The last error encountered during detach operation, if any.
194 // This field must only be set by the entity completing the detach
195 // operation, i.e. the external-attacher.
197 DetachError *VolumeError `json:"detachError,omitempty" protobuf:"bytes,4,opt,name=detachError,casttype=VolumeError"`
200 // VolumeError captures an error encountered during a volume operation.
201 type VolumeError struct {
202 // Time the error was encountered.
204 Time metav1.Time `json:"time,omitempty" protobuf:"bytes,1,opt,name=time"`
206 // String detailing the error encountered during Attach or Detach operation.
207 // This string maybe logged, so it should not contain sensitive
210 Message string `json:"message,omitempty" protobuf:"bytes,2,opt,name=message"`