mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 14:37:00 +00:00
CSIStorageCapacity: promote API to beta
The v1alpha1 API is left in place for now to ease the migration.
This commit is contained in:
parent
504f105a9e
commit
a94c141060
@ -262,6 +262,7 @@ API rule violation: list_type_missing,k8s.io/api/storage/v1alpha1,CSIStorageCapa
|
|||||||
API rule violation: list_type_missing,k8s.io/api/storage/v1beta1,CSIDriverSpec,VolumeLifecycleModes
|
API rule violation: list_type_missing,k8s.io/api/storage/v1beta1,CSIDriverSpec,VolumeLifecycleModes
|
||||||
API rule violation: list_type_missing,k8s.io/api/storage/v1beta1,CSINodeDriver,TopologyKeys
|
API rule violation: list_type_missing,k8s.io/api/storage/v1beta1,CSINodeDriver,TopologyKeys
|
||||||
API rule violation: list_type_missing,k8s.io/api/storage/v1beta1,CSINodeSpec,Drivers
|
API rule violation: list_type_missing,k8s.io/api/storage/v1beta1,CSINodeSpec,Drivers
|
||||||
|
API rule violation: list_type_missing,k8s.io/api/storage/v1beta1,CSIStorageCapacityList,Items
|
||||||
API rule violation: list_type_missing,k8s.io/api/storage/v1beta1,StorageClass,AllowedTopologies
|
API rule violation: list_type_missing,k8s.io/api/storage/v1beta1,StorageClass,AllowedTopologies
|
||||||
API rule violation: list_type_missing,k8s.io/api/storage/v1beta1,StorageClass,MountOptions
|
API rule violation: list_type_missing,k8s.io/api/storage/v1beta1,StorageClass,MountOptions
|
||||||
API rule violation: list_type_missing,k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1,ConversionRequest,Objects
|
API rule violation: list_type_missing,k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1,ConversionRequest,Objects
|
||||||
|
@ -341,7 +341,7 @@ type CSIDriverSpec struct {
|
|||||||
// unset or false and it can be flipped later when storage
|
// unset or false and it can be flipped later when storage
|
||||||
// capacity information has been published.
|
// capacity information has been published.
|
||||||
//
|
//
|
||||||
// This is an alpha field and only available when the CSIStorageCapacity
|
// This is a beta field and only available when the CSIStorageCapacity
|
||||||
// feature is enabled. The default is false.
|
// feature is enabled. The default is false.
|
||||||
//
|
//
|
||||||
// +optional
|
// +optional
|
||||||
@ -564,7 +564,9 @@ type CSINodeList struct {
|
|||||||
//
|
//
|
||||||
// The producer of these objects can decide which approach is more suitable.
|
// The producer of these objects can decide which approach is more suitable.
|
||||||
//
|
//
|
||||||
// This is an alpha feature and only available when the CSIStorageCapacity feature is enabled.
|
// They are consumed by the kube-scheduler if the CSIStorageCapacity beta feature gate
|
||||||
|
// is enabled there and a CSI driver opts into capacity-aware scheduling with
|
||||||
|
// CSIDriver.StorageCapacity.
|
||||||
type CSIStorageCapacity struct {
|
type CSIStorageCapacity struct {
|
||||||
metav1.TypeMeta
|
metav1.TypeMeta
|
||||||
// Standard object's metadata. The name has no particular meaning. It must be
|
// Standard object's metadata. The name has no particular meaning. It must be
|
||||||
|
@ -95,6 +95,7 @@ var GVRToStorageVersionHash = map[string]string{
|
|||||||
"storage.k8s.io/v1/volumeattachments": "vQAqD28V4AY=",
|
"storage.k8s.io/v1/volumeattachments": "vQAqD28V4AY=",
|
||||||
"storage.k8s.io/v1beta1/csidrivers": "hL6j/rwBV5w=",
|
"storage.k8s.io/v1beta1/csidrivers": "hL6j/rwBV5w=",
|
||||||
"storage.k8s.io/v1beta1/csinodes": "Pe62DkZtjuo=",
|
"storage.k8s.io/v1beta1/csinodes": "Pe62DkZtjuo=",
|
||||||
|
"storage.k8s.io/v1beta1/csistoragecapacities": "xeVl+2Ly1kE=",
|
||||||
"storage.k8s.io/v1beta1/storageclasses": "K+m6uJwbjGY=",
|
"storage.k8s.io/v1beta1/storageclasses": "K+m6uJwbjGY=",
|
||||||
"storage.k8s.io/v1beta1/volumeattachments": "vQAqD28V4AY=",
|
"storage.k8s.io/v1beta1/volumeattachments": "vQAqD28V4AY=",
|
||||||
"apps/v1/controllerrevisions": "85nkx63pcBU=",
|
"apps/v1/controllerrevisions": "85nkx63pcBU=",
|
||||||
|
@ -233,6 +233,7 @@ const (
|
|||||||
|
|
||||||
// owner: @pohly
|
// owner: @pohly
|
||||||
// alpha: v1.19
|
// alpha: v1.19
|
||||||
|
// beta: v1.21
|
||||||
//
|
//
|
||||||
// Enables tracking of available storage capacity that CSI drivers provide.
|
// Enables tracking of available storage capacity that CSI drivers provide.
|
||||||
CSIStorageCapacity featuregate.Feature = "CSIStorageCapacity"
|
CSIStorageCapacity featuregate.Feature = "CSIStorageCapacity"
|
||||||
@ -767,7 +768,7 @@ var defaultKubernetesFeatureGates = map[featuregate.Feature]featuregate.FeatureS
|
|||||||
ConfigurableFSGroupPolicy: {Default: true, PreRelease: featuregate.Beta},
|
ConfigurableFSGroupPolicy: {Default: true, PreRelease: featuregate.Beta},
|
||||||
BalanceAttachedNodeVolumes: {Default: false, PreRelease: featuregate.Alpha},
|
BalanceAttachedNodeVolumes: {Default: false, PreRelease: featuregate.Alpha},
|
||||||
CSIInlineVolume: {Default: true, PreRelease: featuregate.Beta},
|
CSIInlineVolume: {Default: true, PreRelease: featuregate.Beta},
|
||||||
CSIStorageCapacity: {Default: false, PreRelease: featuregate.Alpha},
|
CSIStorageCapacity: {Default: true, PreRelease: featuregate.Beta},
|
||||||
CSIServiceAccountToken: {Default: false, PreRelease: featuregate.Alpha},
|
CSIServiceAccountToken: {Default: false, PreRelease: featuregate.Alpha},
|
||||||
GenericEphemeralVolume: {Default: false, PreRelease: featuregate.Alpha},
|
GenericEphemeralVolume: {Default: false, PreRelease: featuregate.Alpha},
|
||||||
CSIVolumeFSGroupPolicy: {Default: true, PreRelease: featuregate.Beta},
|
CSIVolumeFSGroupPolicy: {Default: true, PreRelease: featuregate.Beta},
|
||||||
|
@ -63,7 +63,7 @@ func NewStorageFactoryConfig() *StorageFactoryConfig {
|
|||||||
|
|
||||||
resources := []schema.GroupVersionResource{
|
resources := []schema.GroupVersionResource{
|
||||||
batch.Resource("cronjobs").WithVersion("v1beta1"),
|
batch.Resource("cronjobs").WithVersion("v1beta1"),
|
||||||
apisstorage.Resource("csistoragecapacities").WithVersion("v1alpha1"),
|
apisstorage.Resource("csistoragecapacities").WithVersion("v1beta1"),
|
||||||
}
|
}
|
||||||
|
|
||||||
return &StorageFactoryConfig{
|
return &StorageFactoryConfig{
|
||||||
|
@ -119,6 +119,15 @@ func (p RESTStorageProvider) v1beta1Storage(apiResourceConfigSource serverstorag
|
|||||||
}
|
}
|
||||||
storage["csidrivers"] = csiDriverStorage.CSIDriver
|
storage["csidrivers"] = csiDriverStorage.CSIDriver
|
||||||
|
|
||||||
|
// register csistoragecapacity if CSIStorageCapacity feature gate is enabled
|
||||||
|
if utilfeature.DefaultFeatureGate.Enabled(features.CSIStorageCapacity) {
|
||||||
|
csiStorageStorage, err := csistoragecapacitystore.NewStorage(restOptionsGetter)
|
||||||
|
if err != nil {
|
||||||
|
return storage, err
|
||||||
|
}
|
||||||
|
storage["csistoragecapacities"] = csiStorageStorage.CSIStorageCapacity
|
||||||
|
}
|
||||||
|
|
||||||
return storage, nil
|
return storage, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -331,7 +331,7 @@ type CSIDriverSpec struct {
|
|||||||
// unset or false and it can be flipped later when storage
|
// unset or false and it can be flipped later when storage
|
||||||
// capacity information has been published.
|
// capacity information has been published.
|
||||||
//
|
//
|
||||||
// This is an alpha field and only available when the CSIStorageCapacity
|
// This is a beta field and only available when the CSIStorageCapacity
|
||||||
// feature is enabled. The default is false.
|
// feature is enabled. The default is false.
|
||||||
//
|
//
|
||||||
// +optional
|
// +optional
|
||||||
|
@ -156,7 +156,9 @@ type VolumeError struct {
|
|||||||
//
|
//
|
||||||
// The producer of these objects can decide which approach is more suitable.
|
// The producer of these objects can decide which approach is more suitable.
|
||||||
//
|
//
|
||||||
// This is an alpha feature and only available when the CSIStorageCapacity feature is enabled.
|
// They are consumed by the kube-scheduler if the CSIStorageCapacity beta feature gate
|
||||||
|
// is enabled there and a CSI driver opts into capacity-aware scheduling with
|
||||||
|
// CSIDriver.StorageCapacity.
|
||||||
type CSIStorageCapacity struct {
|
type CSIStorageCapacity struct {
|
||||||
metav1.TypeMeta `json:",inline"`
|
metav1.TypeMeta `json:",inline"`
|
||||||
// Standard object's metadata. The name has no particular meaning. It must be
|
// Standard object's metadata. The name has no particular meaning. It must be
|
||||||
|
@ -55,6 +55,9 @@ func addKnownTypes(scheme *runtime.Scheme) error {
|
|||||||
|
|
||||||
&CSINode{},
|
&CSINode{},
|
||||||
&CSINodeList{},
|
&CSINodeList{},
|
||||||
|
|
||||||
|
&CSIStorageCapacity{},
|
||||||
|
&CSIStorageCapacityList{},
|
||||||
)
|
)
|
||||||
|
|
||||||
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
|
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
|
||||||
|
@ -18,6 +18,7 @@ package v1beta1
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
v1 "k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
|
"k8s.io/apimachinery/pkg/api/resource"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -351,7 +352,7 @@ type CSIDriverSpec struct {
|
|||||||
// unset or false and it can be flipped later when storage
|
// unset or false and it can be flipped later when storage
|
||||||
// capacity information has been published.
|
// capacity information has been published.
|
||||||
//
|
//
|
||||||
// This is an alpha field and only available when the CSIStorageCapacity
|
// This is a beta field and only available when the CSIStorageCapacity
|
||||||
// feature is enabled. The default is false.
|
// feature is enabled. The default is false.
|
||||||
//
|
//
|
||||||
// +optional
|
// +optional
|
||||||
@ -569,3 +570,88 @@ type CSINodeList struct {
|
|||||||
// items is the list of CSINode
|
// items is the list of CSINode
|
||||||
Items []CSINode `json:"items" protobuf:"bytes,2,rep,name=items"`
|
Items []CSINode `json:"items" protobuf:"bytes,2,rep,name=items"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// +genclient
|
||||||
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
|
// +k8s:prerelease-lifecycle-gen:introduced=1.21
|
||||||
|
|
||||||
|
// CSIStorageCapacity stores the result of one CSI GetCapacity call.
|
||||||
|
// For a given StorageClass, this describes the available capacity in a
|
||||||
|
// particular topology segment. This can be used when considering where to
|
||||||
|
// instantiate new PersistentVolumes.
|
||||||
|
//
|
||||||
|
// For example this can express things like:
|
||||||
|
// - StorageClass "standard" has "1234 GiB" available in "topology.kubernetes.io/zone=us-east1"
|
||||||
|
// - StorageClass "localssd" has "10 GiB" available in "kubernetes.io/hostname=knode-abc123"
|
||||||
|
//
|
||||||
|
// The following three cases all imply that no capacity is available for
|
||||||
|
// a certain combination:
|
||||||
|
// - no object exists with suitable topology and storage class name
|
||||||
|
// - such an object exists, but the capacity is unset
|
||||||
|
// - such an object exists, but the capacity is zero
|
||||||
|
//
|
||||||
|
// The producer of these objects can decide which approach is more suitable.
|
||||||
|
//
|
||||||
|
// They are consumed by the kube-scheduler if the CSIStorageCapacity beta feature gate
|
||||||
|
// is enabled there and a CSI driver opts into capacity-aware scheduling with
|
||||||
|
// CSIDriver.StorageCapacity.
|
||||||
|
type CSIStorageCapacity struct {
|
||||||
|
metav1.TypeMeta `json:",inline"`
|
||||||
|
// Standard object's metadata. The name has no particular meaning. It must be
|
||||||
|
// be a DNS subdomain (dots allowed, 253 characters). To ensure that
|
||||||
|
// there are no conflicts with other CSI drivers on the cluster, the recommendation
|
||||||
|
// is to use csisc-<uuid>, a generated name, or a reverse-domain name which ends
|
||||||
|
// with the unique CSI driver name.
|
||||||
|
//
|
||||||
|
// Objects are namespaced.
|
||||||
|
//
|
||||||
|
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||||
|
// +optional
|
||||||
|
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
||||||
|
|
||||||
|
// NodeTopology defines which nodes have access to the storage
|
||||||
|
// for which capacity was reported. If not set, the storage is
|
||||||
|
// not accessible from any node in the cluster. If empty, the
|
||||||
|
// storage is accessible from all nodes. This field is
|
||||||
|
// immutable.
|
||||||
|
//
|
||||||
|
// +optional
|
||||||
|
NodeTopology *metav1.LabelSelector `json:"nodeTopology,omitempty" protobuf:"bytes,2,opt,name=nodeTopology"`
|
||||||
|
|
||||||
|
// The name of the StorageClass that the reported capacity applies to.
|
||||||
|
// It must meet the same requirements as the name of a StorageClass
|
||||||
|
// object (non-empty, DNS subdomain). If that object no longer exists,
|
||||||
|
// the CSIStorageCapacity object is obsolete and should be removed by its
|
||||||
|
// creator.
|
||||||
|
// This field is immutable.
|
||||||
|
StorageClassName string `json:"storageClassName" protobuf:"bytes,3,name=storageClassName"`
|
||||||
|
|
||||||
|
// Capacity is the value reported by the CSI driver in its GetCapacityResponse
|
||||||
|
// for a GetCapacityRequest with topology and parameters that match the
|
||||||
|
// previous fields.
|
||||||
|
//
|
||||||
|
// The semantic is currently (CSI spec 1.2) defined as:
|
||||||
|
// The available capacity, in bytes, of the storage that can be used
|
||||||
|
// to provision volumes. If not set, that information is currently
|
||||||
|
// unavailable and treated like zero capacity.
|
||||||
|
//
|
||||||
|
// +optional
|
||||||
|
Capacity *resource.Quantity `json:"capacity,omitempty" protobuf:"bytes,4,opt,name=capacity"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
|
// +k8s:prerelease-lifecycle-gen:introduced=1.21
|
||||||
|
|
||||||
|
// CSIStorageCapacityList is a collection of CSIStorageCapacity objects.
|
||||||
|
type CSIStorageCapacityList struct {
|
||||||
|
metav1.TypeMeta `json:",inline"`
|
||||||
|
// Standard list metadata
|
||||||
|
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
|
||||||
|
// +optional
|
||||||
|
metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
||||||
|
|
||||||
|
// Items is the list of CSIStorageCapacity objects.
|
||||||
|
// +listType=map
|
||||||
|
// +listMapKey=name
|
||||||
|
Items []CSIStorageCapacity `json:"items" protobuf:"bytes,2,rep,name=items"`
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user