Skip to content

Commit 1f9f0a2

Browse files
kinzhitengqm
andcommitted
[zh]Update content/zh/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning.md
Update content/zh/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning.md Co-authored-by: Qiming Teng <[email protected]> Update content/zh/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning.md Co-authored-by: Qiming Teng <[email protected]> Update content/zh/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning.md Co-authored-by: Qiming Teng <[email protected]>
1 parent dcff2a8 commit 1f9f0a2

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

content/zh/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definition-versioning.md

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1384,8 +1384,8 @@ procedure.
13841384
<!--
13851385
*Option 1:* Use the Storage Version Migrator
13861386

1387-
1. Run the [storage Version migrator](https://github.com/kubernetes-sigs/kube-storage-version-migrator)
1388-
2. Remove the old version from the CustomResourceDefinition `status.storedVersions` field.
1387+
1. Run the [storage Version migrator](https://github.com/kubernetes-sigs/kube-storage-version-migrator)
1388+
2. Remove the old version from the CustomResourceDefinition `status.storedVersions` field.
13891389
-->
13901390

13911391
*选项 1:* 使用存储版本迁移程序(Storage Version Migrator)
@@ -1409,13 +1409,29 @@ The following is an example procedure to upgrade from `v1beta1` to `v1`.
14091409
2. Write an upgrade procedure to list all existing objects and write them with
14101410
the same content. This forces the backend to write objects in the current
14111411
storage version, which is `v1`.
1412-
3. Update the CustomResourceDefinition `Status` by removing `v1beta1` from
1413-
`storedVersions` field.
1412+
3. Remove `v1beta1` from the CustomResourceDefinition `status.storedVersions` field.
14141413
-->
14151414
1. 在 CustomResourceDefinition 文件中将 `v1` 设置为存储版本,并使用 kubectl 应用它。
14161415
`storedVersions`现在是`v1beta1, v1`。
14171416
2. 编写升级过程以列出所有现有对象并使用相同内容将其写回存储。
14181417
这会强制后端使用当前存储版本(即 `v1`)写入对象。
1419-
3. 通过从 `storedVersions` 字段中删除 `v1beta1` 来更新 CustomResourceDefinition
1420-
的`Status`。
1418+
3. 从 CustomResourceDefinition 的 `status.storedVersions` 字段中删除 `v1beta1`。
14211419

1420+
<!--
1421+
The `kubectl` tool currently cannot be used to edit or patch the `status` subresource on a CRD: see the [Kubectl Subresource Support KEP](https://github.com/kubernetes/enhancements/tree/master/keps/sig-cli/2590-kubectl-subresource) for more details.
1422+
1423+
The easier way to patch the status subresource from the CLI is directly interacting with the API server using the `curl` tool, in this example:
1424+
-->
1425+
{{< note >}}
1426+
`kubectl` 工具目前不能用于编辑或修补 CRD 上的 `status` 子资源:请参阅
1427+
[kubectl Subresource Support KEP](https://github.com/kubernetes/enhancements/tree/master/keps/sig-cli/2590-kubectl-subresource)
1428+
了解更多细节。
1429+
1430+
从 CLI 给 `status` 子资源打补丁的更简单的方法是使用 `curl` 工具直接与 API 服务器交互,示例:
1431+
```bash
1432+
kubectl proxy &
1433+
curl --header "Content-Type: application/json-patch+json" \
1434+
--request PATCH http://localhost:8001/apis/apiextensions.k8s.io/v1/customresourcedefinitions/<your CRD name here>/status \
1435+
--data '[{"op": "replace", "path": "/status/storedVersions", "value":["v1"]}]'
1436+
```
1437+
{{< /note >}}

0 commit comments

Comments
 (0)