Information in this document may be out of date

This document has an older update date than the original, so the information it contains may be out of date. If you're able to read English, see the English version for the most up-to-date information: LabelSelector

LabelSelector

标签选择器是对一组资源的标签查询。

import "k8s.io/apimachinery/pkg/apis/meta/v1"

标签选择器是对一组资源的标签查询。

matchLabelsmatchExpressions 的结果按逻辑与的关系组合。 一个 empty 标签选择器匹配所有对象。一个 null 标签选择器不匹配任何对象。


  • matchExpressions ([]LabelSelectorRequirement)

    matchExpressions 是标签选择器要求的列表,这些要求的结果按逻辑与的关系来计算。

    标签选择器要求是包含值、键和关联键和值的运算符的选择器。

    • matchExpressions.key (string), 必填

      补丁策略:按照键 key 合并

      key 是选择器应用的标签键。

    • matchExpressions.operator (string),必填

      operator 表示键与一组值的关系。有效的运算符包括 InNotInExistsDoesNotExist

    • matchExpressions.values ([]string)

      values 是一个字符串值数组。如果运算符为 InNotIn,则 values 数组必须为非空。

      如果运算符是 ExistsDoesNotExist,则 values 数组必须为空。

      该数组在策略性合并补丁(Strategic Merge Patch)期间被替换。

  • matchLabels (map[string]string)

    matchLabels 是 {key,value} 键值对的映射。

    matchLabels 映射中的单个 {key,value} 键值对相当于 matchExpressions 的一个元素,其键字段为 key,运算符为 Invalues 数组仅包含 value

    所表达的需求最终要按逻辑与的关系组合。

该页面是自动生成的。

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

最后修改 June 10, 2022 at 8:25 PM PST: Switch language name 'zh' to 'zh-cn' (c52818c03d)