[zh-cn] sync cel.md server-side-apply.md

Signed-off-by: xin.li <xin.li@daocloud.io>
pull/41266/head
xin.li 2023-05-22 23:13:30 +08:00
parent e1db2cc0e8
commit df56c1cf87
2 changed files with 5 additions and 5 deletions

View File

@ -89,7 +89,7 @@ CEL 表达式示例:
| `has(self.expired) && self.created + self.ttl < self.expired` | Validate that 'expired' date is after a 'create' date plus a 'ttl' duration | | `has(self.expired) && self.created + self.ttl < self.expired` | Validate that 'expired' date is after a 'create' date plus a 'ttl' duration |
| `self.health.startsWith('ok')` | Validate a 'health' string field has the prefix 'ok' | | `self.health.startsWith('ok')` | Validate a 'health' string field has the prefix 'ok' |
| `self.widgets.exists(w, w.key == 'x' && w.foo < 10)` | Validate that the 'foo' property of a listMap item with a key 'x' is less than 10 | | `self.widgets.exists(w, w.key == 'x' && w.foo < 10)` | Validate that the 'foo' property of a listMap item with a key 'x' is less than 10 |
| `type(self) == string ? self == '99%' : self == 42` | Validate an int-or-string field for both the the int and string cases | | `type(self) == string ? self == '99%' : self == 42` | Validate an int-or-string field for both the int and string cases |
| `self.metadata.name == 'singleton'` | Validate that an object's name matches a specific value (making it a singleton) | | `self.metadata.name == 'singleton'` | Validate that an object's name matches a specific value (making it a singleton) |
| `self.set1.all(e, !(e in self.set2))` | Validate that two listSets are disjoint | | `self.set1.all(e, !(e in self.set2))` | Validate that two listSets are disjoint |
| `self.names.size() == self.details.size() && self.names.all(n, n in self.details)` | Validate the 'details' map is keyed by the items in the 'names' listSet | | `self.names.size() == self.details.size() && self.names.all(n, n in self.details)` | Validate the 'details' map is keyed by the items in the 'names' listSet |
@ -322,7 +322,7 @@ that `object` refers to, because `object` is dynamically typed.
<!-- <!--
The `has()` macro in CEL may be used in CEL expressions to check if a field of a The `has()` macro in CEL may be used in CEL expressions to check if a field of a
dynamically typed variable is accessable before attempting to access the field's dynamically typed variable is accessible before attempting to access the field's
value. For example: value. For example:
--> -->
在 CEL 中,`has()` 宏可用于检查动态类型变量的字段是否可访问,然后再尝试访问该字段的值。 在 CEL 中,`has()` 宏可用于检查动态类型变量的字段是否可访问,然后再尝试访问该字段的值。
@ -503,7 +503,7 @@ CEL 的资源约束特性用于防止 CEL 评估消耗过多的 API 服务器资
<!-- <!--
A key element of the resource constraint features is a _cost unit_ that CEL A key element of the resource constraint features is a _cost unit_ that CEL
defines as a way of tracking CPU utilization. Cost units are independant of defines as a way of tracking CPU utilization. Cost units are independent of
system load and hardware. Cost units are also deterministic; for any given CEL system load and hardware. Cost units are also deterministic; for any given CEL
expression and input data, evaluation of the expression by the CEL interpreter expression and input data, evaluation of the expression by the CEL interpreter
will always result in the same cost. will always result in the same cost.

View File

@ -25,14 +25,14 @@ min-kubernetes-server-version: 1.16
Server-Side Apply helps users and controllers manage their resources through Server-Side Apply helps users and controllers manage their resources through
declarative configurations. Clients can create and modify their declarative configurations. Clients can create and modify their
[objects](/docs/concepts/overview/working-with-objects/kubernetes-objects/) {{< glossary_tooltip text="objects" term_id="object" >}}
declaratively by sending their fully specified intent. declaratively by sending their fully specified intent.
--> -->
## 简介 {#introduction} ## 简介 {#introduction}
服务器端应用协助用户、控制器通过声明式配置的方式管理他们的资源。 服务器端应用协助用户、控制器通过声明式配置的方式管理他们的资源。
客户端可以发送完整描述的目标A fully specified intent 客户端可以发送完整描述的目标A fully specified intent
声明式地创建和修改[对象](/zh-cn/docs/concepts/overview/working-with-objects/kubernetes-objects/) 声明式地创建和修改{{< glossary_tooltip text="对象" term_id="object" >}}
<!-- <!--
A fully specified intent is a partial object that only includes the fields and A fully specified intent is a partial object that only includes the fields and