Merge pull request #48089 from jpbetz/custom-resource-field-selectors-ga

KEP-4358: Custom resource field selectors GA
This commit is contained in:
Kubernetes Prow Robot 2024-10-31 15:51:26 +00:00 committed by GitHub
commit 4aef52de26
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 16 additions and 9 deletions

View File

@ -316,9 +316,8 @@ may also be used with field selectors when included in the `spec.versions[*].sel
{{< feature-state feature_gate_name="CustomResourceFieldSelectors" >}}
The `spec.versions[*].selectableFields` field of a {{< glossary_tooltip term_id="CustomResourceDefinition" text="CustomResourceDefinition" >}} may be used to
declare which other fields in a custom resource may be used in field selectors
with the feature of `CustomResourceFieldSelectors`
[feature gate](/docs/reference/command-line-tools-reference/feature-gates/) (This feature gate is enabled by default since Kubernetes v1.31).
declare which other fields in a custom resource may be used in field selectors.
The following example adds the `.spec.color` and `.spec.size` fields as
selectable fields.

View File

@ -46,6 +46,14 @@ Error from server (BadRequest): Unable to find "ingresses" that match label sele
| Node | `spec.unschedulable` |
| CertificateSigningRequest | `spec.signerName` |
### Custom resources fields
All custom resource types support the `metadata.name` and `metadata.namespace` fields.
Additionally, the `spec.versions[*].selectableFields` field of a {{< glossary_tooltip term_id="CustomResourceDefinition" text="CustomResourceDefinition" >}}
declares which other fields in a custom resource may be used in field selectors. See [selectable fields for custom resources](/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/#crd-selectable-fields)
for more information about how to use field selectors with CustomResourceDefinitions.
## Supported operators
You can use the `=`, `==`, and `!=` operators with field selectors (`=` and `==` mean the same thing). This `kubectl` command, for example, selects all Kubernetes Services that aren't in the `default` namespace:
@ -72,4 +80,4 @@ You can use field selectors across multiple resource types. This `kubectl` comma
```shell
kubectl get statefulsets,services --all-namespaces --field-selector metadata.namespace!=default
```
```

View File

@ -12,7 +12,11 @@ stages:
toVersion: "1.30"
- stage: beta
defaultValue: true
fromVersion: "1.31"
fromVersion: "1.31"
toVersion: "1.31"
- stage: stable
defaultValue: true
fromVersion: "1.32"
---
Enable `selectableFields` in the

View File

@ -1685,10 +1685,6 @@ may also be used with field selectors when included in the `spec.versions[*].sel
{{< feature-state feature_gate_name="CustomResourceFieldSelectors" >}}
For Kubernetes {{< skew currentVersion >}} the ability to define field selectors for
custom resources is available by default (enabled by default since Kubernetes v1.31);
you can disable it for your cluster by turning off the `CustomResourceFieldSelectors`
[feature gate](/docs/reference/command-line-tools-reference/feature-gates/).
The `spec.versions[*].selectableFields` field of a {{< glossary_tooltip term_id="CustomResourceDefinition" text="CustomResourceDefinition" >}} may be used to
declare which other fields in a custom resource may be used in field selectors
with the feature of `CustomResourceFieldSelectors`