CSIStorageCapacity

CSIStorageCapacity 存储单次 CSI GetCapacity 调用的结果。

apiVersion: storage.k8s.io/v1

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

CSIStorageCapacity

CSIStorageCapacity 存储单次 CSI GetCapacity 调用的结果。对于给定的 StorageClass,此对象描述特定拓扑段中可用的容量。这可用于考虑在哪里实例化新的 PersistentVolume。

例如,这可以表达诸如:- StorageClass "standard" 在 "topology.kubernetes.io/zone=us-east1" 中有 "1234 GiB" 可用 - StorageClass "localssd" 在 "kubernetes.io/hostname=knode-abc123" 中有 "10 GiB" 可用

以下三种情况都表示特定组合没有可用容量:- 不存在具有合适拓扑和存储类名称的对象 - 存在此类对象,但未设置容量 - 存在此类对象,但容量为零

这些对象的生产者可以决定哪种方法更合适。

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


  • apiVersion: storage.k8s.io/v1

  • kind: CSIStorageCapacity

  • metadata (ObjectMeta)

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

    对象是带有命名空间的。

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

  • storageClassName (string),必需

    storageClassName 表示报告容量所适用的 StorageClass 的名称。它必须满足与 StorageClass 对象名称相同的要求(非空、DNS 子域)。如果该对象不再存在,则 CSIStorageCapacity 对象已过时,应由其创建者删除。此字段是不可变的。

  • capacity (Quantity)

    capacity 是 CSI 驱动程序在其 GetCapacityResponse 中针对与前述字段匹配的拓扑和参数的 GetCapacityRequest 报告的值。

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

  • maximumVolumeSize (Quantity)

    maximumVolumeSize 是 CSI 驱动程序在其 GetCapacityResponse 中针对与前述字段匹配的拓扑和参数的 GetCapacityRequest 报告的值。

    自 CSI 规范 1.4.0 起,此字段定义了在 CreateVolumeRequest.capacity_range.required_bytes 字段中可用于创建与 GetCapacityRequest 中参数相同的卷的最大大小。Kubernetes API 中对应的值是卷申请中的 ResourceRequirements.Requests。

  • nodeTopology (LabelSelector)

    nodeTopology 定义了哪些节点可以访问报告了容量的存储。如果未设置,则该存储无法从集群中的任何节点访问。如果为空,则该存储可从所有节点访问。此字段是不可变的。

CSIStorageCapacityList

CSIStorageCapacityList 是 CSIStorageCapacity 对象的集合。


操作


get 读取指定的 CSIStorageCapacity

HTTP 请求

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

参数

  • name (在路径中): string,必需

    CSIStorageCapacity 的名称

  • namespace (在路径中): string,必需

    命名空间

  • pretty (在查询中): string

    pretty

响应

200 (CSIStorageCapacity): OK

401: 未授权

list 列出或监视 CSIStorageCapacity 类型的对象

HTTP 请求

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

参数

响应

200 (CSIStorageCapacityList): OK

401: 未授权

list 列出或监视 CSIStorageCapacity 类型的对象

HTTP 请求

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

参数

响应

200 (CSIStorageCapacityList): OK

401: 未授权

create 创建 CSIStorageCapacity

HTTP 请求

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

参数

响应

200 (CSIStorageCapacity): OK

201 (CSIStorageCapacity): Created

202 (CSIStorageCapacity): Accepted

401: 未授权

update 替换指定的 CSIStorageCapacity

HTTP 请求

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

参数

响应

200 (CSIStorageCapacity): OK

201 (CSIStorageCapacity): Created

401: 未授权

patch 部分更新指定的 CSIStorageCapacity

HTTP 请求

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

参数

  • name (在路径中): string,必需

    CSIStorageCapacity 的名称

  • namespace (在路径中): string,必需

    命名空间

  • body: Patch,必需

  • dryRun (在查询中): string

    dryRun

  • fieldManager (在查询中): string

    fieldManager

  • fieldValidation (在查询中): string

    fieldValidation

  • force (在查询中): boolean

    force

  • pretty (在查询中): string

    pretty

响应

200 (CSIStorageCapacity): OK

201 (CSIStorageCapacity): Created

401: 未授权

delete 删除 CSIStorageCapacity

HTTP 请求

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

参数

响应

200 (Status): OK

202 (Status): Accepted

401: 未授权

deletecollection 删除 CSIStorageCapacity 集合

HTTP 请求

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

参数

响应

200 (Status): OK

401: 未授权

本页面是自动生成的。

如果你计划报告此页面的问题,请在问题描述中提及该页面是自动生成的。修正可能需要在 Kubernetes 项目的其他地方进行。

最后修改时间 2025 年 4 月 9 日下午 6:36 PST:更新 v1.32 的 API 参考文档 (a3b579d035)