From 9b420206109a497ce2cd23af13f985b330db35bc Mon Sep 17 00:00:00 2001 From: caliskanugur Date: Fri, 25 Oct 2024 10:51:45 -0400 Subject: [PATCH] Add cluster.cattle.io and rbac controllers, add missing import and sessions to the missing controllers --- pkg/codegen/generator/cleanup/main.go | 4 ++ pkg/codegen/main.go | 31 +++++++- .../controllers/catalog.cattle.io/factory.go | 6 +- .../catalog.cattle.io/interface.go | 7 +- .../controllers/catalog.cattle.io/v1/app.go | 2 +- .../catalog.cattle.io/v1/clusterrepo.go | 2 +- .../catalog.cattle.io/v1/interface.go | 13 ++-- .../catalog.cattle.io/v1/operation.go | 2 +- .../controllers/cluster.cattle.io/factory.go | 72 +++++++++++++++++++ .../cluster.cattle.io/interface.go | 46 ++++++++++++ .../cluster.cattle.io/v3/clusterauthtoken.go | 39 ++++++++++ .../v3/clusteruserattribute.go | 39 ++++++++++ .../cluster.cattle.io/v3/interface.go | 57 +++++++++++++++ .../controllers/cluster.x-k8s.io/factory.go | 6 +- .../controllers/cluster.x-k8s.io/interface.go | 7 +- .../cluster.x-k8s.io/v1beta1/cluster.go | 2 +- .../cluster.x-k8s.io/v1beta1/interface.go | 15 ++-- .../cluster.x-k8s.io/v1beta1/machine.go | 2 +- .../v1beta1/machinedeployment.go | 2 +- .../cluster.x-k8s.io/v1beta1/machineset.go | 2 +- .../controllers/fleet.cattle.io/factory.go | 6 +- .../controllers/fleet.cattle.io/interface.go | 7 +- .../fleet.cattle.io/v1alpha1/bundle.go | 2 +- .../fleet.cattle.io/v1alpha1/cluster.go | 2 +- .../fleet.cattle.io/v1alpha1/clustergroup.go | 2 +- .../fleet.cattle.io/v1alpha1/interface.go | 13 ++-- .../provisioning.cattle.io/factory.go | 6 +- .../provisioning.cattle.io/interface.go | 7 +- .../provisioning.cattle.io/v1/cluster.go | 2 +- .../provisioning.cattle.io/v1/interface.go | 9 ++- pkg/generated/controllers/rbac/factory.go | 72 +++++++++++++++++++ pkg/generated/controllers/rbac/interface.go | 46 ++++++++++++ .../controllers/rbac/v1/clusterrole.go | 39 ++++++++++ .../controllers/rbac/v1/clusterrolebinding.go | 39 ++++++++++ .../controllers/rbac/v1/interface.go | 67 +++++++++++++++++ pkg/generated/controllers/rbac/v1/role.go | 39 ++++++++++ .../controllers/rbac/v1/rolebinding.go | 39 ++++++++++ .../controllers/rke.cattle.io/factory.go | 6 +- .../controllers/rke.cattle.io/interface.go | 7 +- .../rke.cattle.io/v1/custommachine.go | 2 +- .../rke.cattle.io/v1/etcdsnapshot.go | 2 +- .../controllers/rke.cattle.io/v1/interface.go | 19 ++--- .../rke.cattle.io/v1/rkebootstrap.go | 2 +- .../rke.cattle.io/v1/rkebootstraptemplate.go | 2 +- .../rke.cattle.io/v1/rkecluster.go | 2 +- .../rke.cattle.io/v1/rkecontrolplane.go | 2 +- .../controllers/upgrade.cattle.io/factory.go | 6 +- .../upgrade.cattle.io/interface.go | 7 +- .../upgrade.cattle.io/v1/interface.go | 9 ++- .../controllers/upgrade.cattle.io/v1/plan.go | 2 +- 50 files changed, 740 insertions(+), 81 deletions(-) create mode 100644 pkg/generated/controllers/cluster.cattle.io/factory.go create mode 100644 pkg/generated/controllers/cluster.cattle.io/interface.go create mode 100644 pkg/generated/controllers/cluster.cattle.io/v3/clusterauthtoken.go create mode 100644 pkg/generated/controllers/cluster.cattle.io/v3/clusteruserattribute.go create mode 100644 pkg/generated/controllers/cluster.cattle.io/v3/interface.go create mode 100644 pkg/generated/controllers/rbac/factory.go create mode 100644 pkg/generated/controllers/rbac/interface.go create mode 100644 pkg/generated/controllers/rbac/v1/clusterrole.go create mode 100644 pkg/generated/controllers/rbac/v1/clusterrolebinding.go create mode 100644 pkg/generated/controllers/rbac/v1/interface.go create mode 100644 pkg/generated/controllers/rbac/v1/role.go create mode 100644 pkg/generated/controllers/rbac/v1/rolebinding.go diff --git a/pkg/codegen/generator/cleanup/main.go b/pkg/codegen/generator/cleanup/main.go index 53f01315..62f8daa7 100644 --- a/pkg/codegen/generator/cleanup/main.go +++ b/pkg/codegen/generator/cleanup/main.go @@ -11,6 +11,10 @@ func main() { } func run() error { + if err := os.RemoveAll("./pkg/generated"); err != nil { + return err + } + if err := os.RemoveAll("../../clients/rancher/generated"); err != nil { return err } diff --git a/pkg/codegen/main.go b/pkg/codegen/main.go index 55d0222c..f21b124c 100644 --- a/pkg/codegen/main.go +++ b/pkg/codegen/main.go @@ -28,6 +28,7 @@ import ( "github.com/rancher/wrangler/v2/pkg/controller-gen/args" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" + rbacv1 "k8s.io/api/rbac/v1" capi "sigs.k8s.io/cluster-api/api/v1beta1" ) @@ -44,9 +45,17 @@ func main() { } generatedControllerPaths := map[string]string{ - "AppsControllerPath": "./pkg/generated/controllers/apps", - "CoreControllerPath": "./pkg/generated/controllers/core", - "ManagementControllerPath": "./pkg/generated/controllers/management.cattle.io", + "AppsControllerPath": "./pkg/generated/controllers/apps", + "CoreControllerPath": "./pkg/generated/controllers/core", + "RBACControllerPath": "./pkg/generated/controllers/rbac", + "ManagementControllerPath": "./pkg/generated/controllers/management.cattle.io", + "ClusterCattleControllerPath": "./pkg/generated/controllers/cluster.cattle.io", + "CatalogCattleControllerPath": "./pkg/generated/controllers/catalog.cattle.io", + "UpgradeCattleControllerPath": "./pkg/generated/controllers/upgrade.cattle.io", + "ProvisioningCattleControllerPath": "./pkg/generated/controllers/provisioning.cattle.io", + "FleetCattleControllerPath": "./pkg/generated/controllers/fleet.cattle.io", + "RKECattleControllerPath": "./pkg/generated/controllers/rke.cattle.io", + "ClusterXK8sControllerPath": "./pkg/generated/controllers/cluster.x-k8s.io", } controllergen.Run(args.Options{ @@ -79,6 +88,15 @@ func main() { corev1.Pod{}, }, }, + rbacv1.GroupName: { + Types: []interface{}{ + rbacv1.Role{}, + rbacv1.RoleBinding{}, + rbacv1.ClusterRole{}, + rbacv1.ClusterRoleBinding{}, + }, + OutputControllerPackageName: "rbac", + }, "management.cattle.io": { PackageName: "management.cattle.io", Types: []interface{}{ @@ -88,6 +106,13 @@ func main() { managementv3.ClusterCatalog{}, }, }, + "cluster.cattle.io": { + PackageName: "cluster.cattle.io", + Types: []interface{}{ + // All structs with an embedded ObjectMeta field will be picked up + "./vendor/github.com/rancher/rancher/pkg/apis/cluster.cattle.io/v3", + }, + }, "catalog.cattle.io": { PackageName: "catalog.cattle.io", Types: []interface{}{ diff --git a/pkg/generated/controllers/catalog.cattle.io/factory.go b/pkg/generated/controllers/catalog.cattle.io/factory.go index 22878f8b..22cf27da 100644 --- a/pkg/generated/controllers/catalog.cattle.io/factory.go +++ b/pkg/generated/controllers/catalog.cattle.io/factory.go @@ -20,7 +20,7 @@ package catalog import ( "github.com/rancher/lasso/pkg/controller" - "github.com/rancher/wrangler/v2/pkg/generic" + "github.com/rancher/shepherd/pkg/wrangler/pkg/generic" "k8s.io/client-go/rest" ) @@ -64,9 +64,9 @@ func NewFactoryFromConfigWithOptionsOrDie(config *rest.Config, opts *FactoryOpti } func (c *Factory) Catalog() Interface { - return New(c.ControllerFactory()) + return New(c.ControllerFactory(), c.Opts.TS) } func (c *Factory) WithAgent(userAgent string) Interface { - return New(controller.NewSharedControllerFactoryWithAgent(userAgent, c.ControllerFactory())) + return New(controller.NewSharedControllerFactoryWithAgent(userAgent, c.ControllerFactory()), c.Opts.TS) } diff --git a/pkg/generated/controllers/catalog.cattle.io/interface.go b/pkg/generated/controllers/catalog.cattle.io/interface.go index b77b5828..38c8f1e9 100644 --- a/pkg/generated/controllers/catalog.cattle.io/interface.go +++ b/pkg/generated/controllers/catalog.cattle.io/interface.go @@ -21,6 +21,7 @@ package catalog import ( "github.com/rancher/lasso/pkg/controller" v1 "github.com/rancher/shepherd/pkg/generated/controllers/catalog.cattle.io/v1" + "github.com/rancher/shepherd/pkg/session" ) type Interface interface { @@ -29,15 +30,17 @@ type Interface interface { type group struct { controllerFactory controller.SharedControllerFactory + ts *session.Session } // New returns a new Interface. -func New(controllerFactory controller.SharedControllerFactory) Interface { +func New(controllerFactory controller.SharedControllerFactory, ts *session.Session) Interface { return &group{ controllerFactory: controllerFactory, + ts: ts, } } func (g *group) V1() v1.Interface { - return v1.New(g.controllerFactory) + return v1.New(g.controllerFactory, g.ts) } diff --git a/pkg/generated/controllers/catalog.cattle.io/v1/app.go b/pkg/generated/controllers/catalog.cattle.io/v1/app.go index 24946dbd..eb86f8bb 100644 --- a/pkg/generated/controllers/catalog.cattle.io/v1/app.go +++ b/pkg/generated/controllers/catalog.cattle.io/v1/app.go @@ -24,9 +24,9 @@ import ( "time" v1 "github.com/rancher/rancher/pkg/apis/catalog.cattle.io/v1" + "github.com/rancher/shepherd/pkg/wrangler/pkg/generic" "github.com/rancher/wrangler/v2/pkg/apply" "github.com/rancher/wrangler/v2/pkg/condition" - "github.com/rancher/wrangler/v2/pkg/generic" "github.com/rancher/wrangler/v2/pkg/kv" "k8s.io/apimachinery/pkg/api/equality" "k8s.io/apimachinery/pkg/api/errors" diff --git a/pkg/generated/controllers/catalog.cattle.io/v1/clusterrepo.go b/pkg/generated/controllers/catalog.cattle.io/v1/clusterrepo.go index e1366c7d..a47a9f08 100644 --- a/pkg/generated/controllers/catalog.cattle.io/v1/clusterrepo.go +++ b/pkg/generated/controllers/catalog.cattle.io/v1/clusterrepo.go @@ -24,9 +24,9 @@ import ( "time" v1 "github.com/rancher/rancher/pkg/apis/catalog.cattle.io/v1" + "github.com/rancher/shepherd/pkg/wrangler/pkg/generic" "github.com/rancher/wrangler/v2/pkg/apply" "github.com/rancher/wrangler/v2/pkg/condition" - "github.com/rancher/wrangler/v2/pkg/generic" "github.com/rancher/wrangler/v2/pkg/kv" "k8s.io/apimachinery/pkg/api/equality" "k8s.io/apimachinery/pkg/api/errors" diff --git a/pkg/generated/controllers/catalog.cattle.io/v1/interface.go b/pkg/generated/controllers/catalog.cattle.io/v1/interface.go index 42af7eb9..080afa6d 100644 --- a/pkg/generated/controllers/catalog.cattle.io/v1/interface.go +++ b/pkg/generated/controllers/catalog.cattle.io/v1/interface.go @@ -21,7 +21,8 @@ package v1 import ( "github.com/rancher/lasso/pkg/controller" v1 "github.com/rancher/rancher/pkg/apis/catalog.cattle.io/v1" - "github.com/rancher/wrangler/v2/pkg/generic" + "github.com/rancher/shepherd/pkg/session" + "github.com/rancher/shepherd/pkg/wrangler/pkg/generic" "github.com/rancher/wrangler/v2/pkg/schemes" "k8s.io/apimachinery/pkg/runtime/schema" ) @@ -36,24 +37,26 @@ type Interface interface { Operation() OperationController } -func New(controllerFactory controller.SharedControllerFactory) Interface { +func New(controllerFactory controller.SharedControllerFactory, ts *session.Session) Interface { return &version{ controllerFactory: controllerFactory, + ts: ts, } } type version struct { controllerFactory controller.SharedControllerFactory + ts *session.Session } func (v *version) App() AppController { - return generic.NewController[*v1.App, *v1.AppList](schema.GroupVersionKind{Group: "catalog.cattle.io", Version: "v1", Kind: "App"}, "apps", true, v.controllerFactory) + return generic.NewController[*v1.App, *v1.AppList](schema.GroupVersionKind{Group: "catalog.cattle.io", Version: "v1", Kind: "App"}, "apps", true, v.controllerFactory, v.ts) } func (v *version) ClusterRepo() ClusterRepoController { - return generic.NewNonNamespacedController[*v1.ClusterRepo, *v1.ClusterRepoList](schema.GroupVersionKind{Group: "catalog.cattle.io", Version: "v1", Kind: "ClusterRepo"}, "clusterrepos", v.controllerFactory) + return generic.NewNonNamespacedController[*v1.ClusterRepo, *v1.ClusterRepoList](schema.GroupVersionKind{Group: "catalog.cattle.io", Version: "v1", Kind: "ClusterRepo"}, "clusterrepos", v.controllerFactory, v.ts) } func (v *version) Operation() OperationController { - return generic.NewController[*v1.Operation, *v1.OperationList](schema.GroupVersionKind{Group: "catalog.cattle.io", Version: "v1", Kind: "Operation"}, "operations", true, v.controllerFactory) + return generic.NewController[*v1.Operation, *v1.OperationList](schema.GroupVersionKind{Group: "catalog.cattle.io", Version: "v1", Kind: "Operation"}, "operations", true, v.controllerFactory, v.ts) } diff --git a/pkg/generated/controllers/catalog.cattle.io/v1/operation.go b/pkg/generated/controllers/catalog.cattle.io/v1/operation.go index 5c08bb4d..72ef35cf 100644 --- a/pkg/generated/controllers/catalog.cattle.io/v1/operation.go +++ b/pkg/generated/controllers/catalog.cattle.io/v1/operation.go @@ -24,9 +24,9 @@ import ( "time" v1 "github.com/rancher/rancher/pkg/apis/catalog.cattle.io/v1" + "github.com/rancher/shepherd/pkg/wrangler/pkg/generic" "github.com/rancher/wrangler/v2/pkg/apply" "github.com/rancher/wrangler/v2/pkg/condition" - "github.com/rancher/wrangler/v2/pkg/generic" "github.com/rancher/wrangler/v2/pkg/kv" "k8s.io/apimachinery/pkg/api/equality" "k8s.io/apimachinery/pkg/api/errors" diff --git a/pkg/generated/controllers/cluster.cattle.io/factory.go b/pkg/generated/controllers/cluster.cattle.io/factory.go new file mode 100644 index 00000000..61d2c1cf --- /dev/null +++ b/pkg/generated/controllers/cluster.cattle.io/factory.go @@ -0,0 +1,72 @@ +/* +Copyright 2024 Rancher Labs, Inc. + +Licensed 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 main. DO NOT EDIT. + +package cluster + +import ( + "github.com/rancher/lasso/pkg/controller" + "github.com/rancher/shepherd/pkg/wrangler/pkg/generic" + "k8s.io/client-go/rest" +) + +type Factory struct { + *generic.Factory +} + +func NewFactoryFromConfigOrDie(config *rest.Config) *Factory { + f, err := NewFactoryFromConfig(config) + if err != nil { + panic(err) + } + return f +} + +func NewFactoryFromConfig(config *rest.Config) (*Factory, error) { + return NewFactoryFromConfigWithOptions(config, nil) +} + +func NewFactoryFromConfigWithNamespace(config *rest.Config, namespace string) (*Factory, error) { + return NewFactoryFromConfigWithOptions(config, &FactoryOptions{ + Namespace: namespace, + }) +} + +type FactoryOptions = generic.FactoryOptions + +func NewFactoryFromConfigWithOptions(config *rest.Config, opts *FactoryOptions) (*Factory, error) { + f, err := generic.NewFactoryFromConfigWithOptions(config, opts) + return &Factory{ + Factory: f, + }, err +} + +func NewFactoryFromConfigWithOptionsOrDie(config *rest.Config, opts *FactoryOptions) *Factory { + f, err := NewFactoryFromConfigWithOptions(config, opts) + if err != nil { + panic(err) + } + return f +} + +func (c *Factory) Cluster() Interface { + return New(c.ControllerFactory(), c.Opts.TS) +} + +func (c *Factory) WithAgent(userAgent string) Interface { + return New(controller.NewSharedControllerFactoryWithAgent(userAgent, c.ControllerFactory()), c.Opts.TS) +} diff --git a/pkg/generated/controllers/cluster.cattle.io/interface.go b/pkg/generated/controllers/cluster.cattle.io/interface.go new file mode 100644 index 00000000..7a8719b6 --- /dev/null +++ b/pkg/generated/controllers/cluster.cattle.io/interface.go @@ -0,0 +1,46 @@ +/* +Copyright 2024 Rancher Labs, Inc. + +Licensed 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 main. DO NOT EDIT. + +package cluster + +import ( + "github.com/rancher/lasso/pkg/controller" + v3 "github.com/rancher/shepherd/pkg/generated/controllers/cluster.cattle.io/v3" + "github.com/rancher/shepherd/pkg/session" +) + +type Interface interface { + V3() v3.Interface +} + +type group struct { + controllerFactory controller.SharedControllerFactory + ts *session.Session +} + +// New returns a new Interface. +func New(controllerFactory controller.SharedControllerFactory, ts *session.Session) Interface { + return &group{ + controllerFactory: controllerFactory, + ts: ts, + } +} + +func (g *group) V3() v3.Interface { + return v3.New(g.controllerFactory, g.ts) +} diff --git a/pkg/generated/controllers/cluster.cattle.io/v3/clusterauthtoken.go b/pkg/generated/controllers/cluster.cattle.io/v3/clusterauthtoken.go new file mode 100644 index 00000000..5dd31475 --- /dev/null +++ b/pkg/generated/controllers/cluster.cattle.io/v3/clusterauthtoken.go @@ -0,0 +1,39 @@ +/* +Copyright 2024 Rancher Labs, Inc. + +Licensed 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 main. DO NOT EDIT. + +package v3 + +import ( + v3 "github.com/rancher/rancher/pkg/apis/cluster.cattle.io/v3" + "github.com/rancher/shepherd/pkg/wrangler/pkg/generic" +) + +// ClusterAuthTokenController interface for managing ClusterAuthToken resources. +type ClusterAuthTokenController interface { + generic.ControllerInterface[*v3.ClusterAuthToken, *v3.ClusterAuthTokenList] +} + +// ClusterAuthTokenClient interface for managing ClusterAuthToken resources in Kubernetes. +type ClusterAuthTokenClient interface { + generic.ClientInterface[*v3.ClusterAuthToken, *v3.ClusterAuthTokenList] +} + +// ClusterAuthTokenCache interface for retrieving ClusterAuthToken resources in memory. +type ClusterAuthTokenCache interface { + generic.CacheInterface[*v3.ClusterAuthToken] +} diff --git a/pkg/generated/controllers/cluster.cattle.io/v3/clusteruserattribute.go b/pkg/generated/controllers/cluster.cattle.io/v3/clusteruserattribute.go new file mode 100644 index 00000000..814a59ed --- /dev/null +++ b/pkg/generated/controllers/cluster.cattle.io/v3/clusteruserattribute.go @@ -0,0 +1,39 @@ +/* +Copyright 2024 Rancher Labs, Inc. + +Licensed 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 main. DO NOT EDIT. + +package v3 + +import ( + v3 "github.com/rancher/rancher/pkg/apis/cluster.cattle.io/v3" + "github.com/rancher/shepherd/pkg/wrangler/pkg/generic" +) + +// ClusterUserAttributeController interface for managing ClusterUserAttribute resources. +type ClusterUserAttributeController interface { + generic.ControllerInterface[*v3.ClusterUserAttribute, *v3.ClusterUserAttributeList] +} + +// ClusterUserAttributeClient interface for managing ClusterUserAttribute resources in Kubernetes. +type ClusterUserAttributeClient interface { + generic.ClientInterface[*v3.ClusterUserAttribute, *v3.ClusterUserAttributeList] +} + +// ClusterUserAttributeCache interface for retrieving ClusterUserAttribute resources in memory. +type ClusterUserAttributeCache interface { + generic.CacheInterface[*v3.ClusterUserAttribute] +} diff --git a/pkg/generated/controllers/cluster.cattle.io/v3/interface.go b/pkg/generated/controllers/cluster.cattle.io/v3/interface.go new file mode 100644 index 00000000..4f1ba70c --- /dev/null +++ b/pkg/generated/controllers/cluster.cattle.io/v3/interface.go @@ -0,0 +1,57 @@ +/* +Copyright 2024 Rancher Labs, Inc. + +Licensed 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 main. DO NOT EDIT. + +package v3 + +import ( + "github.com/rancher/lasso/pkg/controller" + v3 "github.com/rancher/rancher/pkg/apis/cluster.cattle.io/v3" + "github.com/rancher/shepherd/pkg/session" + "github.com/rancher/shepherd/pkg/wrangler/pkg/generic" + "github.com/rancher/wrangler/v2/pkg/schemes" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +func init() { + schemes.Register(v3.AddToScheme) +} + +type Interface interface { + ClusterAuthToken() ClusterAuthTokenController + ClusterUserAttribute() ClusterUserAttributeController +} + +func New(controllerFactory controller.SharedControllerFactory, ts *session.Session) Interface { + return &version{ + controllerFactory: controllerFactory, + ts: ts, + } +} + +type version struct { + controllerFactory controller.SharedControllerFactory + ts *session.Session +} + +func (v *version) ClusterAuthToken() ClusterAuthTokenController { + return generic.NewController[*v3.ClusterAuthToken, *v3.ClusterAuthTokenList](schema.GroupVersionKind{Group: "cluster.cattle.io", Version: "v3", Kind: "ClusterAuthToken"}, "clusterauthtokens", true, v.controllerFactory, v.ts) +} + +func (v *version) ClusterUserAttribute() ClusterUserAttributeController { + return generic.NewController[*v3.ClusterUserAttribute, *v3.ClusterUserAttributeList](schema.GroupVersionKind{Group: "cluster.cattle.io", Version: "v3", Kind: "ClusterUserAttribute"}, "clusteruserattributes", true, v.controllerFactory, v.ts) +} diff --git a/pkg/generated/controllers/cluster.x-k8s.io/factory.go b/pkg/generated/controllers/cluster.x-k8s.io/factory.go index 6b5ee19f..61d2c1cf 100644 --- a/pkg/generated/controllers/cluster.x-k8s.io/factory.go +++ b/pkg/generated/controllers/cluster.x-k8s.io/factory.go @@ -20,7 +20,7 @@ package cluster import ( "github.com/rancher/lasso/pkg/controller" - "github.com/rancher/wrangler/v2/pkg/generic" + "github.com/rancher/shepherd/pkg/wrangler/pkg/generic" "k8s.io/client-go/rest" ) @@ -64,9 +64,9 @@ func NewFactoryFromConfigWithOptionsOrDie(config *rest.Config, opts *FactoryOpti } func (c *Factory) Cluster() Interface { - return New(c.ControllerFactory()) + return New(c.ControllerFactory(), c.Opts.TS) } func (c *Factory) WithAgent(userAgent string) Interface { - return New(controller.NewSharedControllerFactoryWithAgent(userAgent, c.ControllerFactory())) + return New(controller.NewSharedControllerFactoryWithAgent(userAgent, c.ControllerFactory()), c.Opts.TS) } diff --git a/pkg/generated/controllers/cluster.x-k8s.io/interface.go b/pkg/generated/controllers/cluster.x-k8s.io/interface.go index 9cd036e9..2ac735eb 100644 --- a/pkg/generated/controllers/cluster.x-k8s.io/interface.go +++ b/pkg/generated/controllers/cluster.x-k8s.io/interface.go @@ -21,6 +21,7 @@ package cluster import ( "github.com/rancher/lasso/pkg/controller" v1beta1 "github.com/rancher/shepherd/pkg/generated/controllers/cluster.x-k8s.io/v1beta1" + "github.com/rancher/shepherd/pkg/session" ) type Interface interface { @@ -29,15 +30,17 @@ type Interface interface { type group struct { controllerFactory controller.SharedControllerFactory + ts *session.Session } // New returns a new Interface. -func New(controllerFactory controller.SharedControllerFactory) Interface { +func New(controllerFactory controller.SharedControllerFactory, ts *session.Session) Interface { return &group{ controllerFactory: controllerFactory, + ts: ts, } } func (g *group) V1beta1() v1beta1.Interface { - return v1beta1.New(g.controllerFactory) + return v1beta1.New(g.controllerFactory, g.ts) } diff --git a/pkg/generated/controllers/cluster.x-k8s.io/v1beta1/cluster.go b/pkg/generated/controllers/cluster.x-k8s.io/v1beta1/cluster.go index fdf92ac5..d12537e9 100644 --- a/pkg/generated/controllers/cluster.x-k8s.io/v1beta1/cluster.go +++ b/pkg/generated/controllers/cluster.x-k8s.io/v1beta1/cluster.go @@ -23,9 +23,9 @@ import ( "sync" "time" + "github.com/rancher/shepherd/pkg/wrangler/pkg/generic" "github.com/rancher/wrangler/v2/pkg/apply" "github.com/rancher/wrangler/v2/pkg/condition" - "github.com/rancher/wrangler/v2/pkg/generic" "github.com/rancher/wrangler/v2/pkg/kv" "k8s.io/apimachinery/pkg/api/equality" "k8s.io/apimachinery/pkg/api/errors" diff --git a/pkg/generated/controllers/cluster.x-k8s.io/v1beta1/interface.go b/pkg/generated/controllers/cluster.x-k8s.io/v1beta1/interface.go index dece2de3..7643483d 100644 --- a/pkg/generated/controllers/cluster.x-k8s.io/v1beta1/interface.go +++ b/pkg/generated/controllers/cluster.x-k8s.io/v1beta1/interface.go @@ -20,7 +20,8 @@ package v1beta1 import ( "github.com/rancher/lasso/pkg/controller" - "github.com/rancher/wrangler/v2/pkg/generic" + "github.com/rancher/shepherd/pkg/session" + "github.com/rancher/shepherd/pkg/wrangler/pkg/generic" "github.com/rancher/wrangler/v2/pkg/schemes" "k8s.io/apimachinery/pkg/runtime/schema" v1beta1 "sigs.k8s.io/cluster-api/api/v1beta1" @@ -37,28 +38,30 @@ type Interface interface { MachineSet() MachineSetController } -func New(controllerFactory controller.SharedControllerFactory) Interface { +func New(controllerFactory controller.SharedControllerFactory, ts *session.Session) Interface { return &version{ controllerFactory: controllerFactory, + ts: ts, } } type version struct { controllerFactory controller.SharedControllerFactory + ts *session.Session } func (v *version) Cluster() ClusterController { - return generic.NewController[*v1beta1.Cluster, *v1beta1.ClusterList](schema.GroupVersionKind{Group: "cluster.x-k8s.io", Version: "v1beta1", Kind: "Cluster"}, "clusters", true, v.controllerFactory) + return generic.NewController[*v1beta1.Cluster, *v1beta1.ClusterList](schema.GroupVersionKind{Group: "cluster.x-k8s.io", Version: "v1beta1", Kind: "Cluster"}, "clusters", true, v.controllerFactory, v.ts) } func (v *version) Machine() MachineController { - return generic.NewController[*v1beta1.Machine, *v1beta1.MachineList](schema.GroupVersionKind{Group: "cluster.x-k8s.io", Version: "v1beta1", Kind: "Machine"}, "machines", true, v.controllerFactory) + return generic.NewController[*v1beta1.Machine, *v1beta1.MachineList](schema.GroupVersionKind{Group: "cluster.x-k8s.io", Version: "v1beta1", Kind: "Machine"}, "machines", true, v.controllerFactory, v.ts) } func (v *version) MachineDeployment() MachineDeploymentController { - return generic.NewController[*v1beta1.MachineDeployment, *v1beta1.MachineDeploymentList](schema.GroupVersionKind{Group: "cluster.x-k8s.io", Version: "v1beta1", Kind: "MachineDeployment"}, "machinedeployments", true, v.controllerFactory) + return generic.NewController[*v1beta1.MachineDeployment, *v1beta1.MachineDeploymentList](schema.GroupVersionKind{Group: "cluster.x-k8s.io", Version: "v1beta1", Kind: "MachineDeployment"}, "machinedeployments", true, v.controllerFactory, v.ts) } func (v *version) MachineSet() MachineSetController { - return generic.NewController[*v1beta1.MachineSet, *v1beta1.MachineSetList](schema.GroupVersionKind{Group: "cluster.x-k8s.io", Version: "v1beta1", Kind: "MachineSet"}, "machinesets", true, v.controllerFactory) + return generic.NewController[*v1beta1.MachineSet, *v1beta1.MachineSetList](schema.GroupVersionKind{Group: "cluster.x-k8s.io", Version: "v1beta1", Kind: "MachineSet"}, "machinesets", true, v.controllerFactory, v.ts) } diff --git a/pkg/generated/controllers/cluster.x-k8s.io/v1beta1/machine.go b/pkg/generated/controllers/cluster.x-k8s.io/v1beta1/machine.go index 4d141dcf..e6c6c377 100644 --- a/pkg/generated/controllers/cluster.x-k8s.io/v1beta1/machine.go +++ b/pkg/generated/controllers/cluster.x-k8s.io/v1beta1/machine.go @@ -23,9 +23,9 @@ import ( "sync" "time" + "github.com/rancher/shepherd/pkg/wrangler/pkg/generic" "github.com/rancher/wrangler/v2/pkg/apply" "github.com/rancher/wrangler/v2/pkg/condition" - "github.com/rancher/wrangler/v2/pkg/generic" "github.com/rancher/wrangler/v2/pkg/kv" "k8s.io/apimachinery/pkg/api/equality" "k8s.io/apimachinery/pkg/api/errors" diff --git a/pkg/generated/controllers/cluster.x-k8s.io/v1beta1/machinedeployment.go b/pkg/generated/controllers/cluster.x-k8s.io/v1beta1/machinedeployment.go index fca6e15b..ab50527a 100644 --- a/pkg/generated/controllers/cluster.x-k8s.io/v1beta1/machinedeployment.go +++ b/pkg/generated/controllers/cluster.x-k8s.io/v1beta1/machinedeployment.go @@ -23,9 +23,9 @@ import ( "sync" "time" + "github.com/rancher/shepherd/pkg/wrangler/pkg/generic" "github.com/rancher/wrangler/v2/pkg/apply" "github.com/rancher/wrangler/v2/pkg/condition" - "github.com/rancher/wrangler/v2/pkg/generic" "github.com/rancher/wrangler/v2/pkg/kv" "k8s.io/apimachinery/pkg/api/equality" "k8s.io/apimachinery/pkg/api/errors" diff --git a/pkg/generated/controllers/cluster.x-k8s.io/v1beta1/machineset.go b/pkg/generated/controllers/cluster.x-k8s.io/v1beta1/machineset.go index 4c23fe8a..b6cb4f7a 100644 --- a/pkg/generated/controllers/cluster.x-k8s.io/v1beta1/machineset.go +++ b/pkg/generated/controllers/cluster.x-k8s.io/v1beta1/machineset.go @@ -23,9 +23,9 @@ import ( "sync" "time" + "github.com/rancher/shepherd/pkg/wrangler/pkg/generic" "github.com/rancher/wrangler/v2/pkg/apply" "github.com/rancher/wrangler/v2/pkg/condition" - "github.com/rancher/wrangler/v2/pkg/generic" "github.com/rancher/wrangler/v2/pkg/kv" "k8s.io/apimachinery/pkg/api/equality" "k8s.io/apimachinery/pkg/api/errors" diff --git a/pkg/generated/controllers/fleet.cattle.io/factory.go b/pkg/generated/controllers/fleet.cattle.io/factory.go index b66dfd9d..c9194bef 100644 --- a/pkg/generated/controllers/fleet.cattle.io/factory.go +++ b/pkg/generated/controllers/fleet.cattle.io/factory.go @@ -20,7 +20,7 @@ package fleet import ( "github.com/rancher/lasso/pkg/controller" - "github.com/rancher/wrangler/v2/pkg/generic" + "github.com/rancher/shepherd/pkg/wrangler/pkg/generic" "k8s.io/client-go/rest" ) @@ -64,9 +64,9 @@ func NewFactoryFromConfigWithOptionsOrDie(config *rest.Config, opts *FactoryOpti } func (c *Factory) Fleet() Interface { - return New(c.ControllerFactory()) + return New(c.ControllerFactory(), c.Opts.TS) } func (c *Factory) WithAgent(userAgent string) Interface { - return New(controller.NewSharedControllerFactoryWithAgent(userAgent, c.ControllerFactory())) + return New(controller.NewSharedControllerFactoryWithAgent(userAgent, c.ControllerFactory()), c.Opts.TS) } diff --git a/pkg/generated/controllers/fleet.cattle.io/interface.go b/pkg/generated/controllers/fleet.cattle.io/interface.go index fe5d7f93..d825bc0b 100644 --- a/pkg/generated/controllers/fleet.cattle.io/interface.go +++ b/pkg/generated/controllers/fleet.cattle.io/interface.go @@ -21,6 +21,7 @@ package fleet import ( "github.com/rancher/lasso/pkg/controller" v1alpha1 "github.com/rancher/shepherd/pkg/generated/controllers/fleet.cattle.io/v1alpha1" + "github.com/rancher/shepherd/pkg/session" ) type Interface interface { @@ -29,15 +30,17 @@ type Interface interface { type group struct { controllerFactory controller.SharedControllerFactory + ts *session.Session } // New returns a new Interface. -func New(controllerFactory controller.SharedControllerFactory) Interface { +func New(controllerFactory controller.SharedControllerFactory, ts *session.Session) Interface { return &group{ controllerFactory: controllerFactory, + ts: ts, } } func (g *group) V1alpha1() v1alpha1.Interface { - return v1alpha1.New(g.controllerFactory) + return v1alpha1.New(g.controllerFactory, g.ts) } diff --git a/pkg/generated/controllers/fleet.cattle.io/v1alpha1/bundle.go b/pkg/generated/controllers/fleet.cattle.io/v1alpha1/bundle.go index 9dc4df8f..9de05b61 100644 --- a/pkg/generated/controllers/fleet.cattle.io/v1alpha1/bundle.go +++ b/pkg/generated/controllers/fleet.cattle.io/v1alpha1/bundle.go @@ -24,9 +24,9 @@ import ( "time" v1alpha1 "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1" + "github.com/rancher/shepherd/pkg/wrangler/pkg/generic" "github.com/rancher/wrangler/v2/pkg/apply" "github.com/rancher/wrangler/v2/pkg/condition" - "github.com/rancher/wrangler/v2/pkg/generic" "github.com/rancher/wrangler/v2/pkg/kv" "k8s.io/apimachinery/pkg/api/equality" "k8s.io/apimachinery/pkg/api/errors" diff --git a/pkg/generated/controllers/fleet.cattle.io/v1alpha1/cluster.go b/pkg/generated/controllers/fleet.cattle.io/v1alpha1/cluster.go index 3dcbae57..2f35e426 100644 --- a/pkg/generated/controllers/fleet.cattle.io/v1alpha1/cluster.go +++ b/pkg/generated/controllers/fleet.cattle.io/v1alpha1/cluster.go @@ -24,9 +24,9 @@ import ( "time" v1alpha1 "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1" + "github.com/rancher/shepherd/pkg/wrangler/pkg/generic" "github.com/rancher/wrangler/v2/pkg/apply" "github.com/rancher/wrangler/v2/pkg/condition" - "github.com/rancher/wrangler/v2/pkg/generic" "github.com/rancher/wrangler/v2/pkg/kv" "k8s.io/apimachinery/pkg/api/equality" "k8s.io/apimachinery/pkg/api/errors" diff --git a/pkg/generated/controllers/fleet.cattle.io/v1alpha1/clustergroup.go b/pkg/generated/controllers/fleet.cattle.io/v1alpha1/clustergroup.go index 1c95bca8..64b9c3cf 100644 --- a/pkg/generated/controllers/fleet.cattle.io/v1alpha1/clustergroup.go +++ b/pkg/generated/controllers/fleet.cattle.io/v1alpha1/clustergroup.go @@ -24,9 +24,9 @@ import ( "time" v1alpha1 "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1" + "github.com/rancher/shepherd/pkg/wrangler/pkg/generic" "github.com/rancher/wrangler/v2/pkg/apply" "github.com/rancher/wrangler/v2/pkg/condition" - "github.com/rancher/wrangler/v2/pkg/generic" "github.com/rancher/wrangler/v2/pkg/kv" "k8s.io/apimachinery/pkg/api/equality" "k8s.io/apimachinery/pkg/api/errors" diff --git a/pkg/generated/controllers/fleet.cattle.io/v1alpha1/interface.go b/pkg/generated/controllers/fleet.cattle.io/v1alpha1/interface.go index c26ef566..d614b1de 100644 --- a/pkg/generated/controllers/fleet.cattle.io/v1alpha1/interface.go +++ b/pkg/generated/controllers/fleet.cattle.io/v1alpha1/interface.go @@ -21,7 +21,8 @@ package v1alpha1 import ( v1alpha1 "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1" "github.com/rancher/lasso/pkg/controller" - "github.com/rancher/wrangler/v2/pkg/generic" + "github.com/rancher/shepherd/pkg/session" + "github.com/rancher/shepherd/pkg/wrangler/pkg/generic" "github.com/rancher/wrangler/v2/pkg/schemes" "k8s.io/apimachinery/pkg/runtime/schema" ) @@ -36,24 +37,26 @@ type Interface interface { ClusterGroup() ClusterGroupController } -func New(controllerFactory controller.SharedControllerFactory) Interface { +func New(controllerFactory controller.SharedControllerFactory, ts *session.Session) Interface { return &version{ controllerFactory: controllerFactory, + ts: ts, } } type version struct { controllerFactory controller.SharedControllerFactory + ts *session.Session } func (v *version) Bundle() BundleController { - return generic.NewController[*v1alpha1.Bundle, *v1alpha1.BundleList](schema.GroupVersionKind{Group: "fleet.cattle.io", Version: "v1alpha1", Kind: "Bundle"}, "bundles", true, v.controllerFactory) + return generic.NewController[*v1alpha1.Bundle, *v1alpha1.BundleList](schema.GroupVersionKind{Group: "fleet.cattle.io", Version: "v1alpha1", Kind: "Bundle"}, "bundles", true, v.controllerFactory, v.ts) } func (v *version) Cluster() ClusterController { - return generic.NewController[*v1alpha1.Cluster, *v1alpha1.ClusterList](schema.GroupVersionKind{Group: "fleet.cattle.io", Version: "v1alpha1", Kind: "Cluster"}, "clusters", true, v.controllerFactory) + return generic.NewController[*v1alpha1.Cluster, *v1alpha1.ClusterList](schema.GroupVersionKind{Group: "fleet.cattle.io", Version: "v1alpha1", Kind: "Cluster"}, "clusters", true, v.controllerFactory, v.ts) } func (v *version) ClusterGroup() ClusterGroupController { - return generic.NewController[*v1alpha1.ClusterGroup, *v1alpha1.ClusterGroupList](schema.GroupVersionKind{Group: "fleet.cattle.io", Version: "v1alpha1", Kind: "ClusterGroup"}, "clustergroups", true, v.controllerFactory) + return generic.NewController[*v1alpha1.ClusterGroup, *v1alpha1.ClusterGroupList](schema.GroupVersionKind{Group: "fleet.cattle.io", Version: "v1alpha1", Kind: "ClusterGroup"}, "clustergroups", true, v.controllerFactory, v.ts) } diff --git a/pkg/generated/controllers/provisioning.cattle.io/factory.go b/pkg/generated/controllers/provisioning.cattle.io/factory.go index a97228ae..9855a801 100644 --- a/pkg/generated/controllers/provisioning.cattle.io/factory.go +++ b/pkg/generated/controllers/provisioning.cattle.io/factory.go @@ -20,7 +20,7 @@ package provisioning import ( "github.com/rancher/lasso/pkg/controller" - "github.com/rancher/wrangler/v2/pkg/generic" + "github.com/rancher/shepherd/pkg/wrangler/pkg/generic" "k8s.io/client-go/rest" ) @@ -64,9 +64,9 @@ func NewFactoryFromConfigWithOptionsOrDie(config *rest.Config, opts *FactoryOpti } func (c *Factory) Provisioning() Interface { - return New(c.ControllerFactory()) + return New(c.ControllerFactory(), c.Opts.TS) } func (c *Factory) WithAgent(userAgent string) Interface { - return New(controller.NewSharedControllerFactoryWithAgent(userAgent, c.ControllerFactory())) + return New(controller.NewSharedControllerFactoryWithAgent(userAgent, c.ControllerFactory()), c.Opts.TS) } diff --git a/pkg/generated/controllers/provisioning.cattle.io/interface.go b/pkg/generated/controllers/provisioning.cattle.io/interface.go index be5d45ee..57183d87 100644 --- a/pkg/generated/controllers/provisioning.cattle.io/interface.go +++ b/pkg/generated/controllers/provisioning.cattle.io/interface.go @@ -21,6 +21,7 @@ package provisioning import ( "github.com/rancher/lasso/pkg/controller" v1 "github.com/rancher/shepherd/pkg/generated/controllers/provisioning.cattle.io/v1" + "github.com/rancher/shepherd/pkg/session" ) type Interface interface { @@ -29,15 +30,17 @@ type Interface interface { type group struct { controllerFactory controller.SharedControllerFactory + ts *session.Session } // New returns a new Interface. -func New(controllerFactory controller.SharedControllerFactory) Interface { +func New(controllerFactory controller.SharedControllerFactory, ts *session.Session) Interface { return &group{ controllerFactory: controllerFactory, + ts: ts, } } func (g *group) V1() v1.Interface { - return v1.New(g.controllerFactory) + return v1.New(g.controllerFactory, g.ts) } diff --git a/pkg/generated/controllers/provisioning.cattle.io/v1/cluster.go b/pkg/generated/controllers/provisioning.cattle.io/v1/cluster.go index 0fada2f4..0a6b9061 100644 --- a/pkg/generated/controllers/provisioning.cattle.io/v1/cluster.go +++ b/pkg/generated/controllers/provisioning.cattle.io/v1/cluster.go @@ -24,9 +24,9 @@ import ( "time" v1 "github.com/rancher/rancher/pkg/apis/provisioning.cattle.io/v1" + "github.com/rancher/shepherd/pkg/wrangler/pkg/generic" "github.com/rancher/wrangler/v2/pkg/apply" "github.com/rancher/wrangler/v2/pkg/condition" - "github.com/rancher/wrangler/v2/pkg/generic" "github.com/rancher/wrangler/v2/pkg/kv" "k8s.io/apimachinery/pkg/api/equality" "k8s.io/apimachinery/pkg/api/errors" diff --git a/pkg/generated/controllers/provisioning.cattle.io/v1/interface.go b/pkg/generated/controllers/provisioning.cattle.io/v1/interface.go index 28ab9a7b..a5739b8a 100644 --- a/pkg/generated/controllers/provisioning.cattle.io/v1/interface.go +++ b/pkg/generated/controllers/provisioning.cattle.io/v1/interface.go @@ -21,7 +21,8 @@ package v1 import ( "github.com/rancher/lasso/pkg/controller" v1 "github.com/rancher/rancher/pkg/apis/provisioning.cattle.io/v1" - "github.com/rancher/wrangler/v2/pkg/generic" + "github.com/rancher/shepherd/pkg/session" + "github.com/rancher/shepherd/pkg/wrangler/pkg/generic" "github.com/rancher/wrangler/v2/pkg/schemes" "k8s.io/apimachinery/pkg/runtime/schema" ) @@ -34,16 +35,18 @@ type Interface interface { Cluster() ClusterController } -func New(controllerFactory controller.SharedControllerFactory) Interface { +func New(controllerFactory controller.SharedControllerFactory, ts *session.Session) Interface { return &version{ controllerFactory: controllerFactory, + ts: ts, } } type version struct { controllerFactory controller.SharedControllerFactory + ts *session.Session } func (v *version) Cluster() ClusterController { - return generic.NewController[*v1.Cluster, *v1.ClusterList](schema.GroupVersionKind{Group: "provisioning.cattle.io", Version: "v1", Kind: "Cluster"}, "clusters", true, v.controllerFactory) + return generic.NewController[*v1.Cluster, *v1.ClusterList](schema.GroupVersionKind{Group: "provisioning.cattle.io", Version: "v1", Kind: "Cluster"}, "clusters", true, v.controllerFactory, v.ts) } diff --git a/pkg/generated/controllers/rbac/factory.go b/pkg/generated/controllers/rbac/factory.go new file mode 100644 index 00000000..2406f67c --- /dev/null +++ b/pkg/generated/controllers/rbac/factory.go @@ -0,0 +1,72 @@ +/* +Copyright 2024 Rancher Labs, Inc. + +Licensed 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 main. DO NOT EDIT. + +package rbac + +import ( + "github.com/rancher/lasso/pkg/controller" + "github.com/rancher/shepherd/pkg/wrangler/pkg/generic" + "k8s.io/client-go/rest" +) + +type Factory struct { + *generic.Factory +} + +func NewFactoryFromConfigOrDie(config *rest.Config) *Factory { + f, err := NewFactoryFromConfig(config) + if err != nil { + panic(err) + } + return f +} + +func NewFactoryFromConfig(config *rest.Config) (*Factory, error) { + return NewFactoryFromConfigWithOptions(config, nil) +} + +func NewFactoryFromConfigWithNamespace(config *rest.Config, namespace string) (*Factory, error) { + return NewFactoryFromConfigWithOptions(config, &FactoryOptions{ + Namespace: namespace, + }) +} + +type FactoryOptions = generic.FactoryOptions + +func NewFactoryFromConfigWithOptions(config *rest.Config, opts *FactoryOptions) (*Factory, error) { + f, err := generic.NewFactoryFromConfigWithOptions(config, opts) + return &Factory{ + Factory: f, + }, err +} + +func NewFactoryFromConfigWithOptionsOrDie(config *rest.Config, opts *FactoryOptions) *Factory { + f, err := NewFactoryFromConfigWithOptions(config, opts) + if err != nil { + panic(err) + } + return f +} + +func (c *Factory) Rbac() Interface { + return New(c.ControllerFactory(), c.Opts.TS) +} + +func (c *Factory) WithAgent(userAgent string) Interface { + return New(controller.NewSharedControllerFactoryWithAgent(userAgent, c.ControllerFactory()), c.Opts.TS) +} diff --git a/pkg/generated/controllers/rbac/interface.go b/pkg/generated/controllers/rbac/interface.go new file mode 100644 index 00000000..5a4bef46 --- /dev/null +++ b/pkg/generated/controllers/rbac/interface.go @@ -0,0 +1,46 @@ +/* +Copyright 2024 Rancher Labs, Inc. + +Licensed 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 main. DO NOT EDIT. + +package rbac + +import ( + "github.com/rancher/lasso/pkg/controller" + v1 "github.com/rancher/shepherd/pkg/generated/controllers/rbac/v1" + "github.com/rancher/shepherd/pkg/session" +) + +type Interface interface { + V1() v1.Interface +} + +type group struct { + controllerFactory controller.SharedControllerFactory + ts *session.Session +} + +// New returns a new Interface. +func New(controllerFactory controller.SharedControllerFactory, ts *session.Session) Interface { + return &group{ + controllerFactory: controllerFactory, + ts: ts, + } +} + +func (g *group) V1() v1.Interface { + return v1.New(g.controllerFactory, g.ts) +} diff --git a/pkg/generated/controllers/rbac/v1/clusterrole.go b/pkg/generated/controllers/rbac/v1/clusterrole.go new file mode 100644 index 00000000..27620567 --- /dev/null +++ b/pkg/generated/controllers/rbac/v1/clusterrole.go @@ -0,0 +1,39 @@ +/* +Copyright 2024 Rancher Labs, Inc. + +Licensed 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 main. DO NOT EDIT. + +package v1 + +import ( + "github.com/rancher/shepherd/pkg/wrangler/pkg/generic" + v1 "k8s.io/api/rbac/v1" +) + +// ClusterRoleController interface for managing ClusterRole resources. +type ClusterRoleController interface { + generic.NonNamespacedControllerInterface[*v1.ClusterRole, *v1.ClusterRoleList] +} + +// ClusterRoleClient interface for managing ClusterRole resources in Kubernetes. +type ClusterRoleClient interface { + generic.NonNamespacedClientInterface[*v1.ClusterRole, *v1.ClusterRoleList] +} + +// ClusterRoleCache interface for retrieving ClusterRole resources in memory. +type ClusterRoleCache interface { + generic.NonNamespacedCacheInterface[*v1.ClusterRole] +} diff --git a/pkg/generated/controllers/rbac/v1/clusterrolebinding.go b/pkg/generated/controllers/rbac/v1/clusterrolebinding.go new file mode 100644 index 00000000..1b1ecd3e --- /dev/null +++ b/pkg/generated/controllers/rbac/v1/clusterrolebinding.go @@ -0,0 +1,39 @@ +/* +Copyright 2024 Rancher Labs, Inc. + +Licensed 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 main. DO NOT EDIT. + +package v1 + +import ( + "github.com/rancher/shepherd/pkg/wrangler/pkg/generic" + v1 "k8s.io/api/rbac/v1" +) + +// ClusterRoleBindingController interface for managing ClusterRoleBinding resources. +type ClusterRoleBindingController interface { + generic.NonNamespacedControllerInterface[*v1.ClusterRoleBinding, *v1.ClusterRoleBindingList] +} + +// ClusterRoleBindingClient interface for managing ClusterRoleBinding resources in Kubernetes. +type ClusterRoleBindingClient interface { + generic.NonNamespacedClientInterface[*v1.ClusterRoleBinding, *v1.ClusterRoleBindingList] +} + +// ClusterRoleBindingCache interface for retrieving ClusterRoleBinding resources in memory. +type ClusterRoleBindingCache interface { + generic.NonNamespacedCacheInterface[*v1.ClusterRoleBinding] +} diff --git a/pkg/generated/controllers/rbac/v1/interface.go b/pkg/generated/controllers/rbac/v1/interface.go new file mode 100644 index 00000000..2d7e5baf --- /dev/null +++ b/pkg/generated/controllers/rbac/v1/interface.go @@ -0,0 +1,67 @@ +/* +Copyright 2024 Rancher Labs, Inc. + +Licensed 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 main. DO NOT EDIT. + +package v1 + +import ( + "github.com/rancher/lasso/pkg/controller" + "github.com/rancher/shepherd/pkg/session" + "github.com/rancher/shepherd/pkg/wrangler/pkg/generic" + "github.com/rancher/wrangler/v2/pkg/schemes" + v1 "k8s.io/api/rbac/v1" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +func init() { + schemes.Register(v1.AddToScheme) +} + +type Interface interface { + ClusterRole() ClusterRoleController + ClusterRoleBinding() ClusterRoleBindingController + Role() RoleController + RoleBinding() RoleBindingController +} + +func New(controllerFactory controller.SharedControllerFactory, ts *session.Session) Interface { + return &version{ + controllerFactory: controllerFactory, + ts: ts, + } +} + +type version struct { + controllerFactory controller.SharedControllerFactory + ts *session.Session +} + +func (v *version) ClusterRole() ClusterRoleController { + return generic.NewNonNamespacedController[*v1.ClusterRole, *v1.ClusterRoleList](schema.GroupVersionKind{Group: "rbac.authorization.k8s.io", Version: "v1", Kind: "ClusterRole"}, "clusterroles", v.controllerFactory, v.ts) +} + +func (v *version) ClusterRoleBinding() ClusterRoleBindingController { + return generic.NewNonNamespacedController[*v1.ClusterRoleBinding, *v1.ClusterRoleBindingList](schema.GroupVersionKind{Group: "rbac.authorization.k8s.io", Version: "v1", Kind: "ClusterRoleBinding"}, "clusterrolebindings", v.controllerFactory, v.ts) +} + +func (v *version) Role() RoleController { + return generic.NewController[*v1.Role, *v1.RoleList](schema.GroupVersionKind{Group: "rbac.authorization.k8s.io", Version: "v1", Kind: "Role"}, "roles", true, v.controllerFactory, v.ts) +} + +func (v *version) RoleBinding() RoleBindingController { + return generic.NewController[*v1.RoleBinding, *v1.RoleBindingList](schema.GroupVersionKind{Group: "rbac.authorization.k8s.io", Version: "v1", Kind: "RoleBinding"}, "rolebindings", true, v.controllerFactory, v.ts) +} diff --git a/pkg/generated/controllers/rbac/v1/role.go b/pkg/generated/controllers/rbac/v1/role.go new file mode 100644 index 00000000..906a24e3 --- /dev/null +++ b/pkg/generated/controllers/rbac/v1/role.go @@ -0,0 +1,39 @@ +/* +Copyright 2024 Rancher Labs, Inc. + +Licensed 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 main. DO NOT EDIT. + +package v1 + +import ( + "github.com/rancher/shepherd/pkg/wrangler/pkg/generic" + v1 "k8s.io/api/rbac/v1" +) + +// RoleController interface for managing Role resources. +type RoleController interface { + generic.ControllerInterface[*v1.Role, *v1.RoleList] +} + +// RoleClient interface for managing Role resources in Kubernetes. +type RoleClient interface { + generic.ClientInterface[*v1.Role, *v1.RoleList] +} + +// RoleCache interface for retrieving Role resources in memory. +type RoleCache interface { + generic.CacheInterface[*v1.Role] +} diff --git a/pkg/generated/controllers/rbac/v1/rolebinding.go b/pkg/generated/controllers/rbac/v1/rolebinding.go new file mode 100644 index 00000000..ee4e2232 --- /dev/null +++ b/pkg/generated/controllers/rbac/v1/rolebinding.go @@ -0,0 +1,39 @@ +/* +Copyright 2024 Rancher Labs, Inc. + +Licensed 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 main. DO NOT EDIT. + +package v1 + +import ( + "github.com/rancher/shepherd/pkg/wrangler/pkg/generic" + v1 "k8s.io/api/rbac/v1" +) + +// RoleBindingController interface for managing RoleBinding resources. +type RoleBindingController interface { + generic.ControllerInterface[*v1.RoleBinding, *v1.RoleBindingList] +} + +// RoleBindingClient interface for managing RoleBinding resources in Kubernetes. +type RoleBindingClient interface { + generic.ClientInterface[*v1.RoleBinding, *v1.RoleBindingList] +} + +// RoleBindingCache interface for retrieving RoleBinding resources in memory. +type RoleBindingCache interface { + generic.CacheInterface[*v1.RoleBinding] +} diff --git a/pkg/generated/controllers/rke.cattle.io/factory.go b/pkg/generated/controllers/rke.cattle.io/factory.go index c31af99a..02d3e2a6 100644 --- a/pkg/generated/controllers/rke.cattle.io/factory.go +++ b/pkg/generated/controllers/rke.cattle.io/factory.go @@ -20,7 +20,7 @@ package rke import ( "github.com/rancher/lasso/pkg/controller" - "github.com/rancher/wrangler/v2/pkg/generic" + "github.com/rancher/shepherd/pkg/wrangler/pkg/generic" "k8s.io/client-go/rest" ) @@ -64,9 +64,9 @@ func NewFactoryFromConfigWithOptionsOrDie(config *rest.Config, opts *FactoryOpti } func (c *Factory) Rke() Interface { - return New(c.ControllerFactory()) + return New(c.ControllerFactory(), c.Opts.TS) } func (c *Factory) WithAgent(userAgent string) Interface { - return New(controller.NewSharedControllerFactoryWithAgent(userAgent, c.ControllerFactory())) + return New(controller.NewSharedControllerFactoryWithAgent(userAgent, c.ControllerFactory()), c.Opts.TS) } diff --git a/pkg/generated/controllers/rke.cattle.io/interface.go b/pkg/generated/controllers/rke.cattle.io/interface.go index 89dcc0fc..d0c5c5fd 100644 --- a/pkg/generated/controllers/rke.cattle.io/interface.go +++ b/pkg/generated/controllers/rke.cattle.io/interface.go @@ -21,6 +21,7 @@ package rke import ( "github.com/rancher/lasso/pkg/controller" v1 "github.com/rancher/shepherd/pkg/generated/controllers/rke.cattle.io/v1" + "github.com/rancher/shepherd/pkg/session" ) type Interface interface { @@ -29,15 +30,17 @@ type Interface interface { type group struct { controllerFactory controller.SharedControllerFactory + ts *session.Session } // New returns a new Interface. -func New(controllerFactory controller.SharedControllerFactory) Interface { +func New(controllerFactory controller.SharedControllerFactory, ts *session.Session) Interface { return &group{ controllerFactory: controllerFactory, + ts: ts, } } func (g *group) V1() v1.Interface { - return v1.New(g.controllerFactory) + return v1.New(g.controllerFactory, g.ts) } diff --git a/pkg/generated/controllers/rke.cattle.io/v1/custommachine.go b/pkg/generated/controllers/rke.cattle.io/v1/custommachine.go index 331a5f94..accb8abd 100644 --- a/pkg/generated/controllers/rke.cattle.io/v1/custommachine.go +++ b/pkg/generated/controllers/rke.cattle.io/v1/custommachine.go @@ -24,9 +24,9 @@ import ( "time" v1 "github.com/rancher/rancher/pkg/apis/rke.cattle.io/v1" + "github.com/rancher/shepherd/pkg/wrangler/pkg/generic" "github.com/rancher/wrangler/v2/pkg/apply" "github.com/rancher/wrangler/v2/pkg/condition" - "github.com/rancher/wrangler/v2/pkg/generic" "github.com/rancher/wrangler/v2/pkg/kv" "k8s.io/apimachinery/pkg/api/equality" "k8s.io/apimachinery/pkg/api/errors" diff --git a/pkg/generated/controllers/rke.cattle.io/v1/etcdsnapshot.go b/pkg/generated/controllers/rke.cattle.io/v1/etcdsnapshot.go index efd294db..37d7521d 100644 --- a/pkg/generated/controllers/rke.cattle.io/v1/etcdsnapshot.go +++ b/pkg/generated/controllers/rke.cattle.io/v1/etcdsnapshot.go @@ -24,9 +24,9 @@ import ( "time" v1 "github.com/rancher/rancher/pkg/apis/rke.cattle.io/v1" + "github.com/rancher/shepherd/pkg/wrangler/pkg/generic" "github.com/rancher/wrangler/v2/pkg/apply" "github.com/rancher/wrangler/v2/pkg/condition" - "github.com/rancher/wrangler/v2/pkg/generic" "github.com/rancher/wrangler/v2/pkg/kv" "k8s.io/apimachinery/pkg/api/equality" "k8s.io/apimachinery/pkg/api/errors" diff --git a/pkg/generated/controllers/rke.cattle.io/v1/interface.go b/pkg/generated/controllers/rke.cattle.io/v1/interface.go index 7e2150cb..3a616a17 100644 --- a/pkg/generated/controllers/rke.cattle.io/v1/interface.go +++ b/pkg/generated/controllers/rke.cattle.io/v1/interface.go @@ -21,7 +21,8 @@ package v1 import ( "github.com/rancher/lasso/pkg/controller" v1 "github.com/rancher/rancher/pkg/apis/rke.cattle.io/v1" - "github.com/rancher/wrangler/v2/pkg/generic" + "github.com/rancher/shepherd/pkg/session" + "github.com/rancher/shepherd/pkg/wrangler/pkg/generic" "github.com/rancher/wrangler/v2/pkg/schemes" "k8s.io/apimachinery/pkg/runtime/schema" ) @@ -39,36 +40,38 @@ type Interface interface { RKEControlPlane() RKEControlPlaneController } -func New(controllerFactory controller.SharedControllerFactory) Interface { +func New(controllerFactory controller.SharedControllerFactory, ts *session.Session) Interface { return &version{ controllerFactory: controllerFactory, + ts: ts, } } type version struct { controllerFactory controller.SharedControllerFactory + ts *session.Session } func (v *version) CustomMachine() CustomMachineController { - return generic.NewController[*v1.CustomMachine, *v1.CustomMachineList](schema.GroupVersionKind{Group: "rke.cattle.io", Version: "v1", Kind: "CustomMachine"}, "custommachines", true, v.controllerFactory) + return generic.NewController[*v1.CustomMachine, *v1.CustomMachineList](schema.GroupVersionKind{Group: "rke.cattle.io", Version: "v1", Kind: "CustomMachine"}, "custommachines", true, v.controllerFactory, v.ts) } func (v *version) ETCDSnapshot() ETCDSnapshotController { - return generic.NewController[*v1.ETCDSnapshot, *v1.ETCDSnapshotList](schema.GroupVersionKind{Group: "rke.cattle.io", Version: "v1", Kind: "ETCDSnapshot"}, "etcdsnapshots", true, v.controllerFactory) + return generic.NewController[*v1.ETCDSnapshot, *v1.ETCDSnapshotList](schema.GroupVersionKind{Group: "rke.cattle.io", Version: "v1", Kind: "ETCDSnapshot"}, "etcdsnapshots", true, v.controllerFactory, v.ts) } func (v *version) RKEBootstrap() RKEBootstrapController { - return generic.NewController[*v1.RKEBootstrap, *v1.RKEBootstrapList](schema.GroupVersionKind{Group: "rke.cattle.io", Version: "v1", Kind: "RKEBootstrap"}, "rkebootstraps", true, v.controllerFactory) + return generic.NewController[*v1.RKEBootstrap, *v1.RKEBootstrapList](schema.GroupVersionKind{Group: "rke.cattle.io", Version: "v1", Kind: "RKEBootstrap"}, "rkebootstraps", true, v.controllerFactory, v.ts) } func (v *version) RKEBootstrapTemplate() RKEBootstrapTemplateController { - return generic.NewController[*v1.RKEBootstrapTemplate, *v1.RKEBootstrapTemplateList](schema.GroupVersionKind{Group: "rke.cattle.io", Version: "v1", Kind: "RKEBootstrapTemplate"}, "rkebootstraptemplates", true, v.controllerFactory) + return generic.NewController[*v1.RKEBootstrapTemplate, *v1.RKEBootstrapTemplateList](schema.GroupVersionKind{Group: "rke.cattle.io", Version: "v1", Kind: "RKEBootstrapTemplate"}, "rkebootstraptemplates", true, v.controllerFactory, v.ts) } func (v *version) RKECluster() RKEClusterController { - return generic.NewController[*v1.RKECluster, *v1.RKEClusterList](schema.GroupVersionKind{Group: "rke.cattle.io", Version: "v1", Kind: "RKECluster"}, "rkeclusters", true, v.controllerFactory) + return generic.NewController[*v1.RKECluster, *v1.RKEClusterList](schema.GroupVersionKind{Group: "rke.cattle.io", Version: "v1", Kind: "RKECluster"}, "rkeclusters", true, v.controllerFactory, v.ts) } func (v *version) RKEControlPlane() RKEControlPlaneController { - return generic.NewController[*v1.RKEControlPlane, *v1.RKEControlPlaneList](schema.GroupVersionKind{Group: "rke.cattle.io", Version: "v1", Kind: "RKEControlPlane"}, "rkecontrolplanes", true, v.controllerFactory) + return generic.NewController[*v1.RKEControlPlane, *v1.RKEControlPlaneList](schema.GroupVersionKind{Group: "rke.cattle.io", Version: "v1", Kind: "RKEControlPlane"}, "rkecontrolplanes", true, v.controllerFactory, v.ts) } diff --git a/pkg/generated/controllers/rke.cattle.io/v1/rkebootstrap.go b/pkg/generated/controllers/rke.cattle.io/v1/rkebootstrap.go index fb698ad5..b5b787c4 100644 --- a/pkg/generated/controllers/rke.cattle.io/v1/rkebootstrap.go +++ b/pkg/generated/controllers/rke.cattle.io/v1/rkebootstrap.go @@ -24,9 +24,9 @@ import ( "time" v1 "github.com/rancher/rancher/pkg/apis/rke.cattle.io/v1" + "github.com/rancher/shepherd/pkg/wrangler/pkg/generic" "github.com/rancher/wrangler/v2/pkg/apply" "github.com/rancher/wrangler/v2/pkg/condition" - "github.com/rancher/wrangler/v2/pkg/generic" "github.com/rancher/wrangler/v2/pkg/kv" "k8s.io/apimachinery/pkg/api/equality" "k8s.io/apimachinery/pkg/api/errors" diff --git a/pkg/generated/controllers/rke.cattle.io/v1/rkebootstraptemplate.go b/pkg/generated/controllers/rke.cattle.io/v1/rkebootstraptemplate.go index 251e011a..71809a04 100644 --- a/pkg/generated/controllers/rke.cattle.io/v1/rkebootstraptemplate.go +++ b/pkg/generated/controllers/rke.cattle.io/v1/rkebootstraptemplate.go @@ -20,7 +20,7 @@ package v1 import ( v1 "github.com/rancher/rancher/pkg/apis/rke.cattle.io/v1" - "github.com/rancher/wrangler/v2/pkg/generic" + "github.com/rancher/shepherd/pkg/wrangler/pkg/generic" ) // RKEBootstrapTemplateController interface for managing RKEBootstrapTemplate resources. diff --git a/pkg/generated/controllers/rke.cattle.io/v1/rkecluster.go b/pkg/generated/controllers/rke.cattle.io/v1/rkecluster.go index 064e4c2a..07939761 100644 --- a/pkg/generated/controllers/rke.cattle.io/v1/rkecluster.go +++ b/pkg/generated/controllers/rke.cattle.io/v1/rkecluster.go @@ -24,9 +24,9 @@ import ( "time" v1 "github.com/rancher/rancher/pkg/apis/rke.cattle.io/v1" + "github.com/rancher/shepherd/pkg/wrangler/pkg/generic" "github.com/rancher/wrangler/v2/pkg/apply" "github.com/rancher/wrangler/v2/pkg/condition" - "github.com/rancher/wrangler/v2/pkg/generic" "github.com/rancher/wrangler/v2/pkg/kv" "k8s.io/apimachinery/pkg/api/equality" "k8s.io/apimachinery/pkg/api/errors" diff --git a/pkg/generated/controllers/rke.cattle.io/v1/rkecontrolplane.go b/pkg/generated/controllers/rke.cattle.io/v1/rkecontrolplane.go index 9bb6f80b..038072f6 100644 --- a/pkg/generated/controllers/rke.cattle.io/v1/rkecontrolplane.go +++ b/pkg/generated/controllers/rke.cattle.io/v1/rkecontrolplane.go @@ -24,9 +24,9 @@ import ( "time" v1 "github.com/rancher/rancher/pkg/apis/rke.cattle.io/v1" + "github.com/rancher/shepherd/pkg/wrangler/pkg/generic" "github.com/rancher/wrangler/v2/pkg/apply" "github.com/rancher/wrangler/v2/pkg/condition" - "github.com/rancher/wrangler/v2/pkg/generic" "github.com/rancher/wrangler/v2/pkg/kv" "k8s.io/apimachinery/pkg/api/equality" "k8s.io/apimachinery/pkg/api/errors" diff --git a/pkg/generated/controllers/upgrade.cattle.io/factory.go b/pkg/generated/controllers/upgrade.cattle.io/factory.go index 4a37c16e..5ebb2cbf 100644 --- a/pkg/generated/controllers/upgrade.cattle.io/factory.go +++ b/pkg/generated/controllers/upgrade.cattle.io/factory.go @@ -20,7 +20,7 @@ package upgrade import ( "github.com/rancher/lasso/pkg/controller" - "github.com/rancher/wrangler/v2/pkg/generic" + "github.com/rancher/shepherd/pkg/wrangler/pkg/generic" "k8s.io/client-go/rest" ) @@ -64,9 +64,9 @@ func NewFactoryFromConfigWithOptionsOrDie(config *rest.Config, opts *FactoryOpti } func (c *Factory) Upgrade() Interface { - return New(c.ControllerFactory()) + return New(c.ControllerFactory(), c.Opts.TS) } func (c *Factory) WithAgent(userAgent string) Interface { - return New(controller.NewSharedControllerFactoryWithAgent(userAgent, c.ControllerFactory())) + return New(controller.NewSharedControllerFactoryWithAgent(userAgent, c.ControllerFactory()), c.Opts.TS) } diff --git a/pkg/generated/controllers/upgrade.cattle.io/interface.go b/pkg/generated/controllers/upgrade.cattle.io/interface.go index 22c761ac..759530f8 100644 --- a/pkg/generated/controllers/upgrade.cattle.io/interface.go +++ b/pkg/generated/controllers/upgrade.cattle.io/interface.go @@ -21,6 +21,7 @@ package upgrade import ( "github.com/rancher/lasso/pkg/controller" v1 "github.com/rancher/shepherd/pkg/generated/controllers/upgrade.cattle.io/v1" + "github.com/rancher/shepherd/pkg/session" ) type Interface interface { @@ -29,15 +30,17 @@ type Interface interface { type group struct { controllerFactory controller.SharedControllerFactory + ts *session.Session } // New returns a new Interface. -func New(controllerFactory controller.SharedControllerFactory) Interface { +func New(controllerFactory controller.SharedControllerFactory, ts *session.Session) Interface { return &group{ controllerFactory: controllerFactory, + ts: ts, } } func (g *group) V1() v1.Interface { - return v1.New(g.controllerFactory) + return v1.New(g.controllerFactory, g.ts) } diff --git a/pkg/generated/controllers/upgrade.cattle.io/v1/interface.go b/pkg/generated/controllers/upgrade.cattle.io/v1/interface.go index d9d72615..e4069c1f 100644 --- a/pkg/generated/controllers/upgrade.cattle.io/v1/interface.go +++ b/pkg/generated/controllers/upgrade.cattle.io/v1/interface.go @@ -20,8 +20,9 @@ package v1 import ( "github.com/rancher/lasso/pkg/controller" + "github.com/rancher/shepherd/pkg/session" + "github.com/rancher/shepherd/pkg/wrangler/pkg/generic" v1 "github.com/rancher/system-upgrade-controller/pkg/apis/upgrade.cattle.io/v1" - "github.com/rancher/wrangler/v2/pkg/generic" "github.com/rancher/wrangler/v2/pkg/schemes" "k8s.io/apimachinery/pkg/runtime/schema" ) @@ -34,16 +35,18 @@ type Interface interface { Plan() PlanController } -func New(controllerFactory controller.SharedControllerFactory) Interface { +func New(controllerFactory controller.SharedControllerFactory, ts *session.Session) Interface { return &version{ controllerFactory: controllerFactory, + ts: ts, } } type version struct { controllerFactory controller.SharedControllerFactory + ts *session.Session } func (v *version) Plan() PlanController { - return generic.NewController[*v1.Plan, *v1.PlanList](schema.GroupVersionKind{Group: "upgrade.cattle.io", Version: "v1", Kind: "Plan"}, "plans", true, v.controllerFactory) + return generic.NewController[*v1.Plan, *v1.PlanList](schema.GroupVersionKind{Group: "upgrade.cattle.io", Version: "v1", Kind: "Plan"}, "plans", true, v.controllerFactory, v.ts) } diff --git a/pkg/generated/controllers/upgrade.cattle.io/v1/plan.go b/pkg/generated/controllers/upgrade.cattle.io/v1/plan.go index 64469d34..fb4e57cf 100644 --- a/pkg/generated/controllers/upgrade.cattle.io/v1/plan.go +++ b/pkg/generated/controllers/upgrade.cattle.io/v1/plan.go @@ -23,10 +23,10 @@ import ( "sync" "time" + "github.com/rancher/shepherd/pkg/wrangler/pkg/generic" v1 "github.com/rancher/system-upgrade-controller/pkg/apis/upgrade.cattle.io/v1" "github.com/rancher/wrangler/v2/pkg/apply" "github.com/rancher/wrangler/v2/pkg/condition" - "github.com/rancher/wrangler/v2/pkg/generic" "github.com/rancher/wrangler/v2/pkg/kv" "k8s.io/apimachinery/pkg/api/equality" "k8s.io/apimachinery/pkg/api/errors"