Skip to content

K8s 1.22 compatibility : v1beta1 CRD no longer understood #882

@fondemen

Description

@fondemen

Is this a BUG REPORT or FEATURE REQUEST?:
BUG REPORT

What happened:
After upgrading kubernetes from 1.21 to 1.22, storck fails starting with the following message:

time="2021-08-24T09:01:08Z" level=info msg="Creating default CSI SnapshotClasses"
time="2021-08-24T09:01:10Z" level=info msg="Starting stork version 2.6.4-945b41e2"
time="2021-08-24T09:01:10Z" level=info msg="Using driver linstor"
time="2021-08-24T09:01:10Z" level=error msg="failed to retrive applicationbackups crds: the server could not find the requested resource"
time="2021-08-24T09:01:10Z" level=error msg="failed to retrive applicationrestores crds: the server could not find the requested resource"
time="2021-08-24T09:01:10Z" level=error msg="failed to retrive applicationclones crds: the server could not find the requested resource"
I0824 09:01:10.927313 1 leaderelection.go:243] attempting to acquire leader lease linstor/linstor-stork...
I0824 09:01:10.931875 1 leaderelection.go:253] successfully acquired lease linstor/linstor-stork
[DEBUG] curl -X 'GET' -H 'Accept: application/json' 'http://linstor-controller:3370/v1/resource-definitions/pvc-ec2d4744-122b-4566-a721-1a8ca1211679'
time="2021-08-24T09:01:10Z" level=fatal msg="Error initializing rule: failed to create CRD due to: the server could not find the requested resource"

Looking at the code, I suspect this is because v1beta1 version of CRD is now removed, and code still uses it (

crd, err := client.ApiextensionsV1beta1().CustomResourceDefinitions().Get(context.TODO(), crdName, metav1.GetOptions{})
).

What you expected to happen:
Check K8s version before attempting to manipulate CRDs, or try using v1 only using v1beta1 client in case of failure so that stork can start...

How to reproduce it (as minimally and precisely as possible):
Try on a 1.22 K8s cluster

Anything else we need to know?:

Environment:

  • Kubernetes version (use kubectl version): 1.22.1
  • Cloud provider or hardware configuration: kubeadm (5 nodes, non-ha)
  • OS (e.g. from /etc/os-release): debian buster
  • Kernel (e.g. uname -a): 4.19.0-17-amd64
  • Install tools: apt
  • Others:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions