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"
标签选择器是对一组资源的标签查询。
matchLabels
和 matchExpressions
的结果按逻辑与的关系组合。
一个 empty
标签选择器匹配所有对象。一个 null
标签选择器不匹配任何对象。
-
matchExpressions ([]LabelSelectorRequirement)
matchExpressions
是标签选择器要求的列表,这些要求的结果按逻辑与的关系来计算。-
matchExpressions.key (string), 必填
补丁策略:按照键
key
合并key
是选择器应用的标签键。
-
matchExpressions.operator (string),必填
operator
表示键与一组值的关系。有效的运算符包括In
、NotIn
、Exists
和DoesNotExist
。
-
matchExpressions.values ([]string)
values
是一个字符串值数组。如果运算符为In
或NotIn
,则values
数组必须为非空。如果运算符是
Exists
或DoesNotExist
,则values
数组必须为空。该数组在策略性合并补丁(Strategic Merge Patch)期间被替换。
-
-
matchLabels (map[string]string)
matchLabels
是 {key
,value
} 键值对的映射。matchLabels
映射中的单个 {key
,value
} 键值对相当于matchExpressions
的一个元素,其键字段为key
,运算符为In
,values
数组仅包含value
。所表达的需求最终要按逻辑与的关系组合。
该页面是自动生成的。
如果你打算报告此页面的问题,请在问题描述中提及该页面是自动生成的。修复可能需要在 Kubernetes 项目的其他地方进行。