Kubernetes API removals on 1.25/1.26 might impact your Operator. How to deal with it? #1194
camilamacedo86
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
📢 Kubernetes API removals on 1.25/1.26 might impact your Operator
Some APIs versions are deprecated and will no longer be served on the Kubernetes version
1.25/1.26and consequently on vendors like Openshift4.12/4.13. For further information, check the guide.1.25+before upgrading their cluster from1.24to1.25. Otherwise, they might face workflow issues1.22to help you out. Resources using these APIs are not provided via the bundle manifests, so we cannot check them with SDK commands such asoperator-sdk bundle validate ./bundle --select-optional suite=operatorframework --optional-values=k8s-version=1.251.23+to check if your versions are or not using these APIs. In this case, you need to perform a full regression test and check the Kubernetes metrics and the Operator logs. (For further info and examples, check the section below:How can I find the usage of the deprecated APIs)NOTE: If you distributed solutions to work on Openshift, you might want to look at the topic, which has some specific guidance.
🙆 When the errors will appear
It will be unlikely to find problems by only installing the Operator bundle on the cluster. These APIs are commonly used at runtime (e.g. reconciliations made when the user creates CRs to provision the Operand).
Example:
An Operator reconciles a Kind/API to create a CronJob using
batch/v1beta1or raises an Event usingevents.k8s.io/v1beta1. Then, these operations will not work from Kubernetes1.25+. The API versions will not be found on the cluster, and you will probably check out errors in Operator logs (api not found).💁♀️ What does it mean for you?
You must ensure that you no longer use these API versions. Otherwise, any operation of your project which requires these versions will fail on Kubernetes versions
1.25/1.26+.You should also check if your Operator versions are using these APIs or not. Then, you can adequately inform its users.
Via the CSV, we can use the spec
minKubeVersionto define the minimal version and the annotationoperatorhub.io/ui-metadata-max-k8s-versionto define what are the max and min versions where our Operator can work successfully. This information will be provided to your users via the OperatorHub website.Examples
If your Operator version uses the
batch/v1beta1and the Kubernetes API for CRDsv1, you ought to use theminKubeVersionspec to define it as1.16( since the API v1 for CRDs was introduced in this version ). Therefore, you ought to use the annotationoperatorhub.io/ui-metadata-max-k8s-version: 1.24so that your users can be aware that this version will not work successfully on Kubernetes1.25:🙋 What are the APIs? How can I upgrade my Operator?
You can find all apis/versions removed on
1.25/1.26on the guide guide as the required steps to upgrade them. However, the following is a summary:APIs removed from k8s
1.25:v1instead ofv1beta1.v1has been available since k8s v1.21. No notable changesv1instead ofv1beta1.v1has been available since k8s v1.21. (See the guide to check the notable changes)v1instead ofv1beta1.v1has been available since k8s v1.19. (See the guide to check the notable changes)v2instead ofv2beta1.v2has been available since k8s v1.23. (No notable changes)v1instead ofv1beta1.v1has been available since k8s v1.21. (See the guide to check the notable changes.)v1instead ofv1beta1.v1has been available since k8s v1.20. (No notable changes)APIs removed from k8s
1.26:v2instead ofv2beta2.v2has been available since k8s v1.23(No notable changes)v1beta2instead ofv1beta1.v1beta2has been available since k8s v1.23(No notable changes)v1beta2instead ofv1beta1.v1beta2has been available since k8s v1.23(No notable changes)🙋♀️ How can I find the usage of the deprecated APIs:
1. Inspect your Operator source code. Look for manifests and imports using the removed versions, e.g.:
2. By running your Operator on the cluster, you can check that the Kubernetes API will also try to warn you when a workflow that uses these API versions is executed, e.g.:
0.12.0and k8s1.23+. Please, do the tests against Kubernetes API1.23+to ensure that the warnings will be fired.3. Use the metrics to see if your Operator workflows are calling these deprecated APIs (which will be removed)
You can use Kubernetes metrics to check if your Operator calls the deprecated APIs (More info).
💡 Note that it is not easy to identify if your Operator is doing the calls. Other components running on the cluster can also have called them. In this way, we recommend that you; initialise a new cluster for these tests. Then, before beginning to test your Operator verify the results so that you can compare the calls to these APIs before your Operator and workflows are executed with its result at the end.
Example
1.25:Then, we checked as a result:
{ "labels": { "code": "200", "component": "apiserver", "dry_run": "", "group": "policy", "resource": "podsecuritypolicies", "scope": "cluster", "subresource": "", "verb": "LIST", "version": "v1beta1" }, "value": "1" }{ "labels": { "code": "200", "component": "apiserver", "dry_run": "", "group": "batch", "resource": "cronjobs", "scope": "cluster", "subresource": "", "verb": "LIST", "version": "v1beta1" }, "value": "1" } { "labels": { "code": "200", "component": "apiserver", "dry_run": "", "group": "policy", "resource": "podsecuritypolicies", "scope": "cluster", "subresource": "", "verb": "LIST", "version": "v1beta1" }, "value": "1" } { "labels": { "code": "201", "component": "apiserver", "dry_run": "", "group": "batch", "resource": "cronjobs", "scope": "resource", "subresource": "", "verb": "POST", "version": "v1beta1" }, "value": "1" }Beta Was this translation helpful? Give feedback.
All reactions