From 9ce31d0bf8f21cdfcdaf552fce2897ba5b3891ff Mon Sep 17 00:00:00 2001 From: Raunak Pradip Shah Date: Wed, 1 Mar 2023 11:20:20 +0530 Subject: [PATCH] Change groupName to groupsnapshot.storage.k8s.io --- .../apis/volumegroupsnapshot/v1alpha1/doc.go | 2 +- .../volumegroupsnapshot/v1alpha1/register.go | 2 +- client/clientset/versioned/clientset.go | 18 +++++----- .../versioned/fake/clientset_generated.go | 10 +++--- client/clientset/versioned/fake/register.go | 4 +-- client/clientset/versioned/scheme/register.go | 4 +-- .../v1alpha1/fake/fake_volumegroupsnapshot.go | 6 ++-- .../fake/fake_volumegroupsnapshot_client.go | 10 +++--- .../fake/fake_volumegroupsnapshotclass.go | 6 ++-- .../fake/fake_volumegroupsnapshotcontent.go | 6 ++-- .../v1alpha1/volumegroupsnapshot.go | 2 +- .../v1alpha1/volumegroupsnapshot_client.go | 34 +++++++++--------- .../v1alpha1/volumegroupsnapshotclass.go | 2 +- .../v1alpha1/volumegroupsnapshotcontent.go | 2 +- ...ge.k8s.io_volumegroupsnapshotclasses.yaml} | 5 ++- ...e.k8s.io_volumegroupsnapshotcontents.yaml} | 5 ++- ....storage.k8s.io_volumegroupsnapshots.yaml} | 5 ++- client/hack/README.md | 36 +------------------ client/informers/externalversions/factory.go | 4 +-- client/informers/externalversions/generic.go | 18 +++++----- .../v1alpha1/volumegroupsnapshot.go | 4 +-- .../v1alpha1/volumegroupsnapshotclass.go | 4 +-- .../v1alpha1/volumegroupsnapshotcontent.go | 4 +-- 23 files changed, 78 insertions(+), 115 deletions(-) rename client/config/crd/{snapshot.storage.k8s.io_volumegroupsnapshotclasses.yaml => groupsnapshot.storage.k8s.io_volumegroupsnapshotclasses.yaml} (92%) rename client/config/crd/{snapshot.storage.k8s.io_volumegroupsnapshotcontents.yaml => groupsnapshot.storage.k8s.io_volumegroupsnapshotcontents.yaml} (98%) rename client/config/crd/{snapshot.storage.k8s.io_volumegroupsnapshots.yaml => groupsnapshot.storage.k8s.io_volumegroupsnapshots.yaml} (98%) diff --git a/client/apis/volumegroupsnapshot/v1alpha1/doc.go b/client/apis/volumegroupsnapshot/v1alpha1/doc.go index 39e998c9..f3b8d19e 100644 --- a/client/apis/volumegroupsnapshot/v1alpha1/doc.go +++ b/client/apis/volumegroupsnapshot/v1alpha1/doc.go @@ -15,6 +15,6 @@ limitations under the License. */ // +k8s:deepcopy-gen=package -// +groupName=snapshot.storage.k8s.io +// +groupName=groupsnapshot.storage.k8s.io package v1alpha1 diff --git a/client/apis/volumegroupsnapshot/v1alpha1/register.go b/client/apis/volumegroupsnapshot/v1alpha1/register.go index 814e9c93..42b82aae 100644 --- a/client/apis/volumegroupsnapshot/v1alpha1/register.go +++ b/client/apis/volumegroupsnapshot/v1alpha1/register.go @@ -20,7 +20,7 @@ import ( ) // GroupName is the group name use in this package. -const GroupName = "snapshot.storage.k8s.io" +const GroupName = "groupsnapshot.storage.k8s.io" var ( // SchemeBuilder is the new scheme builder diff --git a/client/clientset/versioned/clientset.go b/client/clientset/versioned/clientset.go index bc6ea8dd..03ca1e0c 100644 --- a/client/clientset/versioned/clientset.go +++ b/client/clientset/versioned/clientset.go @@ -22,7 +22,7 @@ import ( "fmt" "net/http" - snapshotv1alpha1 "github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumegroupsnapshot/v1alpha1" + groupsnapshotv1alpha1 "github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumegroupsnapshot/v1alpha1" snapshotv1 "github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1" discovery "k8s.io/client-go/discovery" rest "k8s.io/client-go/rest" @@ -31,20 +31,20 @@ import ( type Interface interface { Discovery() discovery.DiscoveryInterface - SnapshotV1alpha1() snapshotv1alpha1.SnapshotV1alpha1Interface + GroupsnapshotV1alpha1() groupsnapshotv1alpha1.GroupsnapshotV1alpha1Interface SnapshotV1() snapshotv1.SnapshotV1Interface } // Clientset contains the clients for groups. type Clientset struct { *discovery.DiscoveryClient - snapshotV1alpha1 *snapshotv1alpha1.SnapshotV1alpha1Client - snapshotV1 *snapshotv1.SnapshotV1Client + groupsnapshotV1alpha1 *groupsnapshotv1alpha1.GroupsnapshotV1alpha1Client + snapshotV1 *snapshotv1.SnapshotV1Client } -// SnapshotV1alpha1 retrieves the SnapshotV1alpha1Client -func (c *Clientset) SnapshotV1alpha1() snapshotv1alpha1.SnapshotV1alpha1Interface { - return c.snapshotV1alpha1 +// GroupsnapshotV1alpha1 retrieves the GroupsnapshotV1alpha1Client +func (c *Clientset) GroupsnapshotV1alpha1() groupsnapshotv1alpha1.GroupsnapshotV1alpha1Interface { + return c.groupsnapshotV1alpha1 } // SnapshotV1 retrieves the SnapshotV1Client @@ -96,7 +96,7 @@ func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, var cs Clientset var err error - cs.snapshotV1alpha1, err = snapshotv1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient) + cs.groupsnapshotV1alpha1, err = groupsnapshotv1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } @@ -125,7 +125,7 @@ func NewForConfigOrDie(c *rest.Config) *Clientset { // New creates a new Clientset for the given RESTClient. func New(c rest.Interface) *Clientset { var cs Clientset - cs.snapshotV1alpha1 = snapshotv1alpha1.New(c) + cs.groupsnapshotV1alpha1 = groupsnapshotv1alpha1.New(c) cs.snapshotV1 = snapshotv1.New(c) cs.DiscoveryClient = discovery.NewDiscoveryClient(c) diff --git a/client/clientset/versioned/fake/clientset_generated.go b/client/clientset/versioned/fake/clientset_generated.go index a819ba9c..2f3ed833 100644 --- a/client/clientset/versioned/fake/clientset_generated.go +++ b/client/clientset/versioned/fake/clientset_generated.go @@ -20,8 +20,8 @@ package fake import ( clientset "github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned" - snapshotv1alpha1 "github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumegroupsnapshot/v1alpha1" - fakesnapshotv1alpha1 "github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumegroupsnapshot/v1alpha1/fake" + groupsnapshotv1alpha1 "github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumegroupsnapshot/v1alpha1" + fakegroupsnapshotv1alpha1 "github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumegroupsnapshot/v1alpha1/fake" snapshotv1 "github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1" fakesnapshotv1 "github.com/kubernetes-csi/external-snapshotter/client/v6/clientset/versioned/typed/volumesnapshot/v1/fake" "k8s.io/apimachinery/pkg/runtime" @@ -81,9 +81,9 @@ var ( _ testing.FakeClient = &Clientset{} ) -// SnapshotV1alpha1 retrieves the SnapshotV1alpha1Client -func (c *Clientset) SnapshotV1alpha1() snapshotv1alpha1.SnapshotV1alpha1Interface { - return &fakesnapshotv1alpha1.FakeSnapshotV1alpha1{Fake: &c.Fake} +// GroupsnapshotV1alpha1 retrieves the GroupsnapshotV1alpha1Client +func (c *Clientset) GroupsnapshotV1alpha1() groupsnapshotv1alpha1.GroupsnapshotV1alpha1Interface { + return &fakegroupsnapshotv1alpha1.FakeGroupsnapshotV1alpha1{Fake: &c.Fake} } // SnapshotV1 retrieves the SnapshotV1Client diff --git a/client/clientset/versioned/fake/register.go b/client/clientset/versioned/fake/register.go index 4edfda99..93b1599c 100644 --- a/client/clientset/versioned/fake/register.go +++ b/client/clientset/versioned/fake/register.go @@ -19,7 +19,7 @@ limitations under the License. package fake import ( - snapshotv1alpha1 "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumegroupsnapshot/v1alpha1" + groupsnapshotv1alpha1 "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumegroupsnapshot/v1alpha1" snapshotv1 "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" @@ -32,7 +32,7 @@ var scheme = runtime.NewScheme() var codecs = serializer.NewCodecFactory(scheme) var localSchemeBuilder = runtime.SchemeBuilder{ - snapshotv1alpha1.AddToScheme, + groupsnapshotv1alpha1.AddToScheme, snapshotv1.AddToScheme, } diff --git a/client/clientset/versioned/scheme/register.go b/client/clientset/versioned/scheme/register.go index cb7c3bae..d30e61fb 100644 --- a/client/clientset/versioned/scheme/register.go +++ b/client/clientset/versioned/scheme/register.go @@ -19,7 +19,7 @@ limitations under the License. package scheme import ( - snapshotv1alpha1 "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumegroupsnapshot/v1alpha1" + groupsnapshotv1alpha1 "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumegroupsnapshot/v1alpha1" snapshotv1 "github.com/kubernetes-csi/external-snapshotter/client/v6/apis/volumesnapshot/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" @@ -32,7 +32,7 @@ var Scheme = runtime.NewScheme() var Codecs = serializer.NewCodecFactory(Scheme) var ParameterCodec = runtime.NewParameterCodec(Scheme) var localSchemeBuilder = runtime.SchemeBuilder{ - snapshotv1alpha1.AddToScheme, + groupsnapshotv1alpha1.AddToScheme, snapshotv1.AddToScheme, } diff --git a/client/clientset/versioned/typed/volumegroupsnapshot/v1alpha1/fake/fake_volumegroupsnapshot.go b/client/clientset/versioned/typed/volumegroupsnapshot/v1alpha1/fake/fake_volumegroupsnapshot.go index bdbfb8d5..715eceb7 100644 --- a/client/clientset/versioned/typed/volumegroupsnapshot/v1alpha1/fake/fake_volumegroupsnapshot.go +++ b/client/clientset/versioned/typed/volumegroupsnapshot/v1alpha1/fake/fake_volumegroupsnapshot.go @@ -32,13 +32,13 @@ import ( // FakeVolumeGroupSnapshots implements VolumeGroupSnapshotInterface type FakeVolumeGroupSnapshots struct { - Fake *FakeSnapshotV1alpha1 + Fake *FakeGroupsnapshotV1alpha1 ns string } -var volumegroupsnapshotsResource = schema.GroupVersionResource{Group: "snapshot.storage.k8s.io", Version: "v1alpha1", Resource: "volumegroupsnapshots"} +var volumegroupsnapshotsResource = schema.GroupVersionResource{Group: "groupsnapshot.storage.k8s.io", Version: "v1alpha1", Resource: "volumegroupsnapshots"} -var volumegroupsnapshotsKind = schema.GroupVersionKind{Group: "snapshot.storage.k8s.io", Version: "v1alpha1", Kind: "VolumeGroupSnapshot"} +var volumegroupsnapshotsKind = schema.GroupVersionKind{Group: "groupsnapshot.storage.k8s.io", Version: "v1alpha1", Kind: "VolumeGroupSnapshot"} // Get takes name of the volumeGroupSnapshot, and returns the corresponding volumeGroupSnapshot object, and an error if there is any. func (c *FakeVolumeGroupSnapshots) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.VolumeGroupSnapshot, err error) { diff --git a/client/clientset/versioned/typed/volumegroupsnapshot/v1alpha1/fake/fake_volumegroupsnapshot_client.go b/client/clientset/versioned/typed/volumegroupsnapshot/v1alpha1/fake/fake_volumegroupsnapshot_client.go index 33198d94..97823a37 100644 --- a/client/clientset/versioned/typed/volumegroupsnapshot/v1alpha1/fake/fake_volumegroupsnapshot_client.go +++ b/client/clientset/versioned/typed/volumegroupsnapshot/v1alpha1/fake/fake_volumegroupsnapshot_client.go @@ -24,25 +24,25 @@ import ( testing "k8s.io/client-go/testing" ) -type FakeSnapshotV1alpha1 struct { +type FakeGroupsnapshotV1alpha1 struct { *testing.Fake } -func (c *FakeSnapshotV1alpha1) VolumeGroupSnapshots(namespace string) v1alpha1.VolumeGroupSnapshotInterface { +func (c *FakeGroupsnapshotV1alpha1) VolumeGroupSnapshots(namespace string) v1alpha1.VolumeGroupSnapshotInterface { return &FakeVolumeGroupSnapshots{c, namespace} } -func (c *FakeSnapshotV1alpha1) VolumeGroupSnapshotClasses() v1alpha1.VolumeGroupSnapshotClassInterface { +func (c *FakeGroupsnapshotV1alpha1) VolumeGroupSnapshotClasses() v1alpha1.VolumeGroupSnapshotClassInterface { return &FakeVolumeGroupSnapshotClasses{c} } -func (c *FakeSnapshotV1alpha1) VolumeGroupSnapshotContents() v1alpha1.VolumeGroupSnapshotContentInterface { +func (c *FakeGroupsnapshotV1alpha1) VolumeGroupSnapshotContents() v1alpha1.VolumeGroupSnapshotContentInterface { return &FakeVolumeGroupSnapshotContents{c} } // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. -func (c *FakeSnapshotV1alpha1) RESTClient() rest.Interface { +func (c *FakeGroupsnapshotV1alpha1) RESTClient() rest.Interface { var ret *rest.RESTClient return ret } diff --git a/client/clientset/versioned/typed/volumegroupsnapshot/v1alpha1/fake/fake_volumegroupsnapshotclass.go b/client/clientset/versioned/typed/volumegroupsnapshot/v1alpha1/fake/fake_volumegroupsnapshotclass.go index a2b515ee..50be1cbb 100644 --- a/client/clientset/versioned/typed/volumegroupsnapshot/v1alpha1/fake/fake_volumegroupsnapshotclass.go +++ b/client/clientset/versioned/typed/volumegroupsnapshot/v1alpha1/fake/fake_volumegroupsnapshotclass.go @@ -32,12 +32,12 @@ import ( // FakeVolumeGroupSnapshotClasses implements VolumeGroupSnapshotClassInterface type FakeVolumeGroupSnapshotClasses struct { - Fake *FakeSnapshotV1alpha1 + Fake *FakeGroupsnapshotV1alpha1 } -var volumegroupsnapshotclassesResource = schema.GroupVersionResource{Group: "snapshot.storage.k8s.io", Version: "v1alpha1", Resource: "volumegroupsnapshotclasses"} +var volumegroupsnapshotclassesResource = schema.GroupVersionResource{Group: "groupsnapshot.storage.k8s.io", Version: "v1alpha1", Resource: "volumegroupsnapshotclasses"} -var volumegroupsnapshotclassesKind = schema.GroupVersionKind{Group: "snapshot.storage.k8s.io", Version: "v1alpha1", Kind: "VolumeGroupSnapshotClass"} +var volumegroupsnapshotclassesKind = schema.GroupVersionKind{Group: "groupsnapshot.storage.k8s.io", Version: "v1alpha1", Kind: "VolumeGroupSnapshotClass"} // Get takes name of the volumeGroupSnapshotClass, and returns the corresponding volumeGroupSnapshotClass object, and an error if there is any. func (c *FakeVolumeGroupSnapshotClasses) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.VolumeGroupSnapshotClass, err error) { diff --git a/client/clientset/versioned/typed/volumegroupsnapshot/v1alpha1/fake/fake_volumegroupsnapshotcontent.go b/client/clientset/versioned/typed/volumegroupsnapshot/v1alpha1/fake/fake_volumegroupsnapshotcontent.go index a177d083..b007122a 100644 --- a/client/clientset/versioned/typed/volumegroupsnapshot/v1alpha1/fake/fake_volumegroupsnapshotcontent.go +++ b/client/clientset/versioned/typed/volumegroupsnapshot/v1alpha1/fake/fake_volumegroupsnapshotcontent.go @@ -32,12 +32,12 @@ import ( // FakeVolumeGroupSnapshotContents implements VolumeGroupSnapshotContentInterface type FakeVolumeGroupSnapshotContents struct { - Fake *FakeSnapshotV1alpha1 + Fake *FakeGroupsnapshotV1alpha1 } -var volumegroupsnapshotcontentsResource = schema.GroupVersionResource{Group: "snapshot.storage.k8s.io", Version: "v1alpha1", Resource: "volumegroupsnapshotcontents"} +var volumegroupsnapshotcontentsResource = schema.GroupVersionResource{Group: "groupsnapshot.storage.k8s.io", Version: "v1alpha1", Resource: "volumegroupsnapshotcontents"} -var volumegroupsnapshotcontentsKind = schema.GroupVersionKind{Group: "snapshot.storage.k8s.io", Version: "v1alpha1", Kind: "VolumeGroupSnapshotContent"} +var volumegroupsnapshotcontentsKind = schema.GroupVersionKind{Group: "groupsnapshot.storage.k8s.io", Version: "v1alpha1", Kind: "VolumeGroupSnapshotContent"} // Get takes name of the volumeGroupSnapshotContent, and returns the corresponding volumeGroupSnapshotContent object, and an error if there is any. func (c *FakeVolumeGroupSnapshotContents) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.VolumeGroupSnapshotContent, err error) { diff --git a/client/clientset/versioned/typed/volumegroupsnapshot/v1alpha1/volumegroupsnapshot.go b/client/clientset/versioned/typed/volumegroupsnapshot/v1alpha1/volumegroupsnapshot.go index c3329018..c9428f01 100644 --- a/client/clientset/versioned/typed/volumegroupsnapshot/v1alpha1/volumegroupsnapshot.go +++ b/client/clientset/versioned/typed/volumegroupsnapshot/v1alpha1/volumegroupsnapshot.go @@ -57,7 +57,7 @@ type volumeGroupSnapshots struct { } // newVolumeGroupSnapshots returns a VolumeGroupSnapshots -func newVolumeGroupSnapshots(c *SnapshotV1alpha1Client, namespace string) *volumeGroupSnapshots { +func newVolumeGroupSnapshots(c *GroupsnapshotV1alpha1Client, namespace string) *volumeGroupSnapshots { return &volumeGroupSnapshots{ client: c.RESTClient(), ns: namespace, diff --git a/client/clientset/versioned/typed/volumegroupsnapshot/v1alpha1/volumegroupsnapshot_client.go b/client/clientset/versioned/typed/volumegroupsnapshot/v1alpha1/volumegroupsnapshot_client.go index 6292d3e6..310b0272 100644 --- a/client/clientset/versioned/typed/volumegroupsnapshot/v1alpha1/volumegroupsnapshot_client.go +++ b/client/clientset/versioned/typed/volumegroupsnapshot/v1alpha1/volumegroupsnapshot_client.go @@ -26,34 +26,34 @@ import ( rest "k8s.io/client-go/rest" ) -type SnapshotV1alpha1Interface interface { +type GroupsnapshotV1alpha1Interface interface { RESTClient() rest.Interface VolumeGroupSnapshotsGetter VolumeGroupSnapshotClassesGetter VolumeGroupSnapshotContentsGetter } -// SnapshotV1alpha1Client is used to interact with features provided by the snapshot.storage.k8s.io group. -type SnapshotV1alpha1Client struct { +// GroupsnapshotV1alpha1Client is used to interact with features provided by the groupsnapshot.storage.k8s.io group. +type GroupsnapshotV1alpha1Client struct { restClient rest.Interface } -func (c *SnapshotV1alpha1Client) VolumeGroupSnapshots(namespace string) VolumeGroupSnapshotInterface { +func (c *GroupsnapshotV1alpha1Client) VolumeGroupSnapshots(namespace string) VolumeGroupSnapshotInterface { return newVolumeGroupSnapshots(c, namespace) } -func (c *SnapshotV1alpha1Client) VolumeGroupSnapshotClasses() VolumeGroupSnapshotClassInterface { +func (c *GroupsnapshotV1alpha1Client) VolumeGroupSnapshotClasses() VolumeGroupSnapshotClassInterface { return newVolumeGroupSnapshotClasses(c) } -func (c *SnapshotV1alpha1Client) VolumeGroupSnapshotContents() VolumeGroupSnapshotContentInterface { +func (c *GroupsnapshotV1alpha1Client) VolumeGroupSnapshotContents() VolumeGroupSnapshotContentInterface { return newVolumeGroupSnapshotContents(c) } -// NewForConfig creates a new SnapshotV1alpha1Client for the given config. +// NewForConfig creates a new GroupsnapshotV1alpha1Client for the given config. // NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), // where httpClient was generated with rest.HTTPClientFor(c). -func NewForConfig(c *rest.Config) (*SnapshotV1alpha1Client, error) { +func NewForConfig(c *rest.Config) (*GroupsnapshotV1alpha1Client, error) { config := *c if err := setConfigDefaults(&config); err != nil { return nil, err @@ -65,9 +65,9 @@ func NewForConfig(c *rest.Config) (*SnapshotV1alpha1Client, error) { return NewForConfigAndClient(&config, httpClient) } -// NewForConfigAndClient creates a new SnapshotV1alpha1Client for the given config and http client. +// NewForConfigAndClient creates a new GroupsnapshotV1alpha1Client for the given config and http client. // Note the http client provided takes precedence over the configured transport values. -func NewForConfigAndClient(c *rest.Config, h *http.Client) (*SnapshotV1alpha1Client, error) { +func NewForConfigAndClient(c *rest.Config, h *http.Client) (*GroupsnapshotV1alpha1Client, error) { config := *c if err := setConfigDefaults(&config); err != nil { return nil, err @@ -76,12 +76,12 @@ func NewForConfigAndClient(c *rest.Config, h *http.Client) (*SnapshotV1alpha1Cli if err != nil { return nil, err } - return &SnapshotV1alpha1Client{client}, nil + return &GroupsnapshotV1alpha1Client{client}, nil } -// NewForConfigOrDie creates a new SnapshotV1alpha1Client for the given config and +// NewForConfigOrDie creates a new GroupsnapshotV1alpha1Client for the given config and // panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *SnapshotV1alpha1Client { +func NewForConfigOrDie(c *rest.Config) *GroupsnapshotV1alpha1Client { client, err := NewForConfig(c) if err != nil { panic(err) @@ -89,9 +89,9 @@ func NewForConfigOrDie(c *rest.Config) *SnapshotV1alpha1Client { return client } -// New creates a new SnapshotV1alpha1Client for the given RESTClient. -func New(c rest.Interface) *SnapshotV1alpha1Client { - return &SnapshotV1alpha1Client{c} +// New creates a new GroupsnapshotV1alpha1Client for the given RESTClient. +func New(c rest.Interface) *GroupsnapshotV1alpha1Client { + return &GroupsnapshotV1alpha1Client{c} } func setConfigDefaults(config *rest.Config) error { @@ -109,7 +109,7 @@ func setConfigDefaults(config *rest.Config) error { // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. -func (c *SnapshotV1alpha1Client) RESTClient() rest.Interface { +func (c *GroupsnapshotV1alpha1Client) RESTClient() rest.Interface { if c == nil { return nil } diff --git a/client/clientset/versioned/typed/volumegroupsnapshot/v1alpha1/volumegroupsnapshotclass.go b/client/clientset/versioned/typed/volumegroupsnapshot/v1alpha1/volumegroupsnapshotclass.go index 067358f1..d71be8cc 100644 --- a/client/clientset/versioned/typed/volumegroupsnapshot/v1alpha1/volumegroupsnapshotclass.go +++ b/client/clientset/versioned/typed/volumegroupsnapshot/v1alpha1/volumegroupsnapshotclass.go @@ -55,7 +55,7 @@ type volumeGroupSnapshotClasses struct { } // newVolumeGroupSnapshotClasses returns a VolumeGroupSnapshotClasses -func newVolumeGroupSnapshotClasses(c *SnapshotV1alpha1Client) *volumeGroupSnapshotClasses { +func newVolumeGroupSnapshotClasses(c *GroupsnapshotV1alpha1Client) *volumeGroupSnapshotClasses { return &volumeGroupSnapshotClasses{ client: c.RESTClient(), } diff --git a/client/clientset/versioned/typed/volumegroupsnapshot/v1alpha1/volumegroupsnapshotcontent.go b/client/clientset/versioned/typed/volumegroupsnapshot/v1alpha1/volumegroupsnapshotcontent.go index f584441a..b2c20254 100644 --- a/client/clientset/versioned/typed/volumegroupsnapshot/v1alpha1/volumegroupsnapshotcontent.go +++ b/client/clientset/versioned/typed/volumegroupsnapshot/v1alpha1/volumegroupsnapshotcontent.go @@ -56,7 +56,7 @@ type volumeGroupSnapshotContents struct { } // newVolumeGroupSnapshotContents returns a VolumeGroupSnapshotContents -func newVolumeGroupSnapshotContents(c *SnapshotV1alpha1Client) *volumeGroupSnapshotContents { +func newVolumeGroupSnapshotContents(c *GroupsnapshotV1alpha1Client) *volumeGroupSnapshotContents { return &volumeGroupSnapshotContents{ client: c.RESTClient(), } diff --git a/client/config/crd/snapshot.storage.k8s.io_volumegroupsnapshotclasses.yaml b/client/config/crd/groupsnapshot.storage.k8s.io_volumegroupsnapshotclasses.yaml similarity index 92% rename from client/config/crd/snapshot.storage.k8s.io_volumegroupsnapshotclasses.yaml rename to client/config/crd/groupsnapshot.storage.k8s.io_volumegroupsnapshotclasses.yaml index 8d647bfd..0df250d7 100644 --- a/client/config/crd/snapshot.storage.k8s.io_volumegroupsnapshotclasses.yaml +++ b/client/config/crd/groupsnapshot.storage.k8s.io_volumegroupsnapshotclasses.yaml @@ -4,11 +4,10 @@ kind: CustomResourceDefinition metadata: annotations: controller-gen.kubebuilder.io/version: v0.11.3 - api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/814" creationTimestamp: null - name: volumegroupsnapshotclasses.snapshot.storage.k8s.io + name: volumegroupsnapshotclasses.groupsnapshot.storage.k8s.io spec: - group: snapshot.storage.k8s.io + group: groupsnapshot.storage.k8s.io names: kind: VolumeGroupSnapshotClass listKind: VolumeGroupSnapshotClassList diff --git a/client/config/crd/snapshot.storage.k8s.io_volumegroupsnapshotcontents.yaml b/client/config/crd/groupsnapshot.storage.k8s.io_volumegroupsnapshotcontents.yaml similarity index 98% rename from client/config/crd/snapshot.storage.k8s.io_volumegroupsnapshotcontents.yaml rename to client/config/crd/groupsnapshot.storage.k8s.io_volumegroupsnapshotcontents.yaml index 1771a5a9..9ccf4931 100644 --- a/client/config/crd/snapshot.storage.k8s.io_volumegroupsnapshotcontents.yaml +++ b/client/config/crd/groupsnapshot.storage.k8s.io_volumegroupsnapshotcontents.yaml @@ -4,11 +4,10 @@ kind: CustomResourceDefinition metadata: annotations: controller-gen.kubebuilder.io/version: v0.11.3 - api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/814" creationTimestamp: null - name: volumegroupsnapshotcontents.snapshot.storage.k8s.io + name: volumegroupsnapshotcontents.groupsnapshot.storage.k8s.io spec: - group: snapshot.storage.k8s.io + group: groupsnapshot.storage.k8s.io names: kind: VolumeGroupSnapshotContent listKind: VolumeGroupSnapshotContentList diff --git a/client/config/crd/snapshot.storage.k8s.io_volumegroupsnapshots.yaml b/client/config/crd/groupsnapshot.storage.k8s.io_volumegroupsnapshots.yaml similarity index 98% rename from client/config/crd/snapshot.storage.k8s.io_volumegroupsnapshots.yaml rename to client/config/crd/groupsnapshot.storage.k8s.io_volumegroupsnapshots.yaml index 543fd591..e749a66b 100644 --- a/client/config/crd/snapshot.storage.k8s.io_volumegroupsnapshots.yaml +++ b/client/config/crd/groupsnapshot.storage.k8s.io_volumegroupsnapshots.yaml @@ -4,11 +4,10 @@ kind: CustomResourceDefinition metadata: annotations: controller-gen.kubebuilder.io/version: v0.11.3 - api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/814" creationTimestamp: null - name: volumegroupsnapshots.snapshot.storage.k8s.io + name: volumegroupsnapshots.groupsnapshot.storage.k8s.io spec: - group: snapshot.storage.k8s.io + group: groupsnapshot.storage.k8s.io names: kind: VolumeGroupSnapshot listKind: VolumeGroupSnapshotList diff --git a/client/hack/README.md b/client/hack/README.md index d46773c6..5b4ea41a 100644 --- a/client/hack/README.md +++ b/client/hack/README.md @@ -52,40 +52,6 @@ Once you run the script, you will get an output as follows: ``` -The following changes need to be made manually after running the above script: - -* The `SharedInformerFactory` interface in `./informers/factory.go` will have two functions named `Snapshot()`. Modify one to `GroupSnapshot()` and fix all references to that function in `informers/generic.go`. - -```bash - Snapshot() volumegroupsnapshot.Interface - Snapshot() volumesnapshot.Interface -} - -func (f *sharedInformerFactory) Snapshot() volumegroupsnapshot.Interface { - return volumegroupsnapshot.New(f, f.namespace, f.tweakListOptions) -} - -func (f *sharedInformerFactory) Snapshot() volumesnapshot.Interface { - return volumesnapshot.New(f, f.namespace, f.tweakListOptions) -} -``` - -will become - -```bash - GroupSnapshot() volumegroupsnapshot.Interface - Snapshot() volumesnapshot.Interface -} - -func (f *sharedInformerFactory) GroupSnapshot() volumegroupsnapshot.Interface { - return volumegroupsnapshot.New(f, f.namespace, f.tweakListOptions) -} - -func (f *sharedInformerFactory) Snapshot() volumesnapshot.Interface { - return volumesnapshot.New(f, f.namespace, f.tweakListOptions) -} -``` - ## update-crd.sh NOTE: We need to keep both v1beta1 and v1 snapshot APIs but set served and storage version of v1beta1 to false. Please copy back the v1beta1 manifest back to the files as this script will remove it. @@ -188,7 +154,7 @@ Update the restoreSize property to use type string only: * Add the VolumeSnapshot namespace to the `additionalPrinterColumns` section. Refer https://github.com/kubernetes-csi/external-snapshotter/pull/535 for more details. -* In `client/config/crd/snapshot.storage.k8s.io_volumegroupsnapshotcontents.yaml `, we need to add the `oneOf` constraint to make sure only one of `persistentVolumeNames` and `volumeGroupSnapshotHandle` is specified in the `source` field of the `spec` of `VolumeGroupSnapshotContent`. +* In `client/config/crd/groupsnapshot.storage.k8s.io_volumegroupsnapshotcontents.yaml `, we need to add the `oneOf` constraint to make sure only one of `persistentVolumeNames` and `volumeGroupSnapshotHandle` is specified in the `source` field of the `spec` of `VolumeGroupSnapshotContent`. ```bash source: diff --git a/client/informers/externalversions/factory.go b/client/informers/externalversions/factory.go index c88d0a9a..5dbf764d 100644 --- a/client/informers/externalversions/factory.go +++ b/client/informers/externalversions/factory.go @@ -244,11 +244,11 @@ type SharedInformerFactory interface { // client. InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer - GroupSnapshot() volumegroupsnapshot.Interface + Groupsnapshot() volumegroupsnapshot.Interface Snapshot() volumesnapshot.Interface } -func (f *sharedInformerFactory) GroupSnapshot() volumegroupsnapshot.Interface { +func (f *sharedInformerFactory) Groupsnapshot() volumegroupsnapshot.Interface { return volumegroupsnapshot.New(f, f.namespace, f.tweakListOptions) } diff --git a/client/informers/externalversions/generic.go b/client/informers/externalversions/generic.go index 2bc781ad..642f96c1 100644 --- a/client/informers/externalversions/generic.go +++ b/client/informers/externalversions/generic.go @@ -53,7 +53,15 @@ func (f *genericInformer) Lister() cache.GenericLister { // TODO extend this to unknown resources with a client pool func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { switch resource { - // Group=snapshot.storage.k8s.io, Version=v1 + // Group=groupsnapshot.storage.k8s.io, Version=v1alpha1 + case v1alpha1.SchemeGroupVersion.WithResource("volumegroupsnapshots"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Groupsnapshot().V1alpha1().VolumeGroupSnapshots().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("volumegroupsnapshotclasses"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Groupsnapshot().V1alpha1().VolumeGroupSnapshotClasses().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("volumegroupsnapshotcontents"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Groupsnapshot().V1alpha1().VolumeGroupSnapshotContents().Informer()}, nil + + // Group=snapshot.storage.k8s.io, Version=v1 case v1.SchemeGroupVersion.WithResource("volumesnapshots"): return &genericInformer{resource: resource.GroupResource(), informer: f.Snapshot().V1().VolumeSnapshots().Informer()}, nil case v1.SchemeGroupVersion.WithResource("volumesnapshotclasses"): @@ -61,14 +69,6 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource case v1.SchemeGroupVersion.WithResource("volumesnapshotcontents"): return &genericInformer{resource: resource.GroupResource(), informer: f.Snapshot().V1().VolumeSnapshotContents().Informer()}, nil - // Group=snapshot.storage.k8s.io, Version=v1alpha1 - case v1alpha1.SchemeGroupVersion.WithResource("volumegroupsnapshots"): - return &genericInformer{resource: resource.GroupResource(), informer: f.GroupSnapshot().V1alpha1().VolumeGroupSnapshots().Informer()}, nil - case v1alpha1.SchemeGroupVersion.WithResource("volumegroupsnapshotclasses"): - return &genericInformer{resource: resource.GroupResource(), informer: f.GroupSnapshot().V1alpha1().VolumeGroupSnapshotClasses().Informer()}, nil - case v1alpha1.SchemeGroupVersion.WithResource("volumegroupsnapshotcontents"): - return &genericInformer{resource: resource.GroupResource(), informer: f.GroupSnapshot().V1alpha1().VolumeGroupSnapshotContents().Informer()}, nil - } return nil, fmt.Errorf("no informer found for %v", resource) diff --git a/client/informers/externalversions/volumegroupsnapshot/v1alpha1/volumegroupsnapshot.go b/client/informers/externalversions/volumegroupsnapshot/v1alpha1/volumegroupsnapshot.go index f5a185d0..6f5eb5db 100644 --- a/client/informers/externalversions/volumegroupsnapshot/v1alpha1/volumegroupsnapshot.go +++ b/client/informers/externalversions/volumegroupsnapshot/v1alpha1/volumegroupsnapshot.go @@ -62,13 +62,13 @@ func NewFilteredVolumeGroupSnapshotInformer(client versioned.Interface, namespac if tweakListOptions != nil { tweakListOptions(&options) } - return client.SnapshotV1alpha1().VolumeGroupSnapshots(namespace).List(context.TODO(), options) + return client.GroupsnapshotV1alpha1().VolumeGroupSnapshots(namespace).List(context.TODO(), options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.SnapshotV1alpha1().VolumeGroupSnapshots(namespace).Watch(context.TODO(), options) + return client.GroupsnapshotV1alpha1().VolumeGroupSnapshots(namespace).Watch(context.TODO(), options) }, }, &volumegroupsnapshotv1alpha1.VolumeGroupSnapshot{}, diff --git a/client/informers/externalversions/volumegroupsnapshot/v1alpha1/volumegroupsnapshotclass.go b/client/informers/externalversions/volumegroupsnapshot/v1alpha1/volumegroupsnapshotclass.go index e82e0d63..c39b0b03 100644 --- a/client/informers/externalversions/volumegroupsnapshot/v1alpha1/volumegroupsnapshotclass.go +++ b/client/informers/externalversions/volumegroupsnapshot/v1alpha1/volumegroupsnapshotclass.go @@ -61,13 +61,13 @@ func NewFilteredVolumeGroupSnapshotClassInformer(client versioned.Interface, res if tweakListOptions != nil { tweakListOptions(&options) } - return client.SnapshotV1alpha1().VolumeGroupSnapshotClasses().List(context.TODO(), options) + return client.GroupsnapshotV1alpha1().VolumeGroupSnapshotClasses().List(context.TODO(), options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.SnapshotV1alpha1().VolumeGroupSnapshotClasses().Watch(context.TODO(), options) + return client.GroupsnapshotV1alpha1().VolumeGroupSnapshotClasses().Watch(context.TODO(), options) }, }, &volumegroupsnapshotv1alpha1.VolumeGroupSnapshotClass{}, diff --git a/client/informers/externalversions/volumegroupsnapshot/v1alpha1/volumegroupsnapshotcontent.go b/client/informers/externalversions/volumegroupsnapshot/v1alpha1/volumegroupsnapshotcontent.go index c8f9618f..00ce200a 100644 --- a/client/informers/externalversions/volumegroupsnapshot/v1alpha1/volumegroupsnapshotcontent.go +++ b/client/informers/externalversions/volumegroupsnapshot/v1alpha1/volumegroupsnapshotcontent.go @@ -61,13 +61,13 @@ func NewFilteredVolumeGroupSnapshotContentInformer(client versioned.Interface, r if tweakListOptions != nil { tweakListOptions(&options) } - return client.SnapshotV1alpha1().VolumeGroupSnapshotContents().List(context.TODO(), options) + return client.GroupsnapshotV1alpha1().VolumeGroupSnapshotContents().List(context.TODO(), options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.SnapshotV1alpha1().VolumeGroupSnapshotContents().Watch(context.TODO(), options) + return client.GroupsnapshotV1alpha1().VolumeGroupSnapshotContents().Watch(context.TODO(), options) }, }, &volumegroupsnapshotv1alpha1.VolumeGroupSnapshotContent{},