Skip to content
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.

Commit

Permalink
Update k8s.io/apiextensions to v1
Browse files Browse the repository at this point in the history
CRDs are GA in Kubernetes 1.16
  • Loading branch information
Mario Manno committed Feb 18, 2020
1 parent 5c0793a commit 1ef8457
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions pkg/crd/crd.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ import (
"reflect"
"time"

"code.cloudfoundry.org/quarks-utils/pkg/pointers"
"github.com/pkg/errors"
extv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1"
extv1client "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1beta1"

extv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
extv1client "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/util/wait"
)

// ApplyCRD creates or updates the CRD
func ApplyCRD(client extv1client.ApiextensionsV1beta1Interface, crdName, kind, plural string, shortNames []string, groupVersion schema.GroupVersion, validation *extv1.CustomResourceValidation) error {
func ApplyCRD(client extv1client.ApiextensionsV1Interface, crdName, kind, plural string, shortNames []string, groupVersion schema.GroupVersion, validation *extv1.CustomResourceValidation) error {
crd := &extv1.CustomResourceDefinition{
ObjectMeta: metav1.ObjectMeta{
Name: crdName,
Expand All @@ -27,13 +27,12 @@ func ApplyCRD(client extv1client.ApiextensionsV1beta1Interface, crdName, kind, p
Name: groupVersion.Version,
Served: true,
Storage: true,
Schema: validation,
Subresources: &extv1.CustomResourceSubresources{
Status: &extv1.CustomResourceSubresourceStatus{},
},
},
},
Validation: validation,
PreserveUnknownFields: pointers.Bool(false),
Subresources: &extv1.CustomResourceSubresources{
Status: &extv1.CustomResourceSubresourceStatus{},
},
Scope: extv1.NamespaceScoped,
Names: extv1.CustomResourceDefinitionNames{
Kind: kind,
Expand Down Expand Up @@ -67,7 +66,7 @@ func ApplyCRD(client extv1client.ApiextensionsV1beta1Interface, crdName, kind, p
}

// WaitForCRDReady blocks until the CRD is ready.
func WaitForCRDReady(client extv1client.ApiextensionsV1beta1Interface, crdName string) error {
func WaitForCRDReady(client extv1client.ApiextensionsV1Interface, crdName string) error {
err := wait.ExponentialBackoff(
wait.Backoff{
Duration: time.Second,
Expand Down

0 comments on commit 1ef8457

Please sign in to comment.