From de66174a87d42313ee736cf80d8ad523567899a5 Mon Sep 17 00:00:00 2001 From: "xin.li" Date: Thu, 18 May 2023 22:54:58 +0800 Subject: [PATCH] [zh-cn] sync common-parameters.md event-v1.md Signed-off-by: xin.li --- .../cluster-resources/event-v1.md | 21 +++++ .../common-parameters/common-parameters.md | 85 ++++++++++++++----- 2 files changed, 84 insertions(+), 22 deletions(-) diff --git a/content/zh-cn/docs/reference/kubernetes-api/cluster-resources/event-v1.md b/content/zh-cn/docs/reference/kubernetes-api/cluster-resources/event-v1.md index a62915f651..b71cc7c823 100644 --- a/content/zh-cn/docs/reference/kubernetes-api/cluster-resources/event-v1.md +++ b/content/zh-cn/docs/reference/kubernetes-api/cluster-resources/event-v1.md @@ -403,6 +403,13 @@ GET /apis/events.k8s.io/v1/namespaces/{namespace}/events }}">resourceVersionMatch + +- **sendInitialEvents** (**查询参数**): boolean + + }}">sendInitialEvents + @@ -498,6 +505,13 @@ GET /apis/events.k8s.io/v1/events }}">resourceVersionMatch + +- **sendInitialEvents** (**查询参数**): boolean + + }}">sendInitialEvents + @@ -917,6 +931,13 @@ DELETE /apis/events.k8s.io/v1/namespaces/{namespace}/events }}">resourceVersionMatch + +- **sendInitialEvents** (**查询参数**): boolean + + }}">sendInitialEvents + diff --git a/content/zh-cn/docs/reference/kubernetes-api/common-parameters/common-parameters.md b/content/zh-cn/docs/reference/kubernetes-api/common-parameters/common-parameters.md index eb7942fbb6..d1bb2581c5 100644 --- a/content/zh-cn/docs/reference/kubernetes-api/common-parameters/common-parameters.md +++ b/content/zh-cn/docs/reference/kubernetes-api/common-parameters/common-parameters.md @@ -21,9 +21,6 @@ guide. You can file document formatting bugs against the [reference-docs](https://github.com/kubernetes-sigs/reference-docs/) project. --> - - - ## allowWatchBookmarks {#allowWatchBookmarks} 当需要从服务器检索更多结果时,应该设置 continue 选项。由于这个值是服务器定义的, -客户端只能使用先前查询结果中具有相同查询参数的 continue 值(continue值除外), +客户端只能使用先前查询结果中具有相同查询参数的 continue 值(continue 值除外), 服务器可能拒绝它识别不到的 continue 值。 -如果指定的 continue 值不再有效,无论是由于过期(通常是 5 到 15 分钟) +如果指定的 continue 值不再有效,无论是由于过期(通常是 5 到 15 分钟) 还是服务器上的配置更改,服务器将响应 "410 ResourceExpired" 错误和一个 continue 令牌。 -当 watch 字段为 true 时,不支持此字段。客户端可以从服务器返回的最后一个 resourceVersion 值开始监视,就不会错过任何修改。 +当 watch 字段为 true 时,不支持此字段。客户端可以从服务器返回的最后一个 resourceVersion +值开始监视,就不会错过任何修改。
## dryRun {#dryRun} @@ -89,22 +87,21 @@ A selector to restrict the list of returned objects by their fields. Defaults to ## fieldValidation {#fieldValidation} -fieldValidation 指示服务器如何处理请求(POST/PUT/PATCH)中包含未知或重复字段的对象, -前提是 `ServerSideFieldValidation` 特性门控也已启用。 +fieldValidation 指示服务器如何处理请求(POST/PUT/PATCH)中包含未知或重复字段的对象。 有效值为: - Ignore:这将忽略从对象中默默删除的所有未知字段,并将忽略除解码器遇到的最后一个重复字段之外的所有字段。 - 这是在 v1.23 之前的默认行为,也是当 `ServerSideFieldValidation` 特性门控被禁用时的默认行为。 + 这是在 v1.23 之前的默认行为。 - Warn:这将针对从对象中删除的各个未知字段以及所遇到的各个重复字段,分别通过标准警告响应头发出警告。 如果没有其他错误,请求仍然会成功,并且只会保留所有重复字段中的最后一个。 - 这是启用 `ServerSideFieldValidation` 特性门控时的默认值。 + 这是 v1.23+ 版本中的默认设置。 @@ -126,8 +123,9 @@ Force 将“强制”应用请求。这意味着用户将重新获得他人拥 The duration in seconds before the object should be deleted. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately.
--> -删除对象前的持续时间(秒数)。值必须为非负整数。取值为 0 表示立即删除。 -如果该值为 nil,将使用指定类型的默认宽限期。如果没有指定,默认为每个对象的设置值。0 表示立即删除。 +删除对象前的持续时间(秒数)。值必须为非负整数。取值为 0 表示立即删除。 +如果该值为 nil,将使用指定类型的默认宽限期。如果没有指定,默认为每个对象的设置值。 +0 表示立即删除。
## labelSelector {#labelSelector} @@ -147,7 +145,7 @@ limit 是一个列表调用返回的最大响应数。如果有更多的条目 -设置 limit 可能会在所有请求的对象被过滤掉的情况下返回少于请求的条目数量(下限为零), +设置 limit 可能会在所有请求的对象被过滤掉的情况下返回少于请求的条目数量(下限为零), 并且客户端应该只根据 continue 字段是否存在来确定是否有更多的结果可用。 服务器可能选择不支持 limit 参数,并将返回所有可用的结果。 如果指定了 limit 并且 continue 字段为空,客户端可能会认为没有更多的结果可用。 @@ -204,7 +202,7 @@ Defaults to unset
--> resourceVersion 对请求所针对的资源版本设置约束。 -详情请参见 https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions。 +详情请参见 https://kubernetes.io/zh-cn/docs/reference/using-api/api-concepts/#resource-versions。 默认不设置
@@ -218,12 +216,59 @@ Defaults to unset --> resourceVersionMatch 字段决定如何将 resourceVersion 应用于列表调用。 强烈建议对设置了 resourceVersion 的列表调用设置 resourceVersion 匹配, -具体请参见 https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions。 +具体请参见 https://kubernetes.io/zh-cn/docs/reference/using-api/api-concepts/#resource-versions。 默认不设置
+## sendInitialEvents {#sendInitialEvents} + + +`sendInitialEvents=true` 可以和 `watch=true` 一起设置。 +在这种情况下,监视通知流将从合成事件开始,以生成集合中对象的当前状态。 +一旦发送了所有此类事件,将发送合成的 "Bookmark" 事件。"bookmark" 将报告对象集合对应的 +ResourceVersion(RV),并标有 `"k8s.io/initial-events-end": "true"` 注解。 +之后,监视通知流将照常进行,发送与所监视的对象的变更(在 RV 之后)对应的监视事件。 + + +当设置了 sendInitialEvents 选项时,我们还需要设置 resourceVersionMatch +选项。watch 请求的语义如下: +- `resourceVersionMatch` = NotOlderThan + 被解释为"数据至少与提供的 `resourceVersion` 一样新", + 最迟当状态同步到与 ListOptions 提供的版本一样新的 `resourceVersion` 时, + 发送 bookmark 事件。如果 `resourceVersion` 未设置,这将被解释为"一致读取", + 最迟当状态同步到开始处理请求的那一刻时,发送 bookmark 事件。 +- `resourceVersionMatch` 设置为任何其他值或返回 unsetInvalid 错误。 + + +如果 `resourceVersion=""` 或 `resourceVersion="0"`(出于向后兼容性原因),默认为 +true,否则默认为 false。 + +
+ ## timeoutSeconds {#timeoutSeconds}