From 4b323e290a040aedd7f1ff025b5d0e06def00748 Mon Sep 17 00:00:00 2001 From: Pasquale Congiusti Date: Thu, 31 Aug 2023 12:48:24 +0200 Subject: [PATCH] chore(deps): codegen version align --- .../client/internalclientset/clientset.go | 3 +- .../duck/client/internalclientset/doc.go | 21 ----- .../typed/duck/v1beta2/fake/fake_kafka.go | 5 +- .../duck/v1beta2/fake/fake_kafkatopic.go | 5 +- cmd/util/doc-gen/main.go | 4 + go.mod | 2 +- go.sum | 4 +- .../camel/clientset/versioned/clientset.go | 3 +- pkg/client/camel/clientset/versioned/doc.go | 21 ----- .../typed/camel/v1/fake/fake_build.go | 71 ++++++++--------- .../typed/camel/v1/fake/fake_camelcatalog.go | 71 ++++++++--------- .../typed/camel/v1/fake/fake_integration.go | 75 +++++++++--------- .../camel/v1/fake/fake_integrationkit.go | 71 ++++++++--------- .../camel/v1/fake/fake_integrationplatform.go | 71 ++++++++--------- .../typed/camel/v1/fake/fake_kamelet.go | 71 ++++++++--------- .../typed/camel/v1/fake/fake_pipe.go | 75 +++++++++--------- .../typed/camel/v1alpha1/fake/fake_kamelet.go | 5 +- .../v1alpha1/fake/fake_kameletbinding.go | 5 +- .../informers/externalversions/factory.go | 79 ++++++++++++++++++- script/Makefile | 5 +- 20 files changed, 343 insertions(+), 324 deletions(-) delete mode 100644 addons/strimzi/duck/client/internalclientset/doc.go delete mode 100644 pkg/client/camel/clientset/versioned/doc.go diff --git a/addons/strimzi/duck/client/internalclientset/clientset.go b/addons/strimzi/duck/client/internalclientset/clientset.go index 357b35837b..89356372c3 100644 --- a/addons/strimzi/duck/client/internalclientset/clientset.go +++ b/addons/strimzi/duck/client/internalclientset/clientset.go @@ -34,8 +34,7 @@ type Interface interface { KafkaV1beta2() kafkav1beta2.KafkaV1beta2Interface } -// Clientset contains the clients for groups. Each group has exactly one -// version included in a Clientset. +// Clientset contains the clients for groups. type Clientset struct { *discovery.DiscoveryClient kafkaV1beta2 *kafkav1beta2.KafkaV1beta2Client diff --git a/addons/strimzi/duck/client/internalclientset/doc.go b/addons/strimzi/duck/client/internalclientset/doc.go deleted file mode 100644 index 0eb96b75d2..0000000000 --- a/addons/strimzi/duck/client/internalclientset/doc.go +++ /dev/null @@ -1,21 +0,0 @@ -/* -Licensed to the Apache Software Foundation (ASF) under one or more -contributor license agreements. See the NOTICE file distributed with -this work for additional information regarding copyright ownership. -The ASF licenses this file to You under the Apache License, Version 2.0 -(the "License"); you may not use this file except in compliance with -the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -// This package has the automatically generated clientset. -package internalclientset diff --git a/addons/strimzi/duck/client/internalclientset/typed/duck/v1beta2/fake/fake_kafka.go b/addons/strimzi/duck/client/internalclientset/typed/duck/v1beta2/fake/fake_kafka.go index dc11a28b83..5eb5f48a88 100644 --- a/addons/strimzi/duck/client/internalclientset/typed/duck/v1beta2/fake/fake_kafka.go +++ b/addons/strimzi/duck/client/internalclientset/typed/duck/v1beta2/fake/fake_kafka.go @@ -25,7 +25,6 @@ import ( v1beta2 "github.com/apache/camel-k/v2/addons/strimzi/duck/v1beta2" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" testing "k8s.io/client-go/testing" ) @@ -36,9 +35,9 @@ type FakeKafkas struct { ns string } -var kafkasResource = schema.GroupVersionResource{Group: "kafka.strimzi.io", Version: "v1beta2", Resource: "kafkas"} +var kafkasResource = v1beta2.SchemeGroupVersion.WithResource("kafkas") -var kafkasKind = schema.GroupVersionKind{Group: "kafka.strimzi.io", Version: "v1beta2", Kind: "Kafka"} +var kafkasKind = v1beta2.SchemeGroupVersion.WithKind("Kafka") // Get takes name of the kafka, and returns the corresponding kafka object, and an error if there is any. func (c *FakeKafkas) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta2.Kafka, err error) { diff --git a/addons/strimzi/duck/client/internalclientset/typed/duck/v1beta2/fake/fake_kafkatopic.go b/addons/strimzi/duck/client/internalclientset/typed/duck/v1beta2/fake/fake_kafkatopic.go index 40c997135e..12c8f17a56 100644 --- a/addons/strimzi/duck/client/internalclientset/typed/duck/v1beta2/fake/fake_kafkatopic.go +++ b/addons/strimzi/duck/client/internalclientset/typed/duck/v1beta2/fake/fake_kafkatopic.go @@ -25,7 +25,6 @@ import ( v1beta2 "github.com/apache/camel-k/v2/addons/strimzi/duck/v1beta2" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" testing "k8s.io/client-go/testing" ) @@ -36,9 +35,9 @@ type FakeKafkaTopics struct { ns string } -var kafkatopicsResource = schema.GroupVersionResource{Group: "kafka.strimzi.io", Version: "v1beta2", Resource: "kafkatopics"} +var kafkatopicsResource = v1beta2.SchemeGroupVersion.WithResource("kafkatopics") -var kafkatopicsKind = schema.GroupVersionKind{Group: "kafka.strimzi.io", Version: "v1beta2", Kind: "KafkaTopic"} +var kafkatopicsKind = v1beta2.SchemeGroupVersion.WithKind("KafkaTopic") // Get takes name of the kafkaTopic, and returns the corresponding kafkaTopic object, and an error if there is any. func (c *FakeKafkaTopics) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta2.KafkaTopic, err error) { diff --git a/cmd/util/doc-gen/main.go b/cmd/util/doc-gen/main.go index b80d8bc544..fdf2ecce15 100644 --- a/cmd/util/doc-gen/main.go +++ b/cmd/util/doc-gen/main.go @@ -21,6 +21,8 @@ import ( "github.com/apache/camel-k/v2/cmd/util/doc-gen/generators" "github.com/spf13/pflag" "k8s.io/gengo/args" + "sigs.k8s.io/controller-runtime/pkg/log" + "sigs.k8s.io/controller-runtime/pkg/log/zap" _ "github.com/apache/camel-k/v2/addons" ) @@ -37,6 +39,8 @@ func main() { pflag.CommandLine.StringVar(&customArgs.ListPath, "list-path", "modules/traits/pages/traits.adoc", "Path to the trait list file.") arguments.CustomArgs = customArgs + log.SetLogger(zap.New(zap.UseDevMode(true))) + if err := arguments.Execute( generators.NameSystems(), generators.DefaultNameSystem(), diff --git a/go.mod b/go.mod index 1536af9615..6ba5215343 100644 --- a/go.mod +++ b/go.mod @@ -55,7 +55,7 @@ require ( knative.dev/eventing v0.37.2 knative.dev/pkg v0.0.0-20230418073056-dfad48eaa5d0 knative.dev/serving v0.37.2 - sigs.k8s.io/controller-runtime v0.15.1 + sigs.k8s.io/controller-runtime v0.15.2 sigs.k8s.io/structured-merge-diff/v4 v4.3.0 ) diff --git a/go.sum b/go.sum index 2fb818f553..01f7d42794 100644 --- a/go.sum +++ b/go.sum @@ -903,8 +903,8 @@ knative.dev/serving v0.37.2/go.mod h1:v0Xbfp7olb0Gljm5l4qNuLsIf8/2p1rIt/mphxvx1z rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= -sigs.k8s.io/controller-runtime v0.15.1 h1:9UvgKD4ZJGcj24vefUFgZFP3xej/3igL9BsOUTb/+4c= -sigs.k8s.io/controller-runtime v0.15.1/go.mod h1:7ngYvp1MLT+9GeZ+6lH3LOlcHkp/+tzA/fmHa4iq9kk= +sigs.k8s.io/controller-runtime v0.15.2 h1:9V7b7SDQSJ08IIsJ6CY1CE85Okhp87dyTMNDG0FS7f4= +sigs.k8s.io/controller-runtime v0.15.2/go.mod h1:7ngYvp1MLT+9GeZ+6lH3LOlcHkp/+tzA/fmHa4iq9kk= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= sigs.k8s.io/structured-merge-diff/v4 v4.3.0 h1:UZbZAZfX0wV2zr7YZorDz6GXROfDFj6LvqCRm4VUVKk= diff --git a/pkg/client/camel/clientset/versioned/clientset.go b/pkg/client/camel/clientset/versioned/clientset.go index 7dfa415c0d..81203f7fdc 100644 --- a/pkg/client/camel/clientset/versioned/clientset.go +++ b/pkg/client/camel/clientset/versioned/clientset.go @@ -36,8 +36,7 @@ type Interface interface { CamelV1alpha1() camelv1alpha1.CamelV1alpha1Interface } -// Clientset contains the clients for groups. Each group has exactly one -// version included in a Clientset. +// Clientset contains the clients for groups. type Clientset struct { *discovery.DiscoveryClient camelV1 *camelv1.CamelV1Client diff --git a/pkg/client/camel/clientset/versioned/doc.go b/pkg/client/camel/clientset/versioned/doc.go deleted file mode 100644 index c82aadf085..0000000000 --- a/pkg/client/camel/clientset/versioned/doc.go +++ /dev/null @@ -1,21 +0,0 @@ -/* -Licensed to the Apache Software Foundation (ASF) under one or more -contributor license agreements. See the NOTICE file distributed with -this work for additional information regarding copyright ownership. -The ASF licenses this file to You under the Apache License, Version 2.0 -(the "License"); you may not use this file except in compliance with -the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -// This package has the automatically generated clientset. -package versioned diff --git a/pkg/client/camel/clientset/versioned/typed/camel/v1/fake/fake_build.go b/pkg/client/camel/clientset/versioned/typed/camel/v1/fake/fake_build.go index 335db462ca..acae9e0ace 100644 --- a/pkg/client/camel/clientset/versioned/typed/camel/v1/fake/fake_build.go +++ b/pkg/client/camel/clientset/versioned/typed/camel/v1/fake/fake_build.go @@ -24,11 +24,10 @@ import ( json "encoding/json" "fmt" - camelv1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1" - applyconfigurationcamelv1 "github.com/apache/camel-k/v2/pkg/client/camel/applyconfiguration/camel/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1" + camelv1 "github.com/apache/camel-k/v2/pkg/client/camel/applyconfiguration/camel/v1" + metav1 "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" @@ -40,25 +39,25 @@ type FakeBuilds struct { ns string } -var buildsResource = schema.GroupVersionResource{Group: "camel.apache.org", Version: "v1", Resource: "builds"} +var buildsResource = v1.SchemeGroupVersion.WithResource("builds") -var buildsKind = schema.GroupVersionKind{Group: "camel.apache.org", Version: "v1", Kind: "Build"} +var buildsKind = v1.SchemeGroupVersion.WithKind("Build") // Get takes name of the build, and returns the corresponding build object, and an error if there is any. -func (c *FakeBuilds) Get(ctx context.Context, name string, options v1.GetOptions) (result *camelv1.Build, err error) { +func (c *FakeBuilds) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Build, err error) { obj, err := c.Fake. - Invokes(testing.NewGetAction(buildsResource, c.ns, name), &camelv1.Build{}) + Invokes(testing.NewGetAction(buildsResource, c.ns, name), &v1.Build{}) if obj == nil { return nil, err } - return obj.(*camelv1.Build), err + return obj.(*v1.Build), err } // List takes label and field selectors, and returns the list of Builds that match those selectors. -func (c *FakeBuilds) List(ctx context.Context, opts v1.ListOptions) (result *camelv1.BuildList, err error) { +func (c *FakeBuilds) List(ctx context.Context, opts metav1.ListOptions) (result *v1.BuildList, err error) { obj, err := c.Fake. - Invokes(testing.NewListAction(buildsResource, buildsKind, c.ns, opts), &camelv1.BuildList{}) + Invokes(testing.NewListAction(buildsResource, buildsKind, c.ns, opts), &v1.BuildList{}) if obj == nil { return nil, err @@ -68,8 +67,8 @@ func (c *FakeBuilds) List(ctx context.Context, opts v1.ListOptions) (result *cam if label == nil { label = labels.Everything() } - list := &camelv1.BuildList{ListMeta: obj.(*camelv1.BuildList).ListMeta} - for _, item := range obj.(*camelv1.BuildList).Items { + list := &v1.BuildList{ListMeta: obj.(*v1.BuildList).ListMeta} + for _, item := range obj.(*v1.BuildList).Items { if label.Matches(labels.Set(item.Labels)) { list.Items = append(list.Items, item) } @@ -78,75 +77,75 @@ func (c *FakeBuilds) List(ctx context.Context, opts v1.ListOptions) (result *cam } // Watch returns a watch.Interface that watches the requested builds. -func (c *FakeBuilds) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { +func (c *FakeBuilds) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { return c.Fake. InvokesWatch(testing.NewWatchAction(buildsResource, c.ns, opts)) } // Create takes the representation of a build and creates it. Returns the server's representation of the build, and an error, if there is any. -func (c *FakeBuilds) Create(ctx context.Context, build *camelv1.Build, opts v1.CreateOptions) (result *camelv1.Build, err error) { +func (c *FakeBuilds) Create(ctx context.Context, build *v1.Build, opts metav1.CreateOptions) (result *v1.Build, err error) { obj, err := c.Fake. - Invokes(testing.NewCreateAction(buildsResource, c.ns, build), &camelv1.Build{}) + Invokes(testing.NewCreateAction(buildsResource, c.ns, build), &v1.Build{}) if obj == nil { return nil, err } - return obj.(*camelv1.Build), err + return obj.(*v1.Build), err } // Update takes the representation of a build and updates it. Returns the server's representation of the build, and an error, if there is any. -func (c *FakeBuilds) Update(ctx context.Context, build *camelv1.Build, opts v1.UpdateOptions) (result *camelv1.Build, err error) { +func (c *FakeBuilds) Update(ctx context.Context, build *v1.Build, opts metav1.UpdateOptions) (result *v1.Build, err error) { obj, err := c.Fake. - Invokes(testing.NewUpdateAction(buildsResource, c.ns, build), &camelv1.Build{}) + Invokes(testing.NewUpdateAction(buildsResource, c.ns, build), &v1.Build{}) if obj == nil { return nil, err } - return obj.(*camelv1.Build), err + return obj.(*v1.Build), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeBuilds) UpdateStatus(ctx context.Context, build *camelv1.Build, opts v1.UpdateOptions) (*camelv1.Build, error) { +func (c *FakeBuilds) UpdateStatus(ctx context.Context, build *v1.Build, opts metav1.UpdateOptions) (*v1.Build, error) { obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(buildsResource, "status", c.ns, build), &camelv1.Build{}) + Invokes(testing.NewUpdateSubresourceAction(buildsResource, "status", c.ns, build), &v1.Build{}) if obj == nil { return nil, err } - return obj.(*camelv1.Build), err + return obj.(*v1.Build), err } // Delete takes name of the build and deletes it. Returns an error if one occurs. -func (c *FakeBuilds) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { +func (c *FakeBuilds) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(buildsResource, c.ns, name, opts), &camelv1.Build{}) + Invokes(testing.NewDeleteActionWithOptions(buildsResource, c.ns, name, opts), &v1.Build{}) return err } // DeleteCollection deletes a collection of objects. -func (c *FakeBuilds) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { +func (c *FakeBuilds) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { action := testing.NewDeleteCollectionAction(buildsResource, c.ns, listOpts) - _, err := c.Fake.Invokes(action, &camelv1.BuildList{}) + _, err := c.Fake.Invokes(action, &v1.BuildList{}) return err } // Patch applies the patch and returns the patched build. -func (c *FakeBuilds) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *camelv1.Build, err error) { +func (c *FakeBuilds) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Build, err error) { obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(buildsResource, c.ns, name, pt, data, subresources...), &camelv1.Build{}) + Invokes(testing.NewPatchSubresourceAction(buildsResource, c.ns, name, pt, data, subresources...), &v1.Build{}) if obj == nil { return nil, err } - return obj.(*camelv1.Build), err + return obj.(*v1.Build), err } // Apply takes the given apply declarative configuration, applies it and returns the applied build. -func (c *FakeBuilds) Apply(ctx context.Context, build *applyconfigurationcamelv1.BuildApplyConfiguration, opts v1.ApplyOptions) (result *camelv1.Build, err error) { +func (c *FakeBuilds) Apply(ctx context.Context, build *camelv1.BuildApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Build, err error) { if build == nil { return nil, fmt.Errorf("build provided to Apply must not be nil") } @@ -159,17 +158,17 @@ func (c *FakeBuilds) Apply(ctx context.Context, build *applyconfigurationcamelv1 return nil, fmt.Errorf("build.Name must be provided to Apply") } obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(buildsResource, c.ns, *name, types.ApplyPatchType, data), &camelv1.Build{}) + Invokes(testing.NewPatchSubresourceAction(buildsResource, c.ns, *name, types.ApplyPatchType, data), &v1.Build{}) if obj == nil { return nil, err } - return obj.(*camelv1.Build), err + return obj.(*v1.Build), err } // ApplyStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). -func (c *FakeBuilds) ApplyStatus(ctx context.Context, build *applyconfigurationcamelv1.BuildApplyConfiguration, opts v1.ApplyOptions) (result *camelv1.Build, err error) { +func (c *FakeBuilds) ApplyStatus(ctx context.Context, build *camelv1.BuildApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Build, err error) { if build == nil { return nil, fmt.Errorf("build provided to Apply must not be nil") } @@ -182,10 +181,10 @@ func (c *FakeBuilds) ApplyStatus(ctx context.Context, build *applyconfigurationc return nil, fmt.Errorf("build.Name must be provided to Apply") } obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(buildsResource, c.ns, *name, types.ApplyPatchType, data, "status"), &camelv1.Build{}) + Invokes(testing.NewPatchSubresourceAction(buildsResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1.Build{}) if obj == nil { return nil, err } - return obj.(*camelv1.Build), err + return obj.(*v1.Build), err } diff --git a/pkg/client/camel/clientset/versioned/typed/camel/v1/fake/fake_camelcatalog.go b/pkg/client/camel/clientset/versioned/typed/camel/v1/fake/fake_camelcatalog.go index 76d07a4b4f..7ad661bc7a 100644 --- a/pkg/client/camel/clientset/versioned/typed/camel/v1/fake/fake_camelcatalog.go +++ b/pkg/client/camel/clientset/versioned/typed/camel/v1/fake/fake_camelcatalog.go @@ -24,11 +24,10 @@ import ( json "encoding/json" "fmt" - camelv1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1" - applyconfigurationcamelv1 "github.com/apache/camel-k/v2/pkg/client/camel/applyconfiguration/camel/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1" + camelv1 "github.com/apache/camel-k/v2/pkg/client/camel/applyconfiguration/camel/v1" + metav1 "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" @@ -40,25 +39,25 @@ type FakeCamelCatalogs struct { ns string } -var camelcatalogsResource = schema.GroupVersionResource{Group: "camel.apache.org", Version: "v1", Resource: "camelcatalogs"} +var camelcatalogsResource = v1.SchemeGroupVersion.WithResource("camelcatalogs") -var camelcatalogsKind = schema.GroupVersionKind{Group: "camel.apache.org", Version: "v1", Kind: "CamelCatalog"} +var camelcatalogsKind = v1.SchemeGroupVersion.WithKind("CamelCatalog") // Get takes name of the camelCatalog, and returns the corresponding camelCatalog object, and an error if there is any. -func (c *FakeCamelCatalogs) Get(ctx context.Context, name string, options v1.GetOptions) (result *camelv1.CamelCatalog, err error) { +func (c *FakeCamelCatalogs) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.CamelCatalog, err error) { obj, err := c.Fake. - Invokes(testing.NewGetAction(camelcatalogsResource, c.ns, name), &camelv1.CamelCatalog{}) + Invokes(testing.NewGetAction(camelcatalogsResource, c.ns, name), &v1.CamelCatalog{}) if obj == nil { return nil, err } - return obj.(*camelv1.CamelCatalog), err + return obj.(*v1.CamelCatalog), err } // List takes label and field selectors, and returns the list of CamelCatalogs that match those selectors. -func (c *FakeCamelCatalogs) List(ctx context.Context, opts v1.ListOptions) (result *camelv1.CamelCatalogList, err error) { +func (c *FakeCamelCatalogs) List(ctx context.Context, opts metav1.ListOptions) (result *v1.CamelCatalogList, err error) { obj, err := c.Fake. - Invokes(testing.NewListAction(camelcatalogsResource, camelcatalogsKind, c.ns, opts), &camelv1.CamelCatalogList{}) + Invokes(testing.NewListAction(camelcatalogsResource, camelcatalogsKind, c.ns, opts), &v1.CamelCatalogList{}) if obj == nil { return nil, err @@ -68,8 +67,8 @@ func (c *FakeCamelCatalogs) List(ctx context.Context, opts v1.ListOptions) (resu if label == nil { label = labels.Everything() } - list := &camelv1.CamelCatalogList{ListMeta: obj.(*camelv1.CamelCatalogList).ListMeta} - for _, item := range obj.(*camelv1.CamelCatalogList).Items { + list := &v1.CamelCatalogList{ListMeta: obj.(*v1.CamelCatalogList).ListMeta} + for _, item := range obj.(*v1.CamelCatalogList).Items { if label.Matches(labels.Set(item.Labels)) { list.Items = append(list.Items, item) } @@ -78,75 +77,75 @@ func (c *FakeCamelCatalogs) List(ctx context.Context, opts v1.ListOptions) (resu } // Watch returns a watch.Interface that watches the requested camelCatalogs. -func (c *FakeCamelCatalogs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { +func (c *FakeCamelCatalogs) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { return c.Fake. InvokesWatch(testing.NewWatchAction(camelcatalogsResource, c.ns, opts)) } // Create takes the representation of a camelCatalog and creates it. Returns the server's representation of the camelCatalog, and an error, if there is any. -func (c *FakeCamelCatalogs) Create(ctx context.Context, camelCatalog *camelv1.CamelCatalog, opts v1.CreateOptions) (result *camelv1.CamelCatalog, err error) { +func (c *FakeCamelCatalogs) Create(ctx context.Context, camelCatalog *v1.CamelCatalog, opts metav1.CreateOptions) (result *v1.CamelCatalog, err error) { obj, err := c.Fake. - Invokes(testing.NewCreateAction(camelcatalogsResource, c.ns, camelCatalog), &camelv1.CamelCatalog{}) + Invokes(testing.NewCreateAction(camelcatalogsResource, c.ns, camelCatalog), &v1.CamelCatalog{}) if obj == nil { return nil, err } - return obj.(*camelv1.CamelCatalog), err + return obj.(*v1.CamelCatalog), err } // Update takes the representation of a camelCatalog and updates it. Returns the server's representation of the camelCatalog, and an error, if there is any. -func (c *FakeCamelCatalogs) Update(ctx context.Context, camelCatalog *camelv1.CamelCatalog, opts v1.UpdateOptions) (result *camelv1.CamelCatalog, err error) { +func (c *FakeCamelCatalogs) Update(ctx context.Context, camelCatalog *v1.CamelCatalog, opts metav1.UpdateOptions) (result *v1.CamelCatalog, err error) { obj, err := c.Fake. - Invokes(testing.NewUpdateAction(camelcatalogsResource, c.ns, camelCatalog), &camelv1.CamelCatalog{}) + Invokes(testing.NewUpdateAction(camelcatalogsResource, c.ns, camelCatalog), &v1.CamelCatalog{}) if obj == nil { return nil, err } - return obj.(*camelv1.CamelCatalog), err + return obj.(*v1.CamelCatalog), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeCamelCatalogs) UpdateStatus(ctx context.Context, camelCatalog *camelv1.CamelCatalog, opts v1.UpdateOptions) (*camelv1.CamelCatalog, error) { +func (c *FakeCamelCatalogs) UpdateStatus(ctx context.Context, camelCatalog *v1.CamelCatalog, opts metav1.UpdateOptions) (*v1.CamelCatalog, error) { obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(camelcatalogsResource, "status", c.ns, camelCatalog), &camelv1.CamelCatalog{}) + Invokes(testing.NewUpdateSubresourceAction(camelcatalogsResource, "status", c.ns, camelCatalog), &v1.CamelCatalog{}) if obj == nil { return nil, err } - return obj.(*camelv1.CamelCatalog), err + return obj.(*v1.CamelCatalog), err } // Delete takes name of the camelCatalog and deletes it. Returns an error if one occurs. -func (c *FakeCamelCatalogs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { +func (c *FakeCamelCatalogs) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(camelcatalogsResource, c.ns, name, opts), &camelv1.CamelCatalog{}) + Invokes(testing.NewDeleteActionWithOptions(camelcatalogsResource, c.ns, name, opts), &v1.CamelCatalog{}) return err } // DeleteCollection deletes a collection of objects. -func (c *FakeCamelCatalogs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { +func (c *FakeCamelCatalogs) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { action := testing.NewDeleteCollectionAction(camelcatalogsResource, c.ns, listOpts) - _, err := c.Fake.Invokes(action, &camelv1.CamelCatalogList{}) + _, err := c.Fake.Invokes(action, &v1.CamelCatalogList{}) return err } // Patch applies the patch and returns the patched camelCatalog. -func (c *FakeCamelCatalogs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *camelv1.CamelCatalog, err error) { +func (c *FakeCamelCatalogs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.CamelCatalog, err error) { obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(camelcatalogsResource, c.ns, name, pt, data, subresources...), &camelv1.CamelCatalog{}) + Invokes(testing.NewPatchSubresourceAction(camelcatalogsResource, c.ns, name, pt, data, subresources...), &v1.CamelCatalog{}) if obj == nil { return nil, err } - return obj.(*camelv1.CamelCatalog), err + return obj.(*v1.CamelCatalog), err } // Apply takes the given apply declarative configuration, applies it and returns the applied camelCatalog. -func (c *FakeCamelCatalogs) Apply(ctx context.Context, camelCatalog *applyconfigurationcamelv1.CamelCatalogApplyConfiguration, opts v1.ApplyOptions) (result *camelv1.CamelCatalog, err error) { +func (c *FakeCamelCatalogs) Apply(ctx context.Context, camelCatalog *camelv1.CamelCatalogApplyConfiguration, opts metav1.ApplyOptions) (result *v1.CamelCatalog, err error) { if camelCatalog == nil { return nil, fmt.Errorf("camelCatalog provided to Apply must not be nil") } @@ -159,17 +158,17 @@ func (c *FakeCamelCatalogs) Apply(ctx context.Context, camelCatalog *applyconfig return nil, fmt.Errorf("camelCatalog.Name must be provided to Apply") } obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(camelcatalogsResource, c.ns, *name, types.ApplyPatchType, data), &camelv1.CamelCatalog{}) + Invokes(testing.NewPatchSubresourceAction(camelcatalogsResource, c.ns, *name, types.ApplyPatchType, data), &v1.CamelCatalog{}) if obj == nil { return nil, err } - return obj.(*camelv1.CamelCatalog), err + return obj.(*v1.CamelCatalog), err } // ApplyStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). -func (c *FakeCamelCatalogs) ApplyStatus(ctx context.Context, camelCatalog *applyconfigurationcamelv1.CamelCatalogApplyConfiguration, opts v1.ApplyOptions) (result *camelv1.CamelCatalog, err error) { +func (c *FakeCamelCatalogs) ApplyStatus(ctx context.Context, camelCatalog *camelv1.CamelCatalogApplyConfiguration, opts metav1.ApplyOptions) (result *v1.CamelCatalog, err error) { if camelCatalog == nil { return nil, fmt.Errorf("camelCatalog provided to Apply must not be nil") } @@ -182,10 +181,10 @@ func (c *FakeCamelCatalogs) ApplyStatus(ctx context.Context, camelCatalog *apply return nil, fmt.Errorf("camelCatalog.Name must be provided to Apply") } obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(camelcatalogsResource, c.ns, *name, types.ApplyPatchType, data, "status"), &camelv1.CamelCatalog{}) + Invokes(testing.NewPatchSubresourceAction(camelcatalogsResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1.CamelCatalog{}) if obj == nil { return nil, err } - return obj.(*camelv1.CamelCatalog), err + return obj.(*v1.CamelCatalog), err } diff --git a/pkg/client/camel/clientset/versioned/typed/camel/v1/fake/fake_integration.go b/pkg/client/camel/clientset/versioned/typed/camel/v1/fake/fake_integration.go index 5cc236ac78..7ce8e636bc 100644 --- a/pkg/client/camel/clientset/versioned/typed/camel/v1/fake/fake_integration.go +++ b/pkg/client/camel/clientset/versioned/typed/camel/v1/fake/fake_integration.go @@ -24,12 +24,11 @@ import ( json "encoding/json" "fmt" - camelv1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1" - applyconfigurationcamelv1 "github.com/apache/camel-k/v2/pkg/client/camel/applyconfiguration/camel/v1" + v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1" + camelv1 "github.com/apache/camel-k/v2/pkg/client/camel/applyconfiguration/camel/v1" autoscalingv1 "k8s.io/api/autoscaling/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + metav1 "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" @@ -41,25 +40,25 @@ type FakeIntegrations struct { ns string } -var integrationsResource = schema.GroupVersionResource{Group: "camel.apache.org", Version: "v1", Resource: "integrations"} +var integrationsResource = v1.SchemeGroupVersion.WithResource("integrations") -var integrationsKind = schema.GroupVersionKind{Group: "camel.apache.org", Version: "v1", Kind: "Integration"} +var integrationsKind = v1.SchemeGroupVersion.WithKind("Integration") // Get takes name of the integration, and returns the corresponding integration object, and an error if there is any. -func (c *FakeIntegrations) Get(ctx context.Context, name string, options v1.GetOptions) (result *camelv1.Integration, err error) { +func (c *FakeIntegrations) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Integration, err error) { obj, err := c.Fake. - Invokes(testing.NewGetAction(integrationsResource, c.ns, name), &camelv1.Integration{}) + Invokes(testing.NewGetAction(integrationsResource, c.ns, name), &v1.Integration{}) if obj == nil { return nil, err } - return obj.(*camelv1.Integration), err + return obj.(*v1.Integration), err } // List takes label and field selectors, and returns the list of Integrations that match those selectors. -func (c *FakeIntegrations) List(ctx context.Context, opts v1.ListOptions) (result *camelv1.IntegrationList, err error) { +func (c *FakeIntegrations) List(ctx context.Context, opts metav1.ListOptions) (result *v1.IntegrationList, err error) { obj, err := c.Fake. - Invokes(testing.NewListAction(integrationsResource, integrationsKind, c.ns, opts), &camelv1.IntegrationList{}) + Invokes(testing.NewListAction(integrationsResource, integrationsKind, c.ns, opts), &v1.IntegrationList{}) if obj == nil { return nil, err @@ -69,8 +68,8 @@ func (c *FakeIntegrations) List(ctx context.Context, opts v1.ListOptions) (resul if label == nil { label = labels.Everything() } - list := &camelv1.IntegrationList{ListMeta: obj.(*camelv1.IntegrationList).ListMeta} - for _, item := range obj.(*camelv1.IntegrationList).Items { + list := &v1.IntegrationList{ListMeta: obj.(*v1.IntegrationList).ListMeta} + for _, item := range obj.(*v1.IntegrationList).Items { if label.Matches(labels.Set(item.Labels)) { list.Items = append(list.Items, item) } @@ -79,75 +78,75 @@ func (c *FakeIntegrations) List(ctx context.Context, opts v1.ListOptions) (resul } // Watch returns a watch.Interface that watches the requested integrations. -func (c *FakeIntegrations) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { +func (c *FakeIntegrations) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { return c.Fake. InvokesWatch(testing.NewWatchAction(integrationsResource, c.ns, opts)) } // Create takes the representation of a integration and creates it. Returns the server's representation of the integration, and an error, if there is any. -func (c *FakeIntegrations) Create(ctx context.Context, integration *camelv1.Integration, opts v1.CreateOptions) (result *camelv1.Integration, err error) { +func (c *FakeIntegrations) Create(ctx context.Context, integration *v1.Integration, opts metav1.CreateOptions) (result *v1.Integration, err error) { obj, err := c.Fake. - Invokes(testing.NewCreateAction(integrationsResource, c.ns, integration), &camelv1.Integration{}) + Invokes(testing.NewCreateAction(integrationsResource, c.ns, integration), &v1.Integration{}) if obj == nil { return nil, err } - return obj.(*camelv1.Integration), err + return obj.(*v1.Integration), err } // Update takes the representation of a integration and updates it. Returns the server's representation of the integration, and an error, if there is any. -func (c *FakeIntegrations) Update(ctx context.Context, integration *camelv1.Integration, opts v1.UpdateOptions) (result *camelv1.Integration, err error) { +func (c *FakeIntegrations) Update(ctx context.Context, integration *v1.Integration, opts metav1.UpdateOptions) (result *v1.Integration, err error) { obj, err := c.Fake. - Invokes(testing.NewUpdateAction(integrationsResource, c.ns, integration), &camelv1.Integration{}) + Invokes(testing.NewUpdateAction(integrationsResource, c.ns, integration), &v1.Integration{}) if obj == nil { return nil, err } - return obj.(*camelv1.Integration), err + return obj.(*v1.Integration), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeIntegrations) UpdateStatus(ctx context.Context, integration *camelv1.Integration, opts v1.UpdateOptions) (*camelv1.Integration, error) { +func (c *FakeIntegrations) UpdateStatus(ctx context.Context, integration *v1.Integration, opts metav1.UpdateOptions) (*v1.Integration, error) { obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(integrationsResource, "status", c.ns, integration), &camelv1.Integration{}) + Invokes(testing.NewUpdateSubresourceAction(integrationsResource, "status", c.ns, integration), &v1.Integration{}) if obj == nil { return nil, err } - return obj.(*camelv1.Integration), err + return obj.(*v1.Integration), err } // Delete takes name of the integration and deletes it. Returns an error if one occurs. -func (c *FakeIntegrations) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { +func (c *FakeIntegrations) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(integrationsResource, c.ns, name, opts), &camelv1.Integration{}) + Invokes(testing.NewDeleteActionWithOptions(integrationsResource, c.ns, name, opts), &v1.Integration{}) return err } // DeleteCollection deletes a collection of objects. -func (c *FakeIntegrations) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { +func (c *FakeIntegrations) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { action := testing.NewDeleteCollectionAction(integrationsResource, c.ns, listOpts) - _, err := c.Fake.Invokes(action, &camelv1.IntegrationList{}) + _, err := c.Fake.Invokes(action, &v1.IntegrationList{}) return err } // Patch applies the patch and returns the patched integration. -func (c *FakeIntegrations) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *camelv1.Integration, err error) { +func (c *FakeIntegrations) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Integration, err error) { obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(integrationsResource, c.ns, name, pt, data, subresources...), &camelv1.Integration{}) + Invokes(testing.NewPatchSubresourceAction(integrationsResource, c.ns, name, pt, data, subresources...), &v1.Integration{}) if obj == nil { return nil, err } - return obj.(*camelv1.Integration), err + return obj.(*v1.Integration), err } // Apply takes the given apply declarative configuration, applies it and returns the applied integration. -func (c *FakeIntegrations) Apply(ctx context.Context, integration *applyconfigurationcamelv1.IntegrationApplyConfiguration, opts v1.ApplyOptions) (result *camelv1.Integration, err error) { +func (c *FakeIntegrations) Apply(ctx context.Context, integration *camelv1.IntegrationApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Integration, err error) { if integration == nil { return nil, fmt.Errorf("integration provided to Apply must not be nil") } @@ -160,17 +159,17 @@ func (c *FakeIntegrations) Apply(ctx context.Context, integration *applyconfigur return nil, fmt.Errorf("integration.Name must be provided to Apply") } obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(integrationsResource, c.ns, *name, types.ApplyPatchType, data), &camelv1.Integration{}) + Invokes(testing.NewPatchSubresourceAction(integrationsResource, c.ns, *name, types.ApplyPatchType, data), &v1.Integration{}) if obj == nil { return nil, err } - return obj.(*camelv1.Integration), err + return obj.(*v1.Integration), err } // ApplyStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). -func (c *FakeIntegrations) ApplyStatus(ctx context.Context, integration *applyconfigurationcamelv1.IntegrationApplyConfiguration, opts v1.ApplyOptions) (result *camelv1.Integration, err error) { +func (c *FakeIntegrations) ApplyStatus(ctx context.Context, integration *camelv1.IntegrationApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Integration, err error) { if integration == nil { return nil, fmt.Errorf("integration provided to Apply must not be nil") } @@ -183,16 +182,16 @@ func (c *FakeIntegrations) ApplyStatus(ctx context.Context, integration *applyco return nil, fmt.Errorf("integration.Name must be provided to Apply") } obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(integrationsResource, c.ns, *name, types.ApplyPatchType, data, "status"), &camelv1.Integration{}) + Invokes(testing.NewPatchSubresourceAction(integrationsResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1.Integration{}) if obj == nil { return nil, err } - return obj.(*camelv1.Integration), err + return obj.(*v1.Integration), err } // GetScale takes name of the integration, and returns the corresponding scale object, and an error if there is any. -func (c *FakeIntegrations) GetScale(ctx context.Context, integrationName string, options v1.GetOptions) (result *autoscalingv1.Scale, err error) { +func (c *FakeIntegrations) GetScale(ctx context.Context, integrationName string, options metav1.GetOptions) (result *autoscalingv1.Scale, err error) { obj, err := c.Fake. Invokes(testing.NewGetSubresourceAction(integrationsResource, c.ns, "scale", integrationName), &autoscalingv1.Scale{}) @@ -203,7 +202,7 @@ func (c *FakeIntegrations) GetScale(ctx context.Context, integrationName string, } // UpdateScale takes the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any. -func (c *FakeIntegrations) UpdateScale(ctx context.Context, integrationName string, scale *autoscalingv1.Scale, opts v1.UpdateOptions) (result *autoscalingv1.Scale, err error) { +func (c *FakeIntegrations) UpdateScale(ctx context.Context, integrationName string, scale *autoscalingv1.Scale, opts metav1.UpdateOptions) (result *autoscalingv1.Scale, err error) { obj, err := c.Fake. Invokes(testing.NewUpdateSubresourceAction(integrationsResource, "scale", c.ns, scale), &autoscalingv1.Scale{}) diff --git a/pkg/client/camel/clientset/versioned/typed/camel/v1/fake/fake_integrationkit.go b/pkg/client/camel/clientset/versioned/typed/camel/v1/fake/fake_integrationkit.go index da728c8fa4..a223c073e2 100644 --- a/pkg/client/camel/clientset/versioned/typed/camel/v1/fake/fake_integrationkit.go +++ b/pkg/client/camel/clientset/versioned/typed/camel/v1/fake/fake_integrationkit.go @@ -24,11 +24,10 @@ import ( json "encoding/json" "fmt" - camelv1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1" - applyconfigurationcamelv1 "github.com/apache/camel-k/v2/pkg/client/camel/applyconfiguration/camel/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1" + camelv1 "github.com/apache/camel-k/v2/pkg/client/camel/applyconfiguration/camel/v1" + metav1 "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" @@ -40,25 +39,25 @@ type FakeIntegrationKits struct { ns string } -var integrationkitsResource = schema.GroupVersionResource{Group: "camel.apache.org", Version: "v1", Resource: "integrationkits"} +var integrationkitsResource = v1.SchemeGroupVersion.WithResource("integrationkits") -var integrationkitsKind = schema.GroupVersionKind{Group: "camel.apache.org", Version: "v1", Kind: "IntegrationKit"} +var integrationkitsKind = v1.SchemeGroupVersion.WithKind("IntegrationKit") // Get takes name of the integrationKit, and returns the corresponding integrationKit object, and an error if there is any. -func (c *FakeIntegrationKits) Get(ctx context.Context, name string, options v1.GetOptions) (result *camelv1.IntegrationKit, err error) { +func (c *FakeIntegrationKits) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.IntegrationKit, err error) { obj, err := c.Fake. - Invokes(testing.NewGetAction(integrationkitsResource, c.ns, name), &camelv1.IntegrationKit{}) + Invokes(testing.NewGetAction(integrationkitsResource, c.ns, name), &v1.IntegrationKit{}) if obj == nil { return nil, err } - return obj.(*camelv1.IntegrationKit), err + return obj.(*v1.IntegrationKit), err } // List takes label and field selectors, and returns the list of IntegrationKits that match those selectors. -func (c *FakeIntegrationKits) List(ctx context.Context, opts v1.ListOptions) (result *camelv1.IntegrationKitList, err error) { +func (c *FakeIntegrationKits) List(ctx context.Context, opts metav1.ListOptions) (result *v1.IntegrationKitList, err error) { obj, err := c.Fake. - Invokes(testing.NewListAction(integrationkitsResource, integrationkitsKind, c.ns, opts), &camelv1.IntegrationKitList{}) + Invokes(testing.NewListAction(integrationkitsResource, integrationkitsKind, c.ns, opts), &v1.IntegrationKitList{}) if obj == nil { return nil, err @@ -68,8 +67,8 @@ func (c *FakeIntegrationKits) List(ctx context.Context, opts v1.ListOptions) (re if label == nil { label = labels.Everything() } - list := &camelv1.IntegrationKitList{ListMeta: obj.(*camelv1.IntegrationKitList).ListMeta} - for _, item := range obj.(*camelv1.IntegrationKitList).Items { + list := &v1.IntegrationKitList{ListMeta: obj.(*v1.IntegrationKitList).ListMeta} + for _, item := range obj.(*v1.IntegrationKitList).Items { if label.Matches(labels.Set(item.Labels)) { list.Items = append(list.Items, item) } @@ -78,75 +77,75 @@ func (c *FakeIntegrationKits) List(ctx context.Context, opts v1.ListOptions) (re } // Watch returns a watch.Interface that watches the requested integrationKits. -func (c *FakeIntegrationKits) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { +func (c *FakeIntegrationKits) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { return c.Fake. InvokesWatch(testing.NewWatchAction(integrationkitsResource, c.ns, opts)) } // Create takes the representation of a integrationKit and creates it. Returns the server's representation of the integrationKit, and an error, if there is any. -func (c *FakeIntegrationKits) Create(ctx context.Context, integrationKit *camelv1.IntegrationKit, opts v1.CreateOptions) (result *camelv1.IntegrationKit, err error) { +func (c *FakeIntegrationKits) Create(ctx context.Context, integrationKit *v1.IntegrationKit, opts metav1.CreateOptions) (result *v1.IntegrationKit, err error) { obj, err := c.Fake. - Invokes(testing.NewCreateAction(integrationkitsResource, c.ns, integrationKit), &camelv1.IntegrationKit{}) + Invokes(testing.NewCreateAction(integrationkitsResource, c.ns, integrationKit), &v1.IntegrationKit{}) if obj == nil { return nil, err } - return obj.(*camelv1.IntegrationKit), err + return obj.(*v1.IntegrationKit), err } // Update takes the representation of a integrationKit and updates it. Returns the server's representation of the integrationKit, and an error, if there is any. -func (c *FakeIntegrationKits) Update(ctx context.Context, integrationKit *camelv1.IntegrationKit, opts v1.UpdateOptions) (result *camelv1.IntegrationKit, err error) { +func (c *FakeIntegrationKits) Update(ctx context.Context, integrationKit *v1.IntegrationKit, opts metav1.UpdateOptions) (result *v1.IntegrationKit, err error) { obj, err := c.Fake. - Invokes(testing.NewUpdateAction(integrationkitsResource, c.ns, integrationKit), &camelv1.IntegrationKit{}) + Invokes(testing.NewUpdateAction(integrationkitsResource, c.ns, integrationKit), &v1.IntegrationKit{}) if obj == nil { return nil, err } - return obj.(*camelv1.IntegrationKit), err + return obj.(*v1.IntegrationKit), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeIntegrationKits) UpdateStatus(ctx context.Context, integrationKit *camelv1.IntegrationKit, opts v1.UpdateOptions) (*camelv1.IntegrationKit, error) { +func (c *FakeIntegrationKits) UpdateStatus(ctx context.Context, integrationKit *v1.IntegrationKit, opts metav1.UpdateOptions) (*v1.IntegrationKit, error) { obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(integrationkitsResource, "status", c.ns, integrationKit), &camelv1.IntegrationKit{}) + Invokes(testing.NewUpdateSubresourceAction(integrationkitsResource, "status", c.ns, integrationKit), &v1.IntegrationKit{}) if obj == nil { return nil, err } - return obj.(*camelv1.IntegrationKit), err + return obj.(*v1.IntegrationKit), err } // Delete takes name of the integrationKit and deletes it. Returns an error if one occurs. -func (c *FakeIntegrationKits) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { +func (c *FakeIntegrationKits) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(integrationkitsResource, c.ns, name, opts), &camelv1.IntegrationKit{}) + Invokes(testing.NewDeleteActionWithOptions(integrationkitsResource, c.ns, name, opts), &v1.IntegrationKit{}) return err } // DeleteCollection deletes a collection of objects. -func (c *FakeIntegrationKits) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { +func (c *FakeIntegrationKits) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { action := testing.NewDeleteCollectionAction(integrationkitsResource, c.ns, listOpts) - _, err := c.Fake.Invokes(action, &camelv1.IntegrationKitList{}) + _, err := c.Fake.Invokes(action, &v1.IntegrationKitList{}) return err } // Patch applies the patch and returns the patched integrationKit. -func (c *FakeIntegrationKits) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *camelv1.IntegrationKit, err error) { +func (c *FakeIntegrationKits) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.IntegrationKit, err error) { obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(integrationkitsResource, c.ns, name, pt, data, subresources...), &camelv1.IntegrationKit{}) + Invokes(testing.NewPatchSubresourceAction(integrationkitsResource, c.ns, name, pt, data, subresources...), &v1.IntegrationKit{}) if obj == nil { return nil, err } - return obj.(*camelv1.IntegrationKit), err + return obj.(*v1.IntegrationKit), err } // Apply takes the given apply declarative configuration, applies it and returns the applied integrationKit. -func (c *FakeIntegrationKits) Apply(ctx context.Context, integrationKit *applyconfigurationcamelv1.IntegrationKitApplyConfiguration, opts v1.ApplyOptions) (result *camelv1.IntegrationKit, err error) { +func (c *FakeIntegrationKits) Apply(ctx context.Context, integrationKit *camelv1.IntegrationKitApplyConfiguration, opts metav1.ApplyOptions) (result *v1.IntegrationKit, err error) { if integrationKit == nil { return nil, fmt.Errorf("integrationKit provided to Apply must not be nil") } @@ -159,17 +158,17 @@ func (c *FakeIntegrationKits) Apply(ctx context.Context, integrationKit *applyco return nil, fmt.Errorf("integrationKit.Name must be provided to Apply") } obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(integrationkitsResource, c.ns, *name, types.ApplyPatchType, data), &camelv1.IntegrationKit{}) + Invokes(testing.NewPatchSubresourceAction(integrationkitsResource, c.ns, *name, types.ApplyPatchType, data), &v1.IntegrationKit{}) if obj == nil { return nil, err } - return obj.(*camelv1.IntegrationKit), err + return obj.(*v1.IntegrationKit), err } // ApplyStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). -func (c *FakeIntegrationKits) ApplyStatus(ctx context.Context, integrationKit *applyconfigurationcamelv1.IntegrationKitApplyConfiguration, opts v1.ApplyOptions) (result *camelv1.IntegrationKit, err error) { +func (c *FakeIntegrationKits) ApplyStatus(ctx context.Context, integrationKit *camelv1.IntegrationKitApplyConfiguration, opts metav1.ApplyOptions) (result *v1.IntegrationKit, err error) { if integrationKit == nil { return nil, fmt.Errorf("integrationKit provided to Apply must not be nil") } @@ -182,10 +181,10 @@ func (c *FakeIntegrationKits) ApplyStatus(ctx context.Context, integrationKit *a return nil, fmt.Errorf("integrationKit.Name must be provided to Apply") } obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(integrationkitsResource, c.ns, *name, types.ApplyPatchType, data, "status"), &camelv1.IntegrationKit{}) + Invokes(testing.NewPatchSubresourceAction(integrationkitsResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1.IntegrationKit{}) if obj == nil { return nil, err } - return obj.(*camelv1.IntegrationKit), err + return obj.(*v1.IntegrationKit), err } diff --git a/pkg/client/camel/clientset/versioned/typed/camel/v1/fake/fake_integrationplatform.go b/pkg/client/camel/clientset/versioned/typed/camel/v1/fake/fake_integrationplatform.go index da770ebf55..5c0bab7738 100644 --- a/pkg/client/camel/clientset/versioned/typed/camel/v1/fake/fake_integrationplatform.go +++ b/pkg/client/camel/clientset/versioned/typed/camel/v1/fake/fake_integrationplatform.go @@ -24,11 +24,10 @@ import ( json "encoding/json" "fmt" - camelv1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1" - applyconfigurationcamelv1 "github.com/apache/camel-k/v2/pkg/client/camel/applyconfiguration/camel/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1" + camelv1 "github.com/apache/camel-k/v2/pkg/client/camel/applyconfiguration/camel/v1" + metav1 "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" @@ -40,25 +39,25 @@ type FakeIntegrationPlatforms struct { ns string } -var integrationplatformsResource = schema.GroupVersionResource{Group: "camel.apache.org", Version: "v1", Resource: "integrationplatforms"} +var integrationplatformsResource = v1.SchemeGroupVersion.WithResource("integrationplatforms") -var integrationplatformsKind = schema.GroupVersionKind{Group: "camel.apache.org", Version: "v1", Kind: "IntegrationPlatform"} +var integrationplatformsKind = v1.SchemeGroupVersion.WithKind("IntegrationPlatform") // Get takes name of the integrationPlatform, and returns the corresponding integrationPlatform object, and an error if there is any. -func (c *FakeIntegrationPlatforms) Get(ctx context.Context, name string, options v1.GetOptions) (result *camelv1.IntegrationPlatform, err error) { +func (c *FakeIntegrationPlatforms) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.IntegrationPlatform, err error) { obj, err := c.Fake. - Invokes(testing.NewGetAction(integrationplatformsResource, c.ns, name), &camelv1.IntegrationPlatform{}) + Invokes(testing.NewGetAction(integrationplatformsResource, c.ns, name), &v1.IntegrationPlatform{}) if obj == nil { return nil, err } - return obj.(*camelv1.IntegrationPlatform), err + return obj.(*v1.IntegrationPlatform), err } // List takes label and field selectors, and returns the list of IntegrationPlatforms that match those selectors. -func (c *FakeIntegrationPlatforms) List(ctx context.Context, opts v1.ListOptions) (result *camelv1.IntegrationPlatformList, err error) { +func (c *FakeIntegrationPlatforms) List(ctx context.Context, opts metav1.ListOptions) (result *v1.IntegrationPlatformList, err error) { obj, err := c.Fake. - Invokes(testing.NewListAction(integrationplatformsResource, integrationplatformsKind, c.ns, opts), &camelv1.IntegrationPlatformList{}) + Invokes(testing.NewListAction(integrationplatformsResource, integrationplatformsKind, c.ns, opts), &v1.IntegrationPlatformList{}) if obj == nil { return nil, err @@ -68,8 +67,8 @@ func (c *FakeIntegrationPlatforms) List(ctx context.Context, opts v1.ListOptions if label == nil { label = labels.Everything() } - list := &camelv1.IntegrationPlatformList{ListMeta: obj.(*camelv1.IntegrationPlatformList).ListMeta} - for _, item := range obj.(*camelv1.IntegrationPlatformList).Items { + list := &v1.IntegrationPlatformList{ListMeta: obj.(*v1.IntegrationPlatformList).ListMeta} + for _, item := range obj.(*v1.IntegrationPlatformList).Items { if label.Matches(labels.Set(item.Labels)) { list.Items = append(list.Items, item) } @@ -78,75 +77,75 @@ func (c *FakeIntegrationPlatforms) List(ctx context.Context, opts v1.ListOptions } // Watch returns a watch.Interface that watches the requested integrationPlatforms. -func (c *FakeIntegrationPlatforms) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { +func (c *FakeIntegrationPlatforms) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { return c.Fake. InvokesWatch(testing.NewWatchAction(integrationplatformsResource, c.ns, opts)) } // Create takes the representation of a integrationPlatform and creates it. Returns the server's representation of the integrationPlatform, and an error, if there is any. -func (c *FakeIntegrationPlatforms) Create(ctx context.Context, integrationPlatform *camelv1.IntegrationPlatform, opts v1.CreateOptions) (result *camelv1.IntegrationPlatform, err error) { +func (c *FakeIntegrationPlatforms) Create(ctx context.Context, integrationPlatform *v1.IntegrationPlatform, opts metav1.CreateOptions) (result *v1.IntegrationPlatform, err error) { obj, err := c.Fake. - Invokes(testing.NewCreateAction(integrationplatformsResource, c.ns, integrationPlatform), &camelv1.IntegrationPlatform{}) + Invokes(testing.NewCreateAction(integrationplatformsResource, c.ns, integrationPlatform), &v1.IntegrationPlatform{}) if obj == nil { return nil, err } - return obj.(*camelv1.IntegrationPlatform), err + return obj.(*v1.IntegrationPlatform), err } // Update takes the representation of a integrationPlatform and updates it. Returns the server's representation of the integrationPlatform, and an error, if there is any. -func (c *FakeIntegrationPlatforms) Update(ctx context.Context, integrationPlatform *camelv1.IntegrationPlatform, opts v1.UpdateOptions) (result *camelv1.IntegrationPlatform, err error) { +func (c *FakeIntegrationPlatforms) Update(ctx context.Context, integrationPlatform *v1.IntegrationPlatform, opts metav1.UpdateOptions) (result *v1.IntegrationPlatform, err error) { obj, err := c.Fake. - Invokes(testing.NewUpdateAction(integrationplatformsResource, c.ns, integrationPlatform), &camelv1.IntegrationPlatform{}) + Invokes(testing.NewUpdateAction(integrationplatformsResource, c.ns, integrationPlatform), &v1.IntegrationPlatform{}) if obj == nil { return nil, err } - return obj.(*camelv1.IntegrationPlatform), err + return obj.(*v1.IntegrationPlatform), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeIntegrationPlatforms) UpdateStatus(ctx context.Context, integrationPlatform *camelv1.IntegrationPlatform, opts v1.UpdateOptions) (*camelv1.IntegrationPlatform, error) { +func (c *FakeIntegrationPlatforms) UpdateStatus(ctx context.Context, integrationPlatform *v1.IntegrationPlatform, opts metav1.UpdateOptions) (*v1.IntegrationPlatform, error) { obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(integrationplatformsResource, "status", c.ns, integrationPlatform), &camelv1.IntegrationPlatform{}) + Invokes(testing.NewUpdateSubresourceAction(integrationplatformsResource, "status", c.ns, integrationPlatform), &v1.IntegrationPlatform{}) if obj == nil { return nil, err } - return obj.(*camelv1.IntegrationPlatform), err + return obj.(*v1.IntegrationPlatform), err } // Delete takes name of the integrationPlatform and deletes it. Returns an error if one occurs. -func (c *FakeIntegrationPlatforms) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { +func (c *FakeIntegrationPlatforms) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(integrationplatformsResource, c.ns, name, opts), &camelv1.IntegrationPlatform{}) + Invokes(testing.NewDeleteActionWithOptions(integrationplatformsResource, c.ns, name, opts), &v1.IntegrationPlatform{}) return err } // DeleteCollection deletes a collection of objects. -func (c *FakeIntegrationPlatforms) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { +func (c *FakeIntegrationPlatforms) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { action := testing.NewDeleteCollectionAction(integrationplatformsResource, c.ns, listOpts) - _, err := c.Fake.Invokes(action, &camelv1.IntegrationPlatformList{}) + _, err := c.Fake.Invokes(action, &v1.IntegrationPlatformList{}) return err } // Patch applies the patch and returns the patched integrationPlatform. -func (c *FakeIntegrationPlatforms) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *camelv1.IntegrationPlatform, err error) { +func (c *FakeIntegrationPlatforms) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.IntegrationPlatform, err error) { obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(integrationplatformsResource, c.ns, name, pt, data, subresources...), &camelv1.IntegrationPlatform{}) + Invokes(testing.NewPatchSubresourceAction(integrationplatformsResource, c.ns, name, pt, data, subresources...), &v1.IntegrationPlatform{}) if obj == nil { return nil, err } - return obj.(*camelv1.IntegrationPlatform), err + return obj.(*v1.IntegrationPlatform), err } // Apply takes the given apply declarative configuration, applies it and returns the applied integrationPlatform. -func (c *FakeIntegrationPlatforms) Apply(ctx context.Context, integrationPlatform *applyconfigurationcamelv1.IntegrationPlatformApplyConfiguration, opts v1.ApplyOptions) (result *camelv1.IntegrationPlatform, err error) { +func (c *FakeIntegrationPlatforms) Apply(ctx context.Context, integrationPlatform *camelv1.IntegrationPlatformApplyConfiguration, opts metav1.ApplyOptions) (result *v1.IntegrationPlatform, err error) { if integrationPlatform == nil { return nil, fmt.Errorf("integrationPlatform provided to Apply must not be nil") } @@ -159,17 +158,17 @@ func (c *FakeIntegrationPlatforms) Apply(ctx context.Context, integrationPlatfor return nil, fmt.Errorf("integrationPlatform.Name must be provided to Apply") } obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(integrationplatformsResource, c.ns, *name, types.ApplyPatchType, data), &camelv1.IntegrationPlatform{}) + Invokes(testing.NewPatchSubresourceAction(integrationplatformsResource, c.ns, *name, types.ApplyPatchType, data), &v1.IntegrationPlatform{}) if obj == nil { return nil, err } - return obj.(*camelv1.IntegrationPlatform), err + return obj.(*v1.IntegrationPlatform), err } // ApplyStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). -func (c *FakeIntegrationPlatforms) ApplyStatus(ctx context.Context, integrationPlatform *applyconfigurationcamelv1.IntegrationPlatformApplyConfiguration, opts v1.ApplyOptions) (result *camelv1.IntegrationPlatform, err error) { +func (c *FakeIntegrationPlatforms) ApplyStatus(ctx context.Context, integrationPlatform *camelv1.IntegrationPlatformApplyConfiguration, opts metav1.ApplyOptions) (result *v1.IntegrationPlatform, err error) { if integrationPlatform == nil { return nil, fmt.Errorf("integrationPlatform provided to Apply must not be nil") } @@ -182,10 +181,10 @@ func (c *FakeIntegrationPlatforms) ApplyStatus(ctx context.Context, integrationP return nil, fmt.Errorf("integrationPlatform.Name must be provided to Apply") } obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(integrationplatformsResource, c.ns, *name, types.ApplyPatchType, data, "status"), &camelv1.IntegrationPlatform{}) + Invokes(testing.NewPatchSubresourceAction(integrationplatformsResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1.IntegrationPlatform{}) if obj == nil { return nil, err } - return obj.(*camelv1.IntegrationPlatform), err + return obj.(*v1.IntegrationPlatform), err } diff --git a/pkg/client/camel/clientset/versioned/typed/camel/v1/fake/fake_kamelet.go b/pkg/client/camel/clientset/versioned/typed/camel/v1/fake/fake_kamelet.go index 87d34f2abb..cfffd7384c 100644 --- a/pkg/client/camel/clientset/versioned/typed/camel/v1/fake/fake_kamelet.go +++ b/pkg/client/camel/clientset/versioned/typed/camel/v1/fake/fake_kamelet.go @@ -24,11 +24,10 @@ import ( json "encoding/json" "fmt" - camelv1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1" - applyconfigurationcamelv1 "github.com/apache/camel-k/v2/pkg/client/camel/applyconfiguration/camel/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1" + camelv1 "github.com/apache/camel-k/v2/pkg/client/camel/applyconfiguration/camel/v1" + metav1 "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" @@ -40,25 +39,25 @@ type FakeKamelets struct { ns string } -var kameletsResource = schema.GroupVersionResource{Group: "camel.apache.org", Version: "v1", Resource: "kamelets"} +var kameletsResource = v1.SchemeGroupVersion.WithResource("kamelets") -var kameletsKind = schema.GroupVersionKind{Group: "camel.apache.org", Version: "v1", Kind: "Kamelet"} +var kameletsKind = v1.SchemeGroupVersion.WithKind("Kamelet") // Get takes name of the kamelet, and returns the corresponding kamelet object, and an error if there is any. -func (c *FakeKamelets) Get(ctx context.Context, name string, options v1.GetOptions) (result *camelv1.Kamelet, err error) { +func (c *FakeKamelets) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Kamelet, err error) { obj, err := c.Fake. - Invokes(testing.NewGetAction(kameletsResource, c.ns, name), &camelv1.Kamelet{}) + Invokes(testing.NewGetAction(kameletsResource, c.ns, name), &v1.Kamelet{}) if obj == nil { return nil, err } - return obj.(*camelv1.Kamelet), err + return obj.(*v1.Kamelet), err } // List takes label and field selectors, and returns the list of Kamelets that match those selectors. -func (c *FakeKamelets) List(ctx context.Context, opts v1.ListOptions) (result *camelv1.KameletList, err error) { +func (c *FakeKamelets) List(ctx context.Context, opts metav1.ListOptions) (result *v1.KameletList, err error) { obj, err := c.Fake. - Invokes(testing.NewListAction(kameletsResource, kameletsKind, c.ns, opts), &camelv1.KameletList{}) + Invokes(testing.NewListAction(kameletsResource, kameletsKind, c.ns, opts), &v1.KameletList{}) if obj == nil { return nil, err @@ -68,8 +67,8 @@ func (c *FakeKamelets) List(ctx context.Context, opts v1.ListOptions) (result *c if label == nil { label = labels.Everything() } - list := &camelv1.KameletList{ListMeta: obj.(*camelv1.KameletList).ListMeta} - for _, item := range obj.(*camelv1.KameletList).Items { + list := &v1.KameletList{ListMeta: obj.(*v1.KameletList).ListMeta} + for _, item := range obj.(*v1.KameletList).Items { if label.Matches(labels.Set(item.Labels)) { list.Items = append(list.Items, item) } @@ -78,75 +77,75 @@ func (c *FakeKamelets) List(ctx context.Context, opts v1.ListOptions) (result *c } // Watch returns a watch.Interface that watches the requested kamelets. -func (c *FakeKamelets) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { +func (c *FakeKamelets) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { return c.Fake. InvokesWatch(testing.NewWatchAction(kameletsResource, c.ns, opts)) } // Create takes the representation of a kamelet and creates it. Returns the server's representation of the kamelet, and an error, if there is any. -func (c *FakeKamelets) Create(ctx context.Context, kamelet *camelv1.Kamelet, opts v1.CreateOptions) (result *camelv1.Kamelet, err error) { +func (c *FakeKamelets) Create(ctx context.Context, kamelet *v1.Kamelet, opts metav1.CreateOptions) (result *v1.Kamelet, err error) { obj, err := c.Fake. - Invokes(testing.NewCreateAction(kameletsResource, c.ns, kamelet), &camelv1.Kamelet{}) + Invokes(testing.NewCreateAction(kameletsResource, c.ns, kamelet), &v1.Kamelet{}) if obj == nil { return nil, err } - return obj.(*camelv1.Kamelet), err + return obj.(*v1.Kamelet), err } // Update takes the representation of a kamelet and updates it. Returns the server's representation of the kamelet, and an error, if there is any. -func (c *FakeKamelets) Update(ctx context.Context, kamelet *camelv1.Kamelet, opts v1.UpdateOptions) (result *camelv1.Kamelet, err error) { +func (c *FakeKamelets) Update(ctx context.Context, kamelet *v1.Kamelet, opts metav1.UpdateOptions) (result *v1.Kamelet, err error) { obj, err := c.Fake. - Invokes(testing.NewUpdateAction(kameletsResource, c.ns, kamelet), &camelv1.Kamelet{}) + Invokes(testing.NewUpdateAction(kameletsResource, c.ns, kamelet), &v1.Kamelet{}) if obj == nil { return nil, err } - return obj.(*camelv1.Kamelet), err + return obj.(*v1.Kamelet), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeKamelets) UpdateStatus(ctx context.Context, kamelet *camelv1.Kamelet, opts v1.UpdateOptions) (*camelv1.Kamelet, error) { +func (c *FakeKamelets) UpdateStatus(ctx context.Context, kamelet *v1.Kamelet, opts metav1.UpdateOptions) (*v1.Kamelet, error) { obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(kameletsResource, "status", c.ns, kamelet), &camelv1.Kamelet{}) + Invokes(testing.NewUpdateSubresourceAction(kameletsResource, "status", c.ns, kamelet), &v1.Kamelet{}) if obj == nil { return nil, err } - return obj.(*camelv1.Kamelet), err + return obj.(*v1.Kamelet), err } // Delete takes name of the kamelet and deletes it. Returns an error if one occurs. -func (c *FakeKamelets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { +func (c *FakeKamelets) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(kameletsResource, c.ns, name, opts), &camelv1.Kamelet{}) + Invokes(testing.NewDeleteActionWithOptions(kameletsResource, c.ns, name, opts), &v1.Kamelet{}) return err } // DeleteCollection deletes a collection of objects. -func (c *FakeKamelets) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { +func (c *FakeKamelets) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { action := testing.NewDeleteCollectionAction(kameletsResource, c.ns, listOpts) - _, err := c.Fake.Invokes(action, &camelv1.KameletList{}) + _, err := c.Fake.Invokes(action, &v1.KameletList{}) return err } // Patch applies the patch and returns the patched kamelet. -func (c *FakeKamelets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *camelv1.Kamelet, err error) { +func (c *FakeKamelets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Kamelet, err error) { obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(kameletsResource, c.ns, name, pt, data, subresources...), &camelv1.Kamelet{}) + Invokes(testing.NewPatchSubresourceAction(kameletsResource, c.ns, name, pt, data, subresources...), &v1.Kamelet{}) if obj == nil { return nil, err } - return obj.(*camelv1.Kamelet), err + return obj.(*v1.Kamelet), err } // Apply takes the given apply declarative configuration, applies it and returns the applied kamelet. -func (c *FakeKamelets) Apply(ctx context.Context, kamelet *applyconfigurationcamelv1.KameletApplyConfiguration, opts v1.ApplyOptions) (result *camelv1.Kamelet, err error) { +func (c *FakeKamelets) Apply(ctx context.Context, kamelet *camelv1.KameletApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Kamelet, err error) { if kamelet == nil { return nil, fmt.Errorf("kamelet provided to Apply must not be nil") } @@ -159,17 +158,17 @@ func (c *FakeKamelets) Apply(ctx context.Context, kamelet *applyconfigurationcam return nil, fmt.Errorf("kamelet.Name must be provided to Apply") } obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(kameletsResource, c.ns, *name, types.ApplyPatchType, data), &camelv1.Kamelet{}) + Invokes(testing.NewPatchSubresourceAction(kameletsResource, c.ns, *name, types.ApplyPatchType, data), &v1.Kamelet{}) if obj == nil { return nil, err } - return obj.(*camelv1.Kamelet), err + return obj.(*v1.Kamelet), err } // ApplyStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). -func (c *FakeKamelets) ApplyStatus(ctx context.Context, kamelet *applyconfigurationcamelv1.KameletApplyConfiguration, opts v1.ApplyOptions) (result *camelv1.Kamelet, err error) { +func (c *FakeKamelets) ApplyStatus(ctx context.Context, kamelet *camelv1.KameletApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Kamelet, err error) { if kamelet == nil { return nil, fmt.Errorf("kamelet provided to Apply must not be nil") } @@ -182,10 +181,10 @@ func (c *FakeKamelets) ApplyStatus(ctx context.Context, kamelet *applyconfigurat return nil, fmt.Errorf("kamelet.Name must be provided to Apply") } obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(kameletsResource, c.ns, *name, types.ApplyPatchType, data, "status"), &camelv1.Kamelet{}) + Invokes(testing.NewPatchSubresourceAction(kameletsResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1.Kamelet{}) if obj == nil { return nil, err } - return obj.(*camelv1.Kamelet), err + return obj.(*v1.Kamelet), err } diff --git a/pkg/client/camel/clientset/versioned/typed/camel/v1/fake/fake_pipe.go b/pkg/client/camel/clientset/versioned/typed/camel/v1/fake/fake_pipe.go index bf67a45cb1..58a88b7846 100644 --- a/pkg/client/camel/clientset/versioned/typed/camel/v1/fake/fake_pipe.go +++ b/pkg/client/camel/clientset/versioned/typed/camel/v1/fake/fake_pipe.go @@ -24,12 +24,11 @@ import ( json "encoding/json" "fmt" - camelv1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1" - applyconfigurationcamelv1 "github.com/apache/camel-k/v2/pkg/client/camel/applyconfiguration/camel/v1" + v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1" + camelv1 "github.com/apache/camel-k/v2/pkg/client/camel/applyconfiguration/camel/v1" autoscalingv1 "k8s.io/api/autoscaling/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + metav1 "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" @@ -41,25 +40,25 @@ type FakePipes struct { ns string } -var pipesResource = schema.GroupVersionResource{Group: "camel.apache.org", Version: "v1", Resource: "pipes"} +var pipesResource = v1.SchemeGroupVersion.WithResource("pipes") -var pipesKind = schema.GroupVersionKind{Group: "camel.apache.org", Version: "v1", Kind: "Pipe"} +var pipesKind = v1.SchemeGroupVersion.WithKind("Pipe") // Get takes name of the pipe, and returns the corresponding pipe object, and an error if there is any. -func (c *FakePipes) Get(ctx context.Context, name string, options v1.GetOptions) (result *camelv1.Pipe, err error) { +func (c *FakePipes) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.Pipe, err error) { obj, err := c.Fake. - Invokes(testing.NewGetAction(pipesResource, c.ns, name), &camelv1.Pipe{}) + Invokes(testing.NewGetAction(pipesResource, c.ns, name), &v1.Pipe{}) if obj == nil { return nil, err } - return obj.(*camelv1.Pipe), err + return obj.(*v1.Pipe), err } // List takes label and field selectors, and returns the list of Pipes that match those selectors. -func (c *FakePipes) List(ctx context.Context, opts v1.ListOptions) (result *camelv1.PipeList, err error) { +func (c *FakePipes) List(ctx context.Context, opts metav1.ListOptions) (result *v1.PipeList, err error) { obj, err := c.Fake. - Invokes(testing.NewListAction(pipesResource, pipesKind, c.ns, opts), &camelv1.PipeList{}) + Invokes(testing.NewListAction(pipesResource, pipesKind, c.ns, opts), &v1.PipeList{}) if obj == nil { return nil, err @@ -69,8 +68,8 @@ func (c *FakePipes) List(ctx context.Context, opts v1.ListOptions) (result *came if label == nil { label = labels.Everything() } - list := &camelv1.PipeList{ListMeta: obj.(*camelv1.PipeList).ListMeta} - for _, item := range obj.(*camelv1.PipeList).Items { + list := &v1.PipeList{ListMeta: obj.(*v1.PipeList).ListMeta} + for _, item := range obj.(*v1.PipeList).Items { if label.Matches(labels.Set(item.Labels)) { list.Items = append(list.Items, item) } @@ -79,75 +78,75 @@ func (c *FakePipes) List(ctx context.Context, opts v1.ListOptions) (result *came } // Watch returns a watch.Interface that watches the requested pipes. -func (c *FakePipes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { +func (c *FakePipes) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { return c.Fake. InvokesWatch(testing.NewWatchAction(pipesResource, c.ns, opts)) } // Create takes the representation of a pipe and creates it. Returns the server's representation of the pipe, and an error, if there is any. -func (c *FakePipes) Create(ctx context.Context, pipe *camelv1.Pipe, opts v1.CreateOptions) (result *camelv1.Pipe, err error) { +func (c *FakePipes) Create(ctx context.Context, pipe *v1.Pipe, opts metav1.CreateOptions) (result *v1.Pipe, err error) { obj, err := c.Fake. - Invokes(testing.NewCreateAction(pipesResource, c.ns, pipe), &camelv1.Pipe{}) + Invokes(testing.NewCreateAction(pipesResource, c.ns, pipe), &v1.Pipe{}) if obj == nil { return nil, err } - return obj.(*camelv1.Pipe), err + return obj.(*v1.Pipe), err } // Update takes the representation of a pipe and updates it. Returns the server's representation of the pipe, and an error, if there is any. -func (c *FakePipes) Update(ctx context.Context, pipe *camelv1.Pipe, opts v1.UpdateOptions) (result *camelv1.Pipe, err error) { +func (c *FakePipes) Update(ctx context.Context, pipe *v1.Pipe, opts metav1.UpdateOptions) (result *v1.Pipe, err error) { obj, err := c.Fake. - Invokes(testing.NewUpdateAction(pipesResource, c.ns, pipe), &camelv1.Pipe{}) + Invokes(testing.NewUpdateAction(pipesResource, c.ns, pipe), &v1.Pipe{}) if obj == nil { return nil, err } - return obj.(*camelv1.Pipe), err + return obj.(*v1.Pipe), err } // UpdateStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakePipes) UpdateStatus(ctx context.Context, pipe *camelv1.Pipe, opts v1.UpdateOptions) (*camelv1.Pipe, error) { +func (c *FakePipes) UpdateStatus(ctx context.Context, pipe *v1.Pipe, opts metav1.UpdateOptions) (*v1.Pipe, error) { obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(pipesResource, "status", c.ns, pipe), &camelv1.Pipe{}) + Invokes(testing.NewUpdateSubresourceAction(pipesResource, "status", c.ns, pipe), &v1.Pipe{}) if obj == nil { return nil, err } - return obj.(*camelv1.Pipe), err + return obj.(*v1.Pipe), err } // Delete takes name of the pipe and deletes it. Returns an error if one occurs. -func (c *FakePipes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { +func (c *FakePipes) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(pipesResource, c.ns, name, opts), &camelv1.Pipe{}) + Invokes(testing.NewDeleteActionWithOptions(pipesResource, c.ns, name, opts), &v1.Pipe{}) return err } // DeleteCollection deletes a collection of objects. -func (c *FakePipes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { +func (c *FakePipes) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { action := testing.NewDeleteCollectionAction(pipesResource, c.ns, listOpts) - _, err := c.Fake.Invokes(action, &camelv1.PipeList{}) + _, err := c.Fake.Invokes(action, &v1.PipeList{}) return err } // Patch applies the patch and returns the patched pipe. -func (c *FakePipes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *camelv1.Pipe, err error) { +func (c *FakePipes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Pipe, err error) { obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(pipesResource, c.ns, name, pt, data, subresources...), &camelv1.Pipe{}) + Invokes(testing.NewPatchSubresourceAction(pipesResource, c.ns, name, pt, data, subresources...), &v1.Pipe{}) if obj == nil { return nil, err } - return obj.(*camelv1.Pipe), err + return obj.(*v1.Pipe), err } // Apply takes the given apply declarative configuration, applies it and returns the applied pipe. -func (c *FakePipes) Apply(ctx context.Context, pipe *applyconfigurationcamelv1.PipeApplyConfiguration, opts v1.ApplyOptions) (result *camelv1.Pipe, err error) { +func (c *FakePipes) Apply(ctx context.Context, pipe *camelv1.PipeApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Pipe, err error) { if pipe == nil { return nil, fmt.Errorf("pipe provided to Apply must not be nil") } @@ -160,17 +159,17 @@ func (c *FakePipes) Apply(ctx context.Context, pipe *applyconfigurationcamelv1.P return nil, fmt.Errorf("pipe.Name must be provided to Apply") } obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(pipesResource, c.ns, *name, types.ApplyPatchType, data), &camelv1.Pipe{}) + Invokes(testing.NewPatchSubresourceAction(pipesResource, c.ns, *name, types.ApplyPatchType, data), &v1.Pipe{}) if obj == nil { return nil, err } - return obj.(*camelv1.Pipe), err + return obj.(*v1.Pipe), err } // ApplyStatus was generated because the type contains a Status member. // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). -func (c *FakePipes) ApplyStatus(ctx context.Context, pipe *applyconfigurationcamelv1.PipeApplyConfiguration, opts v1.ApplyOptions) (result *camelv1.Pipe, err error) { +func (c *FakePipes) ApplyStatus(ctx context.Context, pipe *camelv1.PipeApplyConfiguration, opts metav1.ApplyOptions) (result *v1.Pipe, err error) { if pipe == nil { return nil, fmt.Errorf("pipe provided to Apply must not be nil") } @@ -183,16 +182,16 @@ func (c *FakePipes) ApplyStatus(ctx context.Context, pipe *applyconfigurationcam return nil, fmt.Errorf("pipe.Name must be provided to Apply") } obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(pipesResource, c.ns, *name, types.ApplyPatchType, data, "status"), &camelv1.Pipe{}) + Invokes(testing.NewPatchSubresourceAction(pipesResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1.Pipe{}) if obj == nil { return nil, err } - return obj.(*camelv1.Pipe), err + return obj.(*v1.Pipe), err } // GetScale takes name of the pipe, and returns the corresponding scale object, and an error if there is any. -func (c *FakePipes) GetScale(ctx context.Context, pipeName string, options v1.GetOptions) (result *autoscalingv1.Scale, err error) { +func (c *FakePipes) GetScale(ctx context.Context, pipeName string, options metav1.GetOptions) (result *autoscalingv1.Scale, err error) { obj, err := c.Fake. Invokes(testing.NewGetSubresourceAction(pipesResource, c.ns, "scale", pipeName), &autoscalingv1.Scale{}) @@ -203,7 +202,7 @@ func (c *FakePipes) GetScale(ctx context.Context, pipeName string, options v1.Ge } // UpdateScale takes the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any. -func (c *FakePipes) UpdateScale(ctx context.Context, pipeName string, scale *autoscalingv1.Scale, opts v1.UpdateOptions) (result *autoscalingv1.Scale, err error) { +func (c *FakePipes) UpdateScale(ctx context.Context, pipeName string, scale *autoscalingv1.Scale, opts metav1.UpdateOptions) (result *autoscalingv1.Scale, err error) { obj, err := c.Fake. Invokes(testing.NewUpdateSubresourceAction(pipesResource, "scale", c.ns, scale), &autoscalingv1.Scale{}) diff --git a/pkg/client/camel/clientset/versioned/typed/camel/v1alpha1/fake/fake_kamelet.go b/pkg/client/camel/clientset/versioned/typed/camel/v1alpha1/fake/fake_kamelet.go index c9142ede7d..54e97a6b79 100644 --- a/pkg/client/camel/clientset/versioned/typed/camel/v1alpha1/fake/fake_kamelet.go +++ b/pkg/client/camel/clientset/versioned/typed/camel/v1alpha1/fake/fake_kamelet.go @@ -28,7 +28,6 @@ import ( camelv1alpha1 "github.com/apache/camel-k/v2/pkg/client/camel/applyconfiguration/camel/v1alpha1" 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" @@ -40,9 +39,9 @@ type FakeKamelets struct { ns string } -var kameletsResource = schema.GroupVersionResource{Group: "camel.apache.org", Version: "v1alpha1", Resource: "kamelets"} +var kameletsResource = v1alpha1.SchemeGroupVersion.WithResource("kamelets") -var kameletsKind = schema.GroupVersionKind{Group: "camel.apache.org", Version: "v1alpha1", Kind: "Kamelet"} +var kameletsKind = v1alpha1.SchemeGroupVersion.WithKind("Kamelet") // Get takes name of the kamelet, and returns the corresponding kamelet object, and an error if there is any. func (c *FakeKamelets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Kamelet, err error) { diff --git a/pkg/client/camel/clientset/versioned/typed/camel/v1alpha1/fake/fake_kameletbinding.go b/pkg/client/camel/clientset/versioned/typed/camel/v1alpha1/fake/fake_kameletbinding.go index 3023497b72..5a0c5c643a 100644 --- a/pkg/client/camel/clientset/versioned/typed/camel/v1alpha1/fake/fake_kameletbinding.go +++ b/pkg/client/camel/clientset/versioned/typed/camel/v1alpha1/fake/fake_kameletbinding.go @@ -29,7 +29,6 @@ import ( autoscalingv1 "k8s.io/api/autoscaling/v1" 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" @@ -41,9 +40,9 @@ type FakeKameletBindings struct { ns string } -var kameletbindingsResource = schema.GroupVersionResource{Group: "camel.apache.org", Version: "v1alpha1", Resource: "kameletbindings"} +var kameletbindingsResource = v1alpha1.SchemeGroupVersion.WithResource("kameletbindings") -var kameletbindingsKind = schema.GroupVersionKind{Group: "camel.apache.org", Version: "v1alpha1", Kind: "KameletBinding"} +var kameletbindingsKind = v1alpha1.SchemeGroupVersion.WithKind("KameletBinding") // Get takes name of the kameletBinding, and returns the corresponding kameletBinding object, and an error if there is any. func (c *FakeKameletBindings) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.KameletBinding, err error) { diff --git a/pkg/client/camel/informers/externalversions/factory.go b/pkg/client/camel/informers/externalversions/factory.go index 26b69c03f4..24c38b49a0 100644 --- a/pkg/client/camel/informers/externalversions/factory.go +++ b/pkg/client/camel/informers/externalversions/factory.go @@ -48,6 +48,11 @@ type sharedInformerFactory struct { // startedInformers is used for tracking which informers have been started. // This allows Start() to be called multiple times safely. startedInformers map[reflect.Type]bool + // wg tracks how many goroutines were started. + wg sync.WaitGroup + // shuttingDown is true when Shutdown has been called. It may still be running + // because it needs to wait for goroutines. + shuttingDown bool } // WithCustomResyncConfig sets a custom resync period for the specified informer types. @@ -108,20 +113,39 @@ func NewSharedInformerFactoryWithOptions(client versioned.Interface, defaultResy return factory } -// Start initializes all requested informers. func (f *sharedInformerFactory) Start(stopCh <-chan struct{}) { f.lock.Lock() defer f.lock.Unlock() + if f.shuttingDown { + return + } + for informerType, informer := range f.informers { if !f.startedInformers[informerType] { - go informer.Run(stopCh) + f.wg.Add(1) + // We need a new variable in each loop iteration, + // otherwise the goroutine would use the loop variable + // and that keeps changing. + informer := informer + go func() { + defer f.wg.Done() + informer.Run(stopCh) + }() f.startedInformers[informerType] = true } } } -// WaitForCacheSync waits for all started informers' cache were synced. +func (f *sharedInformerFactory) Shutdown() { + f.lock.Lock() + f.shuttingDown = true + f.lock.Unlock() + + // Will return immediately if there is nothing to wait for. + f.wg.Wait() +} + func (f *sharedInformerFactory) WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool { informers := func() map[reflect.Type]cache.SharedIndexInformer { f.lock.Lock() @@ -168,11 +192,58 @@ func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internal // SharedInformerFactory provides shared informers for resources in all known // API group versions. +// +// It is typically used like this: +// +// ctx, cancel := context.Background() +// defer cancel() +// factory := NewSharedInformerFactory(client, resyncPeriod) +// defer factory.WaitForStop() // Returns immediately if nothing was started. +// genericInformer := factory.ForResource(resource) +// typedInformer := factory.SomeAPIGroup().V1().SomeType() +// factory.Start(ctx.Done()) // Start processing these informers. +// synced := factory.WaitForCacheSync(ctx.Done()) +// for v, ok := range synced { +// if !ok { +// fmt.Fprintf(os.Stderr, "caches failed to sync: %v", v) +// return +// } +// } +// +// // Creating informers can also be created after Start, but then +// // Start must be called again: +// anotherGenericInformer := factory.ForResource(resource) +// factory.Start(ctx.Done()) type SharedInformerFactory interface { internalinterfaces.SharedInformerFactory - ForResource(resource schema.GroupVersionResource) (GenericInformer, error) + + // Start initializes all requested informers. They are handled in goroutines + // which run until the stop channel gets closed. + Start(stopCh <-chan struct{}) + + // Shutdown marks a factory as shutting down. At that point no new + // informers can be started anymore and Start will return without + // doing anything. + // + // In addition, Shutdown blocks until all goroutines have terminated. For that + // to happen, the close channel(s) that they were started with must be closed, + // either before Shutdown gets called or while it is waiting. + // + // Shutdown may be called multiple times, even concurrently. All such calls will + // block until all goroutines have terminated. + Shutdown() + + // WaitForCacheSync blocks until all started informers' caches were synced + // or the stop channel gets closed. WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool + // ForResource gives generic access to a shared informer of the matching type. + ForResource(resource schema.GroupVersionResource) (GenericInformer, error) + + // InternalInformerFor returns the SharedIndexInformer for obj using an internal + // client. + InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer + Camel() camel.Interface } diff --git a/script/Makefile b/script/Makefile index 8195c22c19..be982ff024 100644 --- a/script/Makefile +++ b/script/Makefile @@ -27,7 +27,7 @@ DEFAULT_RUNTIME_VERSION := 2.16.0 BUILDAH_VERSION := 1.30.0 KANIKO_VERSION := 1.9.1 CONTROLLER_GEN_VERSION := v0.6.1 -CODEGEN_VERSION := v0.25.6 +CODEGEN_VERSION := v0.27.4 OPERATOR_SDK_VERSION := v1.28.0 KUSTOMIZE_VERSION := v4.5.4 OPM_VERSION := v1.24.0 @@ -220,8 +220,7 @@ codegen-tools-install: controller-gen @# We must force the installation to make sure we are using the correct version @# Note: as there is no --version in the tools, we cannot rely on cached local versions @echo "Installing k8s.io/code-generator tools with version $(CODEGEN_VERSION)" - #go install k8s.io/code-generator/cmd/applyconfiguration-gen@$(CODEGEN_VERSION) - go install github.com/astefanutti/code-generator/cmd/applyconfiguration-gen@pr-144-install + go install k8s.io/code-generator/cmd/applyconfiguration-gen@$(CODEGEN_VERSION) go install k8s.io/code-generator/cmd/client-gen@$(CODEGEN_VERSION) go install k8s.io/code-generator/cmd/lister-gen@$(CODEGEN_VERSION) go install k8s.io/code-generator/cmd/informer-gen@$(CODEGEN_VERSION)