升级 CustomResourceDefinition 后升级 Controller

Upgrading Controller after upgrading a CustomResourceDefinition

对于 Kubernetes 1.22,CustomResourceDefinition apiextensions.k8s.io/v1beta1 的测试版 API 已被删除并替换为 apiextensions.k8s.io/v1。在更改 CRD 时,我开始意识到我的旧控制器(运算符模式,最初是为 v1alpha1 编写的)仍然尝试列出 apiextensions.k8s.io/v1alpha1,即使我已将 CRD 更改为 apiextensions.k8s.io/v1

我已阅读 并且它指出对于部署,我应该更改 API 版本,但我的情况是对此的扩展,因为我没有用于新 API.

我需要为新的 API 版本编写一个新的控制器吗?

Do I need to write a new controller for the new API version ?

不幸的是,看起来确实如此。如果您无法应用官方文档中 , because you are using a custom controller then you need to create your own new controller (if you cannot change API inside it) that will work with the supported API. Look at Custom controllers 页面中描述的内容。

I am not sure if the controller can manage the new API version. Even after changing the API version of the CRD to v1 from v1Alpha1, I get an error message stating that tha controller is trying to list CRD with API version v1alpha1.

看起来控制器有一些错误。 Referenceing the new API as written [in this documentation] should be no problem references the new API as written [in this documentation](看起来控制器写的不好。引用new API as written in this documentation应该没有问题。) :

The v1.22 release will stop serving the following deprecated API versions in favor of newer and more stable API versions:

  • Ingress in the extensions/v1beta1 API version will no longer be served
  • Migrate to use the networking.k8s.io/v1beta1 API version, available since v1.14. >Existing persisted data can be retrieved/updated via the new version.

Kubernetes 1.16 is due to be released in September 2019, so be sure to audit your configuration and integrations now!

  • Change YAML files to reference the newer APIs
  • Update custom integrations and controllers to call the newer APIs
  • Update third party tools (ingress controllers, continuous delivery systems) to call the newer APIs

另见 Kubernetes API and Feature Removals In 1.22: Here’s What You Need To Know