|
| 1 | +<!-- |
| 2 | +api_metadata: |
| 3 | + apiVersion: "" |
| 4 | + import: "k8s.io/apimachinery/pkg/apis/meta/v1" |
| 5 | + kind: "LabelSelector" |
| 6 | +content_type: "api_reference" |
| 7 | +description: "A label selector is a label query over a set of resources." |
| 8 | +title: "LabelSelector" |
| 9 | +weight: 2 |
| 10 | +--> |
| 11 | + |
| 12 | +--- |
| 13 | +api_metadata: |
| 14 | + apiVersion: "" |
| 15 | + import: "k8s.io/apimachinery/pkg/apis/meta/v1" |
| 16 | + kind: "LabelSelector" |
| 17 | +content_type: "api_reference" |
| 18 | +description: "标签选择器是对一组资源的标签查询。" |
| 19 | +title: "标签选择器" |
| 20 | +weight: 2 |
| 21 | +auto_generated: true |
| 22 | +--- |
| 23 | + |
| 24 | +`import "k8s.io/apimachinery/pkg/apis/meta/v1"` |
| 25 | + |
| 26 | +<!-- A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.--> |
| 27 | + |
| 28 | +标签选择器是对一组资源的标签查询。 |
| 29 | + |
| 30 | +`matchLabels` 和 `matchExpressions` 的结果按逻辑与的关系组合。一个 `empty` 标签选择器匹配所有对象。一个 `null` 标签选择器不匹配任何对象。 |
| 31 | + |
| 32 | +<hr> |
| 33 | + |
| 34 | + <!-- |
| 35 | + - **matchExpressions** ([]LabelSelectorRequirement) |
| 36 | + |
| 37 | + matchExpressions is a list of label selector requirements. The requirements are ANDed. |
| 38 | + |
| 39 | + <a name="LabelSelectorRequirement"></a> |
| 40 | + *A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.* |
| 41 | + --> |
| 42 | + |
| 43 | +- **matchExpressions** ([]LabelSelectorRequirement) |
| 44 | + |
| 45 | + `matchExpressions` 是 `LabelSelectorRequirement` 的列表,这些需求结果按逻辑与的关系来计算。 |
| 46 | + |
| 47 | + <a name="LabelSelectorRequirement"></a> |
| 48 | + *标签选择器要求是包含值、键和关联键和值的运算符的选择器。* |
| 49 | + |
| 50 | + <!-- |
| 51 | + - **matchExpressions.key** (string), required |
| 52 | + *Patch strategy: merge on key `key`* |
| 53 | + key is the label key that the selector applies to. |
| 54 | + --> |
| 55 | + |
| 56 | + - **matchExpressions.key** (string), 必填 |
| 57 | + |
| 58 | + *补丁策略: 按照键 `key` 合并* |
| 59 | + |
| 60 | + `key` 是选择器应用的标签键. |
| 61 | + |
| 62 | + <!-- |
| 63 | + - **matchExpressions.operator** (string), required |
| 64 | + operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. |
| 65 | + --> |
| 66 | + |
| 67 | + - **matchExpressions.operator** (string),必填 |
| 68 | + |
| 69 | + operator 表示键与一组值的关系。有效的运算符包括 `In`、`NotIn`、`Exists` 和 `DoesNotExist`。 |
| 70 | + |
| 71 | + <!-- |
| 72 | + - **matchExpressions.values** ([]string) |
| 73 | +
|
| 74 | + values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. |
| 75 | + --> |
| 76 | + |
| 77 | + - **matchExpressions.values** ([]string) |
| 78 | + |
| 79 | + `values` 是一个字符串值数组。如果运算符为 `In` 或 `NotIn`,则 `values` 数组必须为非空。 |
| 80 | + |
| 81 | + 如果运算符是 `Exists` 或 `DoesNotExist`,则 `values` 数组必须为空。 |
| 82 | + |
| 83 | + 该数组在战略性补丁(Strategic Merge Patch)期间被替换。 |
| 84 | + |
| 85 | +<!-- |
| 86 | +- **matchLabels** (map[string]string) |
| 87 | +
|
| 88 | + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. |
| 89 | +--> |
| 90 | + |
| 91 | + - **matchLabels** (map[string]string) |
| 92 | + |
| 93 | + `matchLabels` 是 {`key`,`value`} 键值对的映射。 |
| 94 | + |
| 95 | + `matchLabels` 映射中的单个 {`key`,`value`} 键值对相当于 `matchExpressions` 的一个元素,其键字段为 `key`,运算符为 `In`,`values` 数组仅包含 `value`。 |
| 96 | + |
| 97 | + 所表达的需求最终要按逻辑与的关系组合。 |
| 98 | + |
| 99 | + |
| 100 | + |
| 101 | + |
| 102 | + |
| 103 | + |
0 commit comments