Please Read: Operator projects using the removed APIs in k8s 1.22 requires changes

370 views
Skip to first unread message

Camila Macedo

unread,
Aug 31, 2021, 4:41:56 AM8/31/21
to Operator Framework

Dear Operator Authors,

 

Kubernetes has been deprecating API(s), which will be removed and are no longer available in 1.22[1]. Operators projects using these APIs versions[1] will not work on Kubernetes 1.22 or any cluster vendor using this Kubernetes version(1.22), such as OpenShift 4.9+. 

Following the APIs that are most likely your projects to be affected by ( More info[1] ):

 

Due to the number of options available to build Operators, it is hard to provide direct guidance on updating your operator to support Kubernetes 1.22. Recent versions of the OperatorSDK[2] greater than 1.0.0[4] and Kubebuilder[3] greater than 3.0.0[5] scaffold your project with the latest versions of these APIs (all that is generated by tools only). See the guides to upgrade your projects with OperatorSDK Golang[6], Ansible[7], Helm[8] or the Kubebuilder[9] one. For APIs other than the ones mentioned above, you will have to check your code for usage of removed API versions and upgrade to newer APIs. The details of this depend on your codebase but please join us on Slack and we can try to answer any questions you may have. You might find help from the community in (https://kubernetes.slack.com/ - channel: #kubebuilder) as well.


Alternatively, you can try to upgrade your manifests with controller-gen[10] (version >= v0.4.1[11]):

$ go get sigs.k8s.io/controller-tools/cmd/control...@v0.4.1
$ controller-gen --version
Version: v0.4.1
  • If your project does not use Webhooks:
$ controller-gen crd:trivialVersions=true,preserveUnknownFields=false rbac:roleName=manager-role  paths="./..."
  • If your project is using Webhooks: 

1) Add the markers sideEffects[12] and admissionReviewVersions[13] to your webhook (e.g. memcached-operator/api/v1alpha1/memcached_webhook.go[17]):


Example:

//+kubebuilder:webhook:path=/mutate-cache-example-com-v1alpha1-memcached,mutating=true,failurePolicy=fail,sideEffects=None,groups=cache.example.com,resources=memcacheds,verbs=create;update,versions=v1alpha1,name=mmemcached.kb.io,admissionReviewVersions={v1,v1beta1}


2) Run the command:

$ controller-gen crd:trivialVersions=true,preserveUnknownFields=false rbac:roleName=manager-role webhook paths="./..." 

 

Note: You can use the option output:crd:artifacts:config to define where the CRDs should be outputed. E.g. output:crd:artifacts:config=deploy/crd.


If you have been distributing your solutions via OLM[14] in the OpenShift catalog(s), see the discussion topic[15]for further info. In the comment[16], you might find some tips and examples.

Thank you for your attention and time.
We hope that you find it helpful.

[1] - https://kubernetes.io/docs/reference/using-api/deprecation-guide/#v1-22
[2] - https://github.com/operator-framework/operator-sdk
[3] - https://github.com/kubernetes-sigs/kubebuilder
[4] - https://github.com/operator-framework/operator-sdk/releases
[5] - https://github.com/kubernetes-sigs/kubebuilder/releases
[6] - https://sdk.operatorframework.io/docs/building-operators/golang/migration/
[7] - https://sdk.operatorframework.io/docs/building-operators/ansible/migration/
[8] - https://sdk.operatorframework.io/docs/building-operators/helm/migration/
[9] - https://book.kubebuilder.io/migration/v2vsv3.html
[10] -https://book.kubebuilder.io/reference/controller-gen.html
[11] - https://github.com/kubernetes-sigs/controller-tools/releases/tag/v0.4.1
[12] - https://github.com/kubernetes-sigs/controller-tools/blob/master/pkg/webhook/parser.go#L81
[13] - https://github.com/kubernetes-sigs/controller-tools/blob/master/pkg/webhook/parser.go#L114
[14]  - https://github.com/operator-framework/operator-lifecycle-manager
[15] - https://github.com/redhat-openshift-ecosystem/community-operators-prod/discussions/138
[16] - https://github.com/redhat-openshift-ecosystem/community-operators-prod/discussions/138#discussioncomment-1245759

CAMILA MACEDO

SR. SOFTWARE ENGINEER 

RED HAT Operator framework

Red Hat UK

She / Her / Hers

IM: cmacedo



Reply all
Reply to author
Forward
0 new messages