Skip to content

Commit

Permalink
fix: Import correct apiextensions version
Browse files Browse the repository at this point in the history
The previous imported version was incorrect.

Signed-off-by: Andrej Krejcir <[email protected]>
  • Loading branch information
akrejcir committed Dec 6, 2023
1 parent e194ae8 commit f819a5b
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 11 deletions.
9 changes: 4 additions & 5 deletions internal/common/scheme.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions internal/crd-watch/crd-watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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",
},
})
Expand Down
2 changes: 1 addition & 1 deletion internal/crd-watch/crd-watch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion internal/operands/common-instancetypes/reconcile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion internal/operands/tekton-pipelines/reconcile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion internal/operands/tekton-tasks/reconcile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit f819a5b

Please sign in to comment.