From f819a5b297d19ba3127da674033eb5ca76800f59 Mon Sep 17 00:00:00 2001 From: Andrej Krejcir Date: Wed, 6 Dec 2023 14:26:29 +0100 Subject: [PATCH] fix: Import correct apiextensions version The previous imported version was incorrect. Signed-off-by: Andrej Krejcir --- internal/common/scheme.go | 9 ++++----- internal/crd-watch/crd-watch.go | 4 ++-- internal/crd-watch/crd-watch_test.go | 2 +- internal/operands/common-instancetypes/reconcile_test.go | 2 +- internal/operands/tekton-pipelines/reconcile_test.go | 2 +- internal/operands/tekton-tasks/reconcile_test.go | 2 +- 6 files changed, 10 insertions(+), 11 deletions(-) diff --git a/internal/common/scheme.go b/internal/common/scheme.go index e8f1bbcd5..2472681dc 100644 --- a/internal/common/scheme.go +++ b/internal/common/scheme.go @@ -2,7 +2,6 @@ package common import ( osconfv1 "github.com/openshift/api/config/v1" - "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions" extv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" internalmeta "k8s.io/apimachinery/pkg/apis/meta/internalversion" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -36,8 +35,8 @@ func init() { // This function is useful in operand unit tests only func AddConversionFunctions(s *runtime.Scheme) error { - err := s.AddConversionFunc((*apiextensions.CustomResourceDefinition)(nil), (*metav1.PartialObjectMetadata)(nil), func(a, b interface{}, scope conversion.Scope) error { - crd := a.(*apiextensions.CustomResourceDefinition) + err := s.AddConversionFunc((*extv1.CustomResourceDefinition)(nil), (*metav1.PartialObjectMetadata)(nil), func(a, b interface{}, scope conversion.Scope) error { + crd := a.(*extv1.CustomResourceDefinition) partialMeta := b.(*metav1.PartialObjectMetadata) partialMeta.TypeMeta = crd.TypeMeta @@ -48,8 +47,8 @@ func AddConversionFunctions(s *runtime.Scheme) error { return err } - return s.AddConversionFunc((*apiextensions.CustomResourceDefinitionList)(nil), (*metav1.PartialObjectMetadataList)(nil), func(a, b interface{}, scope conversion.Scope) error { - crdList := a.(*apiextensions.CustomResourceDefinitionList) + return s.AddConversionFunc((*extv1.CustomResourceDefinitionList)(nil), (*metav1.PartialObjectMetadataList)(nil), func(a, b interface{}, scope conversion.Scope) error { + crdList := a.(*extv1.CustomResourceDefinitionList) partialMetaList := b.(*metav1.PartialObjectMetadataList) partialMetaList.TypeMeta = crdList.TypeMeta diff --git a/internal/crd-watch/crd-watch.go b/internal/crd-watch/crd-watch.go index 3fc88ab82..e29227a9a 100644 --- a/internal/crd-watch/crd-watch.go +++ b/internal/crd-watch/crd-watch.go @@ -5,7 +5,7 @@ import ( "fmt" "sync" - "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions" + apiextensions "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/tools/cache" ctrlcache "sigs.k8s.io/controller-runtime/pkg/cache" @@ -95,7 +95,7 @@ func (c *CrdWatch) Start(ctx context.Context) error { informer, err := c.cache.GetInformer(ctx, &metav1.PartialObjectMetadata{ TypeMeta: metav1.TypeMeta{ - APIVersion: apiextensions.GroupName + "/v1", + APIVersion: apiextensions.SchemeGroupVersion.String(), Kind: "CustomResourceDefinition", }, }) diff --git a/internal/crd-watch/crd-watch_test.go b/internal/crd-watch/crd-watch_test.go index 1e1b2d91d..69146924f 100644 --- a/internal/crd-watch/crd-watch_test.go +++ b/internal/crd-watch/crd-watch_test.go @@ -9,7 +9,7 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions" + apiextensions "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" internalmeta "k8s.io/apimachinery/pkg/apis/meta/internalversion" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/conversion" diff --git a/internal/operands/common-instancetypes/reconcile_test.go b/internal/operands/common-instancetypes/reconcile_test.go index ea0ff302a..b32b987a5 100644 --- a/internal/operands/common-instancetypes/reconcile_test.go +++ b/internal/operands/common-instancetypes/reconcile_test.go @@ -9,7 +9,7 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions" + apiextensions "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" internalmeta "k8s.io/apimachinery/pkg/apis/meta/internalversion" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/conversion" diff --git a/internal/operands/tekton-pipelines/reconcile_test.go b/internal/operands/tekton-pipelines/reconcile_test.go index 79a1c9784..17560346b 100644 --- a/internal/operands/tekton-pipelines/reconcile_test.go +++ b/internal/operands/tekton-pipelines/reconcile_test.go @@ -9,7 +9,7 @@ import ( pipeline "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" v1 "k8s.io/api/core/v1" rbac "k8s.io/api/rbac/v1" - "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions" + apiextensions "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" internalmeta "k8s.io/apimachinery/pkg/apis/meta/internalversion" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" diff --git a/internal/operands/tekton-tasks/reconcile_test.go b/internal/operands/tekton-tasks/reconcile_test.go index 13e3a9b7c..8384cdbad 100644 --- a/internal/operands/tekton-tasks/reconcile_test.go +++ b/internal/operands/tekton-tasks/reconcile_test.go @@ -9,7 +9,7 @@ import ( pipeline "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" v1 "k8s.io/api/core/v1" rbac "k8s.io/api/rbac/v1" - "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions" + apiextensions "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" internalmeta "k8s.io/apimachinery/pkg/apis/meta/internalversion" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types"