FlowSchema

FlowSchema 定义了一组流的模式。

apiVersion: flowcontrol.apiserver.k8s.io/v1

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

FlowSchema

FlowSchema 定义了一组流的模式。注意,流由一组具有相似属性的入站 API 请求组成,并通过一对字符串来标识:FlowSchema 的名称和“流区分器(flow distinguisher)”。


FlowSchemaSpec

FlowSchemaSpec 描述了 FlowSchema 的规范结构。


  • distinguisherMethod (FlowDistinguisherMethod)

    distinguisherMethod 定义了如何为与此模式匹配的请求计算流区分器。nil 指定区分器被禁用,因此它将始终为空字符串。

    FlowDistinguisherMethod 指定流区分器的方法。

    • distinguisherMethod.type (string),必需

      type 是流区分器方法的类型。支持的类型有 "ByUser" 和 "ByNamespace"。必需。

  • matchingPrecedence (int32)

    matchingPrecedence 用于在与给定请求匹配的 FlowSchema 中进行选择。选择的 FlowSchema 是匹配优先级数值最低(我们认为逻辑上最高)的那些 FlowSchema 之一。每个 MatchingPrecedence 值必须在 [1,10000] 范围内。注意,如果未指定优先级,则默认设置为 1000。

  • priorityLevelConfiguration (PriorityLevelConfigurationReference),必需

    priorityLevelConfiguration 应该引用集群中的 PriorityLevelConfiguration。如果引用无法解析,则 FlowSchema 将被忽略并在其状态中标记为无效。必需。

    PriorityLevelConfigurationReference 包含指向正在使用的“请求优先级(request-priority)”的信息。

    • priorityLevelConfiguration.name (string),必需

      name 是被引用的优先级配置的名称。必需。

  • rules ([]PolicyRulesWithSubjects)

    原子性:在合并期间将被替换

    rules 描述了哪些请求将与此流模式匹配。当且仅当 rules 中的至少一个成员与请求匹配时,此 FlowSchema 才匹配该请求。如果它是一个空切片,则没有请求会与 FlowSchema 匹配。

    PolicyRulesWithSubjects 规定了适用于 apiserver 请求的测试。该测试考虑发起请求的主体、被请求的动词以及要操作的资源。当且仅当 (a) subjects 中的至少一个成员与请求匹配,并且 (b) resourceRules 或 nonResourceRules 中的至少一个成员与请求匹配时,此 PolicyRulesWithSubjects 才匹配该请求。

    • rules.subjects ([]Subject),必需

      原子性:在合并期间将被替换

      subjects 是此规则关心的普通用户、serviceaccount 或组的列表。此切片中必须至少有一个成员。包含 system:authenticated 和 system:unauthenticated 用户组的切片匹配所有请求。必需。

      Subject 匹配请求的发起者,由请求认证系统标识。匹配发起者有三种方式:按用户、按组或按 service account。

      • rules.subjects.kind (string),必需

        kind 指示其他字段中的哪一个非空。必需。

      • rules.subjects.group (GroupSubject)

        group 根据用户组名称进行匹配。

        GroupSubject 包含 group 类型主体的详细信息。

      • rules.subjects.serviceAccount (ServiceAccountSubject)

        serviceAccount 匹配 ServiceAccounts。

        ServiceAccountSubject 包含 service-account 类型主体的详细信息。

        • rules.subjects.serviceAccount.name (string),必需

          name 是要匹配的 ServiceAccount 对象的名称,或 "*" 以匹配所有名称。必需。

        • rules.subjects.serviceAccount.namespace (string),必需

          namespace 是要匹配的 ServiceAccount 对象的命名空间。必需。

      • rules.subjects.user (UserSubject)

        user 根据用户名进行匹配。

        UserSubject 包含 user 类型主体的详细信息。

        • rules.subjects.user.name (string),必需

          name 是要匹配的用户名,或 "*" 以匹配所有用户名。必需。

    • rules.nonResourceRules ([]NonResourcePolicyRule)

      原子性:在合并期间将被替换

      nonResourceRules 是一个 NonResourcePolicyRules 列表,用于根据动词和目标非资源 URL 标识匹配的请求。

      NonResourcePolicyRule 是一个谓词,用于根据动词和目标非资源 URL 匹配非资源请求。当且仅当 (a) verbs 中的至少一个成员与请求匹配,并且 (b) nonResourceURLs 中的至少一个成员与请求匹配时,NonResourcePolicyRule 才匹配该请求。

      • rules.nonResourceRules.nonResourceURLs ([]string),必需

        Set: 合并时保留唯一值

        nonResourceURLs 是用户应该有访问权限的一组 URL 前缀,且可能不为空。例如

        • "/healthz" 是合法的
        • "/hea*" 是非法的
        • "/hea" 是合法的,但匹配不到任何东西
        • "/hea/*" 也匹配不到任何东西
        • "/healthz/" 匹配所有组件的健康检查。"" 匹配所有非资源 URL。如果存在,它必须是唯一的条目。必需。
      • rules.nonResourceRules.verbs ([]string),必需

        Set: 合并时保留唯一值

        verbs 是匹配的动词列表,且可能不为空。"*" 匹配所有动词。如果存在,它必须是唯一的条目。必需。

    • rules.resourceRules ([]ResourcePolicyRule)

      原子性:在合并期间将被替换

      resourceRules 是一个 ResourcePolicyRules 切片,用于根据动词和目标资源标识匹配的请求。resourceRulesnonResourceRules 中至少有一个必须是非空的。

      ResourcePolicyRule 是一个谓词,用于匹配某些资源请求,测试请求的动词和目标资源。当且仅当满足以下条件时,ResourcePolicyRule 才匹配资源请求:(a) verbs 中的至少一个成员与请求匹配,(b) apiGroups 中的至少一个成员与请求匹配,(c) resources 中的至少一个成员与请求匹配,并且 (d) 请求不指定命名空间(即 Namespace=="")且 clusterScope 为 true,或者请求指定命名空间且 namespaces 中的至少一个成员与请求的命名空间匹配。

      • rules.resourceRules.apiGroups ([]string),必需

        Set: 合并时保留唯一值

        apiGroups 是匹配的 API 组列表,且可能不为空。"*" 匹配所有 API 组,如果存在,则必须是唯一的条目。必需。

      • rules.resourceRules.resources ([]string),必需

        Set: 合并时保留唯一值

        resources 是匹配的资源列表(即,小写和复数形式),如果需要,可以包含子资源。例如,[ "services", "nodes/status" ]。此列表可能不为空。"*" 匹配所有资源,如果存在,则必须是唯一的条目。必需。

      • rules.resourceRules.verbs ([]string),必需

        Set: 合并时保留唯一值

        verbs 是匹配的动词列表,且可能不为空。"*" 匹配所有动词,如果存在,则必须是唯一的条目。必需。

      • rules.resourceRules.clusterScope (boolean)

        clusterScope 指示是否匹配未指定命名空间的请求(这可能是因为资源未按命名空间划分,或者请求针对所有命名空间)。如果省略此字段或设置为 false,则 namespaces 字段必须包含一个非空列表。

      • rules.resourceRules.namespaces ([]string)

        Set: 合并时保留唯一值

        namespaces 是限制匹配的目标命名空间列表。指定目标命名空间的请求仅当 (a) 此列表包含该目标命名空间或 (b) 此列表包含 "" 时才匹配。注意,"" 匹配任何指定的命名空间,但不匹配未指定命名空间的请求(有关此内容,请参阅 clusterScope 字段)。此列表可以为空,但前提是 clusterScope 为 true。

FlowSchemaStatus

FlowSchemaStatus 表示 FlowSchema 的当前状态。


  • conditions ([]FlowSchemaCondition)

    Patch 策略:基于键 type 合并

    Map: 合并时保留键 type 的唯一值

    conditions 是 FlowSchema 当前状态的列表。

    FlowSchemaCondition 描述了 FlowSchema 的条件。

    • conditions.lastTransitionTime (Time)

      lastTransitionTime 是条件上次从一个状态转换为另一个状态的时间。

      Time 是 time.Time 的一个封装,支持正确地序列化为 YAML 和 JSON。提供了许多 time 包工厂方法的封装。

    • conditions.message (string)

      message 是人类可读的消息,指示上次转换的详细信息。

    • conditions.reason (string)

      reason 是一个唯一的、单词组成的 CamelCase 字符串,表示条件上次转换的原因。

    • conditions.status (string)

      status 是条件的状态。可以是 True, False, Unknown。必需。

    • conditions.type (string)

      type 是条件的类型。必需。

FlowSchemaList

FlowSchemaList 是 FlowSchema 对象的列表。


操作


get 读取指定的 FlowSchema

HTTP 请求

GET /apis/flowcontrol.apiserver.k8s.io/v1/flowschemas/{name}

参数

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

    FlowSchema 的名称

  • pretty (在查询中): string

    pretty

响应

200 (FlowSchema): OK

401: 未授权

get 读取指定 FlowSchema 的状态

HTTP 请求

GET /apis/flowcontrol.apiserver.k8s.io/v1/flowschemas/{name}/status

参数

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

    FlowSchema 的名称

  • pretty (在查询中): string

    pretty

响应

200 (FlowSchema): OK

401: 未授权

list 列出或监视类型为 FlowSchema 的对象

HTTP 请求

GET /apis/flowcontrol.apiserver.k8s.io/v1/flowschemas

参数

响应

200 (FlowSchemaList): OK

401: 未授权

create 创建 FlowSchema

HTTP 请求

POST /apis/flowcontrol.apiserver.k8s.io/v1/flowschemas

参数

响应

200 (FlowSchema): OK

201 (FlowSchema): 创建

202 (FlowSchema): 已接受

401: 未授权

update 替换指定的 FlowSchema

HTTP 请求

PUT /apis/flowcontrol.apiserver.k8s.io/v1/flowschemas/{name}

参数

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

    FlowSchema 的名称

  • body: FlowSchema,必需

  • dryRun (在查询中): string

    dryRun

  • fieldManager (在查询中): string

    fieldManager

  • fieldValidation (在查询中): string

    fieldValidation

  • pretty (在查询中): string

    pretty

响应

200 (FlowSchema): OK

201 (FlowSchema): 创建

401: 未授权

update 替换指定的 FlowSchema 的状态

HTTP 请求

PUT /apis/flowcontrol.apiserver.k8s.io/v1/flowschemas/{name}/status

参数

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

    FlowSchema 的名称

  • body: FlowSchema,必需

  • dryRun (在查询中): string

    dryRun

  • fieldManager (在查询中): string

    fieldManager

  • fieldValidation (在查询中): string

    fieldValidation

  • pretty (在查询中): string

    pretty

响应

200 (FlowSchema): OK

201 (FlowSchema): 创建

401: 未授权

patch 部分更新指定的 FlowSchema

HTTP 请求

PATCH /apis/flowcontrol.apiserver.k8s.io/v1/flowschemas/{name}

参数

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

    FlowSchema 的名称

  • body: Patch,必需

  • dryRun (在查询中): string

    dryRun

  • fieldManager (在查询中): string

    fieldManager

  • fieldValidation (在查询中): string

    fieldValidation

  • force (在查询中): boolean

    force

  • pretty (在查询中): string

    pretty

响应

200 (FlowSchema): OK

201 (FlowSchema): 创建

401: 未授权

patch 部分更新指定的 FlowSchema 的状态

HTTP 请求

PATCH /apis/flowcontrol.apiserver.k8s.io/v1/flowschemas/{name}/status

参数

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

    FlowSchema 的名称

  • body: Patch,必需

  • dryRun (在查询中): string

    dryRun

  • fieldManager (在查询中): string

    fieldManager

  • fieldValidation (在查询中): string

    fieldValidation

  • force (在查询中): boolean

    force

  • pretty (在查询中): string

    pretty

响应

200 (FlowSchema): OK

201 (FlowSchema): 创建

401: 未授权

delete 删除 FlowSchema

HTTP 请求

DELETE /apis/flowcontrol.apiserver.k8s.io/v1/flowschemas/{name}

参数

响应

200 (Status): OK

202 (Status): 已接受

401: 未授权

deletecollection 删除 FlowSchema 集合

HTTP 请求

DELETE /apis/flowcontrol.apiserver.k8s.io/v1/flowschemas

参数

响应

200 (Status): OK

401: 未授权

本页面自动生成。

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

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