Skip to content

Commit 67a4995

Browse files
authored
Merge pull request #34751 from fenggw-fnst/crd-version-removal
[zh-cn] Update custom-resource-definition-versioning.md
2 parents 2c6919d + 1ac6ed8 commit 67a4995

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

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

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,39 @@ spec:
509509
{{% /tab %}}
510510
{{< /tabs >}}
511511

512+
<!--
513+
### Version removal
514+
515+
An older API version cannot be dropped from a CustomResourceDefinition manifest until existing persisted data has been migrated to the newer API version for all clusters that served the older version of the custom resource, and the old version is removed from the `status.storedVersions` of the CustomResourceDefinition.
516+
-->
517+
### 版本删除 {#version-removal}
518+
519+
在为所有提供旧版本自定义资源的集群将现有数据迁移到新 API 版本,并且从 CustomResourceDefinition 的
520+
`status.storedVersions` 中删除旧版本之前,无法从 CustomResourceDefinition 清单文件中删除旧 API 版本。
521+
522+
```yaml
523+
apiVersion: apiextensions.k8s.io/v1
524+
kind: CustomResourceDefinition
525+
name: crontabs.example.com
526+
spec:
527+
group: example.com
528+
names:
529+
plural: crontabs
530+
singular: crontab
531+
kind: CronTab
532+
scope: Namespaced
533+
versions:
534+
- name: v1beta1
535+
# 此属性标明该自定义资源的 v1beta1 版本已不再提供。
536+
# 发给此版本的 API 请求会在服务器响应中收到未找到的错误。
537+
served: false
538+
schema: ...
539+
- name: v1
540+
served: true
541+
# 新提供的版本应该设置为存储版本。
542+
storage: true
543+
schema: ...
544+
```
512545

513546
<!--
514547
## Webhook conversion

0 commit comments

Comments
 (0)