code-generator: refer to the API package for GV{R,K}

There should only be one source of truth for the API group's name and
version.

Signed-off-by: Steve Kuznetsov <skuznets@redhat.com>

Kubernetes-commit: e13198ec6f52c4a6405388e90053954dc7656a31
This commit is contained in:
Steve Kuznetsov 2022-11-06 07:05:42 -07:00 committed by Kubernetes Publisher
parent 720872638d
commit e293c67c9f

View File

@ -23,7 +23,6 @@ import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
@ -36,9 +35,9 @@ type FakeFoos struct {
ns string
}
var foosResource = schema.GroupVersionResource{Group: "samplecontroller.k8s.io", Version: "v1alpha1", Resource: "foos"}
var foosResource = v1alpha1.SchemeGroupVersion.WithResource("foos")
var foosKind = schema.GroupVersionKind{Group: "samplecontroller.k8s.io", Version: "v1alpha1", Kind: "Foo"}
var foosKind = v1alpha1.SchemeGroupVersion.WithKind("Foo")
// Get takes name of the foo, and returns the corresponding foo object, and an error if there is any.
func (c *FakeFoos) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Foo, err error) {