website/content/zh-cn/docs/reference/kubernetes-api/config-and-storage-resources/csi-storage-capacity-v1.md

25 KiB
Raw Blame History

api_metadata content_type description title weight
apiVersion import kind
storage.k8s.io/v1 k8s.io/api/storage/v1 CSIStorageCapacity
api_reference CSIStorageCapacity 存储一个 CSI GetCapacity 调用的结果。 CSIStorageCapacity 5

apiVersion: storage.k8s.io/v1

import "k8s.io/api/storage/v1"

CSIStorageCapacity

CSIStorageCapacity 存储一个 CSI GetCapacity 调用的结果。 对于给定的 StorageClass此结构描述了特定拓扑段中可用的容量。 当考虑在哪里实例化新的 PersistentVolume 时可以使用此项。

例如,此结构可以描述如下内容:

  • “standard” 的 StorageClass 容量为 “1234 GiB”可用于 “topology.kubernetes.io/zone=us-east1”
  • “localssd” 的 StorageClass 容量为 “10 GiB”可用于 “kubernetes.io/hostname=knode-abc123”

以下三种情况均暗示了某些组合没有可用的容量:

  • 不存在拓扑和存储类名称合适的对象
  • 这种对象存在,但容量未设置
  • 这种对象存在,但容量为零

这些对象的制作方可以决定哪种方法更合适。

当 CSI 驱动选择使用 CSIDriverSpec.StorageCapacity 进行容量感知调度时kube-scheduler 会使用这些对象。 该调度器将 MaximumVolumeSize 与 pending 卷的请求大小进行比较,以过滤掉不合适的节点。 如果未设置 MaximumVolumeSize则回退为与不太精确的容量Capacity进行比较。 如果还是未设置,则该调度器假定容量不足并尝试某些其他节点。


  • apiVersion: storage.k8s.io/v1

  • kind: CSIStorageCapacity

  • metadata (<a href="{{< ref "../common-definitions/object-meta#ObjectMeta" >}}">ObjectMeta)

    标准的对象元数据。 此名称没有特定的含义。 它必须是 DNS 子域名(允许英文句点,最多 253 个字符)。 为了确保与集群上的其他 CSI 驱动没有冲突,建议使用一个生成的名称 csisc-<uuid> 或使用以唯一 CSI 驱动名称结尾的反向域名。

    这些对象是有命名空间的。

    更多信息: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata

  • storageClassName (string),必需

    storageClassName 是已报告容量所对应的 StorageClass 的名称。 它必须满足与 StorageClass 对象名称相同的要求非空DNS 子域名)。 如果该对象不再存在,则 CSIStorageCapacity 对象将被废弃且应由创建者移除。 此字段不可变更。

  • capacity (<a href="{{< ref "../common-definitions/quantity#Quantity" >}}">Quantity)

    capacity 是 CSI 驱动在其 GetCapacityResponse 中为 GetCapacityRequest 报告的值,其拓扑和参数与之前的字段匹配。

    该语义目前CSI 规范 1.2)定义为:可用于制备卷的可用存储容量(单位为字节)。 如果未设置,则该信息目前不可用。

  • maximumVolumeSize (<a href="{{< ref "../common-definitions/quantity#Quantity" >}}">Quantity)

    maximumVolumeSize 是 CSI 驱动在其 GetCapacityResponse 中为 GetCapacityRequest 报告的值,其拓扑和参数与之前的字段匹配。

    自从 CSI 规范 1.4.0 起,这定义为 CreateVolumeRequest.capacity_range.required_bytes 字段中可以使用的最大值, 以便用 GetCapacityRequest 中相同的参数创建一个卷。 Kubernetes API 中的相应值是卷声明中的 ResourceRequirements.Requests。

  • nodeTopology (<a href="{{< ref "../common-definitions/label-selector#LabelSelector" >}}">LabelSelector)

    nodeTopology 定义了哪些节点有权访问已报告容量的存储。 如果未设置,则不能从集群中的任意节点访问此存储。 如果留空,则可以从所有节点访问此存储。此字段不可变更。

CSIStorageCapacityList

CSIStorageCapacityList 是 CSIStorageCapacity 对象的集合。


  • apiVersion: storage.k8s.io/v1

  • kind: CSIStorageCapacityList

操作


get 读取指定的 CSIStorageCapacity

HTTP 请求

GET /apis/storage.k8s.io/v1/namespaces/{namespace}/csistoragecapacities/{name}

参数

  • name (路径参数): string必需

    CSIStorageCapacity 的名称

  • namespace (路径参数): string必需

    <a href="{{< ref "../common-parameters/common-parameters#namespace" >}}">namespace

  • pretty (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#pretty" >}}">pretty

响应

200 (<a href="{{< ref "../config-and-storage-resources/csi-storage-capacity-v1#CSIStorageCapacity" >}}">CSIStorageCapacity): OK

401: Unauthorized

list 列出或观测类别为 CSIStorageCapacity 的对象

HTTP 请求

GET /apis/storage.k8s.io/v1/namespaces/{namespace}/csistoragecapacities

参数

  • namespace (路径参数): string必需

    <a href="{{< ref "../common-parameters/common-parameters#namespace" >}}">namespace

  • allowWatchBookmarks (查询参数): boolean

    <a href="{{< ref "../common-parameters/common-parameters#allowWatchBookmarks" >}}">allowWatchBookmarks

  • continue (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#continue" >}}">continue

  • fieldSelector (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#fieldSelector" >}}">fieldSelector

  • labelSelector (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#labelSelector" >}}">labelSelector

  • limit (查询参数): integer

    <a href="{{< ref "../common-parameters/common-parameters#limit" >}}">limit

  • pretty (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#pretty" >}}">pretty

  • resourceVersion (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#resourceVersion" >}}">resourceVersion

  • resourceVersionMatch (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#resourceVersionMatch" >}}">resourceVersionMatch

  • sendInitialEvents (查询参数): boolean

    <a href="{{< ref "../common-parameters/common-parameters#sendInitialEvents" >}}">sendInitialEvents

  • timeoutSeconds (查询参数): integer

    <a href="{{< ref "../common-parameters/common-parameters#timeoutSeconds" >}}">timeoutSeconds

  • watch (查询参数): boolean

    <a href="{{< ref "../common-parameters/common-parameters#watch" >}}">watch

响应

200 (<a href="{{< ref "../config-and-storage-resources/csi-storage-capacity-v1#CSIStorageCapacityList" >}}">CSIStorageCapacityList): OK

401: Unauthorized

list 列出或观测类别为 CSIStorageCapacity 的对象

HTTP 请求

GET /apis/storage.k8s.io/v1/csistoragecapacities

参数

  • allowWatchBookmarks (查询参数): boolean

    <a href="{{< ref "../common-parameters/common-parameters#allowWatchBookmarks" >}}">allowWatchBookmarks

  • continue (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#continue" >}}">continue

  • fieldSelector (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#fieldSelector" >}}">fieldSelector

  • labelSelector (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#labelSelector" >}}">labelSelector

  • limit (查询参数): integer

    <a href="{{< ref "../common-parameters/common-parameters#limit" >}}">limit

  • pretty (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#pretty" >}}">pretty

  • resourceVersion (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#resourceVersion" >}}">resourceVersion

  • resourceVersionMatch (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#resourceVersionMatch" >}}">resourceVersionMatch

  • sendInitialEvents (查询参数): boolean

    <a href="{{< ref "../common-parameters/common-parameters#sendInitialEvents" >}}">sendInitialEvents

  • timeoutSeconds (查询参数): integer

    <a href="{{< ref "../common-parameters/common-parameters#timeoutSeconds" >}}">timeoutSeconds

  • watch (查询参数): boolean

    <a href="{{< ref "../common-parameters/common-parameters#watch" >}}">watch

响应

200 (<a href="{{< ref "../config-and-storage-resources/csi-storage-capacity-v1#CSIStorageCapacityList" >}}">CSIStorageCapacityList): OK

401: Unauthorized

create 创建 CSIStorageCapacity

HTTP 请求

POST /apis/storage.k8s.io/v1/namespaces/{namespace}/csistoragecapacities

参数

  • namespace (路径参数): string必需

    <a href="{{< ref "../common-parameters/common-parameters#namespace" >}}">namespace

  • body: <a href="{{< ref "../config-and-storage-resources/csi-storage-capacity-v1#CSIStorageCapacity" >}}">CSIStorageCapacity必需

  • dryRun (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#dryRun" >}}">dryRun

  • fieldManager (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#fieldManager" >}}">fieldManager

  • fieldValidation (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#fieldValidation" >}}">fieldValidation

  • pretty (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#pretty" >}}">pretty

响应

200 (<a href="{{< ref "../config-and-storage-resources/csi-storage-capacity-v1#CSIStorageCapacity" >}}">CSIStorageCapacity): OK

201 (<a href="{{< ref "../config-and-storage-resources/csi-storage-capacity-v1#CSIStorageCapacity" >}}">CSIStorageCapacity): Created

202 (<a href="{{< ref "../config-and-storage-resources/csi-storage-capacity-v1#CSIStorageCapacity" >}}">CSIStorageCapacity): Accepted

401: Unauthorized

update 替换指定的 CSIStorageCapacity

HTTP 请求

PUT /apis/storage.k8s.io/v1/namespaces/{namespace}/csistoragecapacities/{name}

参数

  • name (路径参数): string必需

    CSIStorageCapacity 的名称

  • namespace (路径参数): string必需

    <a href="{{< ref "../common-parameters/common-parameters#namespace" >}}">namespace

  • body: <a href="{{< ref "../config-and-storage-resources/csi-storage-capacity-v1#CSIStorageCapacity" >}}">CSIStorageCapacity必需

  • dryRun (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#dryRun" >}}">dryRun

  • fieldManager (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#fieldManager" >}}">fieldManager

  • fieldValidation (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#fieldValidation" >}}">fieldValidation

  • pretty (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#pretty" >}}">pretty

响应

200 (<a href="{{< ref "../config-and-storage-resources/csi-storage-capacity-v1#CSIStorageCapacity" >}}">CSIStorageCapacity): OK

201 (<a href="{{< ref "../config-and-storage-resources/csi-storage-capacity-v1#CSIStorageCapacity" >}}">CSIStorageCapacity): Created

401: Unauthorized

patch 部分更新指定的 CSIStorageCapacity

HTTP 请求

PATCH /apis/storage.k8s.io/v1/namespaces/{namespace}/csistoragecapacities/{name}

参数

  • name (路径参数): string必需

    CSIStorageCapacity 的名称

  • namespace (路径参数): string必需

    <a href="{{< ref "../common-parameters/common-parameters#namespace" >}}">namespace

  • body: <a href="{{< ref "../common-definitions/patch#Patch" >}}">Patch必需

  • dryRun (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#dryRun" >}}">dryRun

  • fieldManager (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#fieldManager" >}}">fieldManager

  • fieldValidation (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#fieldValidation" >}}">fieldValidation

  • force (查询参数): boolean

    <a href="{{< ref "../common-parameters/common-parameters#force" >}}">force

  • pretty (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#pretty" >}}">pretty

响应

200 (<a href="{{< ref "../config-and-storage-resources/csi-storage-capacity-v1#CSIStorageCapacity" >}}">CSIStorageCapacity): OK

201 (<a href="{{< ref "../config-and-storage-resources/csi-storage-capacity-v1#CSIStorageCapacity" >}}">CSIStorageCapacity): Created

401: Unauthorized

delete 删除 CSIStorageCapacity

HTTP 请求

DELETE /apis/storage.k8s.io/v1/namespaces/{namespace}/csistoragecapacities/{name}

参数

  • name (路径参数): string必需

    CSIStorageCapacity 的名称

  • namespace (路径参数): string必需

    <a href="{{< ref "../common-parameters/common-parameters#namespace" >}}">namespace

  • body: <a href="{{< ref "../common-definitions/delete-options#DeleteOptions" >}}">DeleteOptions

  • dryRun (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#dryRun" >}}">dryRun

  • gracePeriodSeconds (查询参数): integer

    <a href="{{< ref "../common-parameters/common-parameters#gracePeriodSeconds" >}}">gracePeriodSeconds

  • pretty (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#pretty" >}}">pretty

  • propagationPolicy (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#propagationPolicy" >}}">propagationPolicy

响应

200 (<a href="{{< ref "../common-definitions/status#Status" >}}">Status): OK

202 (<a href="{{< ref "../common-definitions/status#Status" >}}">Status): Accepted

401: Unauthorized

deletecollection 删除 CSIStorageCapacity 的集合

HTTP 请求

DELETE /apis/storage.k8s.io/v1/namespaces/{namespace}/csistoragecapacities

参数

  • namespace (路径参数): string必需

    <a href="{{< ref "../common-parameters/common-parameters#namespace" >}}">namespace

  • body: <a href="{{< ref "../common-definitions/delete-options#DeleteOptions" >}}">DeleteOptions

  • continue (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#continue" >}}">continue

  • dryRun (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#dryRun" >}}">dryRun

  • fieldSelector (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#fieldSelector" >}}">fieldSelector

  • gracePeriodSeconds (查询参数): integer

    <a href="{{< ref "../common-parameters/common-parameters#gracePeriodSeconds" >}}">gracePeriodSeconds

  • labelSelector (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#labelSelector" >}}">labelSelector

  • limit (查询参数): integer

    <a href="{{< ref "../common-parameters/common-parameters#limit" >}}">limit

  • pretty (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#pretty" >}}">pretty

  • propagationPolicy (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#propagationPolicy" >}}">propagationPolicy

  • resourceVersion (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#resourceVersion" >}}">resourceVersion

  • resourceVersionMatch (查询参数): string

    <a href="{{< ref "../common-parameters/common-parameters#resourceVersionMatch" >}}">resourceVersionMatch

  • sendInitialEvents (查询参数): boolean

    <a href="{{< ref "../common-parameters/common-parameters#sendInitialEvents" >}}">sendInitialEvents

  • timeoutSeconds (查询参数): integer

    <a href="{{< ref "../common-parameters/common-parameters#timeoutSeconds" >}}">timeoutSeconds

响应

200 (<a href="{{< ref "../common-definitions/status#Status" >}}">Status): OK

401: Unauthorized