Skip to content

apiextensions.k8s.io/v1beta1 deprecation #12

@QlemWasTaken

Description

@QlemWasTaken

Hi,

I ran into an issues while trying to setup a macvlan through kubernetes API on Talos v.

I tried to setup NetworkAttachmentDefinition CRD with the example given at parapgraph 3.1.
This example use apiextensions.k8s.io/v1beta1 which seem to be depreceated.

Got the following error while applying the CustomResourceDefinition :

error: resource mapping not found for name: "network-attachment-definitions.k8s.cni.cncf.io" namespace: "" from "crd.yaml": no matches for kind "CustomResourceDefinition" in version "apiextensions.k8s.io/v1beta1"
ensure CRDs are installed first

Changing only the apiVersion to apiextensions.k8s.io/v1 got me other errors, probably due to changes in spec.version and spec.validation.

The CustomResourceDefinition "network-attachment-definitions.k8s.cni.cncf.io" is invalid:
* spec.validation.openAPIV3Schema.properties[spec].type: Required value: must not be empty for specified object fields
* spec.validation.openAPIV3Schema.type: Required value: must not be empty at the root

Throught trial and errors based on the following documents : ref1 , ref2 I got it working with the following definition :

apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: network-attachment-definitions.k8s.cni.cncf.io
spec:
  group: k8s.cni.cncf.io
  versions:
    - name: v1
      served: true
      storage: true
      schema:
        openAPIV3Schema:
          type: object
          properties:
            spec:
              type: object
              properties:
                config:
                  type: string
  scope: Namespaced
  names:
    plural: network-attachment-definitions
    singular: network-attachment-definition
    kind: NetworkAttachmentDefinition
    shortNames:
    - net-attach-def

I'm very much a beginner with kubernetes, while it seems to work, I'm not sure it's the right way to do it or if I missed something.

kubectl version :

Client Version: v1.32.2
Kustomize Version: v5.5.0
Server Version: v1.32.2

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