blob: 45bfa7681bed0020abba32b81b923fcfdd0f20ba [file] [log] [blame]
Matthias Andreas Benkard832a54e2019-01-29 09:27:38 +01001/*
2Copyright 2017 The Kubernetes Authors.
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/
16
17package v1
18
19import (
20 "k8s.io/api/core/v1"
21 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
22)
23
24// +genclient
25// +genclient:nonNamespaced
26// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
27
28// StorageClass describes the parameters for a class of storage for
29// which PersistentVolumes can be dynamically provisioned.
30//
31// StorageClasses are non-namespaced; the name of the storage class
32// according to etcd is in ObjectMeta.Name.
33type 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
37 // +optional
38 metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
39
40 // Provisioner indicates the type of the provisioner.
41 Provisioner string `json:"provisioner" protobuf:"bytes,2,opt,name=provisioner"`
42
43 // Parameters holds the parameters for the provisioner that should
44 // create volumes of this storage class.
45 // +optional
46 Parameters map[string]string `json:"parameters,omitempty" protobuf:"bytes,3,rep,name=parameters"`
47
48 // Dynamically provisioned PersistentVolumes of this storage class are
49 // created with this reclaimPolicy. Defaults to Delete.
50 // +optional
51 ReclaimPolicy *v1.PersistentVolumeReclaimPolicy `json:"reclaimPolicy,omitempty" protobuf:"bytes,4,opt,name=reclaimPolicy,casttype=k8s.io/api/core/v1.PersistentVolumeReclaimPolicy"`
52
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.
56 // +optional
57 MountOptions []string `json:"mountOptions,omitempty" protobuf:"bytes,5,opt,name=mountOptions"`
58
59 // AllowVolumeExpansion shows whether the storage class allow volume expand
60 // +optional
61 AllowVolumeExpansion *bool `json:"allowVolumeExpansion,omitempty" protobuf:"varint,6,opt,name=allowVolumeExpansion"`
62
63 // VolumeBindingMode indicates how PersistentVolumeClaims should be
64 // provisioned and bound. When unset, VolumeBindingImmediate is used.
65 // This field is alpha-level and is only honored by servers that enable
66 // the VolumeScheduling feature.
67 // +optional
68 VolumeBindingMode *VolumeBindingMode `json:"volumeBindingMode,omitempty" protobuf:"bytes,7,opt,name=volumeBindingMode"`
69
70 // Restrict the node topologies where volumes can be dynamically provisioned.
71 // Each volume plugin defines its own supported topology specifications.
72 // An empty TopologySelectorTerm list means there is no topology restriction.
73 // This field is alpha-level and is only honored by servers that enable
74 // the DynamicProvisioningScheduling feature.
75 // +optional
76 AllowedTopologies []v1.TopologySelectorTerm `json:"allowedTopologies,omitempty" protobuf:"bytes,8,rep,name=allowedTopologies"`
77}
78
79// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
80
81// StorageClassList is a collection of storage classes.
82type StorageClassList struct {
83 metav1.TypeMeta `json:",inline"`
84 // Standard list metadata
85 // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata
86 // +optional
87 metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
88
89 // Items is the list of StorageClasses
90 Items []StorageClass `json:"items" protobuf:"bytes,2,rep,name=items"`
91}
92
93// VolumeBindingMode indicates how PersistentVolumeClaims should be bound.
94type VolumeBindingMode string
95
96const (
97 // VolumeBindingImmediate indicates that PersistentVolumeClaims should be
98 // immediately provisioned and bound. This is the default mode.
99 VolumeBindingImmediate VolumeBindingMode = "Immediate"
100
101 // VolumeBindingWaitForFirstConsumer indicates that PersistentVolumeClaims
102 // should not be provisioned and bound until the first Pod is created that
103 // references the PeristentVolumeClaim. The volume provisioning and
104 // binding will occur during Pod scheduing.
105 VolumeBindingWaitForFirstConsumer VolumeBindingMode = "WaitForFirstConsumer"
106)