|
| 1 | +--- |
| 2 | +title: DeclarativeValidationTakeover |
| 3 | +content_type: feature_gate |
| 4 | +_build: |
| 5 | + list: never |
| 6 | + render: false |
| 7 | + |
| 8 | +stages: |
| 9 | + - stage: beta |
| 10 | + defaultValue: false |
| 11 | + fromVersion: "1.33" |
| 12 | +--- |
| 13 | + |
| 14 | +<!-- |
| 15 | +When enabled, along with the |
| 16 | +[DeclarativeValidation](/docs/reference/command-line-tools-reference/feature-gates/DeclarativeValidation.md) |
| 17 | +feature gate, declarative validation errors are returned directly to the caller, replacing hand-written validation |
| 18 | +errors for rules that have declarative implementations. When disabled (and `DeclarativeValidation` is enabled), |
| 19 | +hand-written validation errors are always returned, effectively putting declarative validation in a |
| 20 | +__mismatch validation mode__ that monitors but does not affect API responses. |
| 21 | +This __mismatch validation mode__ allows for the monitoring of the `declarative_validation_mismatch_total` |
| 22 | +and `declarative_validation_panic_total` metrics which are implementation details for a safer rollout, |
| 23 | +average user shouldn't need to interact with it directly. This feature gate only operates on the kube-apiserver. |
| 24 | +Note: Although declarative validation aims for functional equivalence with hand-written validation, |
| 25 | +the exact description of error messages may differ between the two approaches. |
| 26 | +--> |
| 27 | +启用此特性门控后,若同时启用了 |
| 28 | +[DeclarativeValidation](/zh-cn/docs/reference/command-line-tools-reference/feature-gates/DeclarativeValidation) |
| 29 | +特性门控,具有声明式实现的验证规则将直接返回声明式验证错误,替代手动验证错误。 |
| 30 | +若此特性门控被禁用(但启用了 `DeclarativeValidation`),则始终返回手动验证错误, |
| 31 | +这实际上将声明式验证置于一种**不匹配验证模式(mismatch validation mode)**,此模式仅用于监控,不影响 API 响应。 |
| 32 | +这种**不匹配验证模式**允许监控 `declarative_validation_mismatch_total` 和 `declarative_validation_panic_total` |
| 33 | +指标,这是为了实现更安全的特性上线所做的实现细节,普通用户通常无需直接与之交互。此特性门控仅作用于 kube-apiserver。 |
| 34 | + |
| 35 | +注意:尽管声明式验证旨在实现与手动验证等价的功能,但两者返回的错误消息的确切描述在细节上可能有所不同。 |
0 commit comments