Commit Graph

52 Commits

Author SHA1 Message Date
Felipe C. Gehrke fef01c524d fixing client generator 2024-10-09 15:22:41 -03:00
Felipe C. Gehrke 0f27e53f7c changed openapi comment to be dependent on flag 2024-10-05 00:07:55 -03:00
Felipe C. Gehrke 433b7d1214 addressing comments from tomleb 2024-09-30 14:50:39 -03:00
Tom Lebreux f3b392ada2
Move to wrangler v3 (#427) 2024-05-02 10:06:30 -04:00
Tom Lebreux 8886c2677b
K8s 1.30 (#425)
* Use goimports instead of k8s.io/code-generator

* Upgrade k8s.io to 1.30

* Fix deepcopy-gen generator

* Migrate client-gen to gengo/v2

* Migrate listers generator to gengo/v2

* Migrate informers to gengo/v2

* Update setGenClient middleware to gengo/v2

* Migrate custom generators

---------

Co-authored-by: galal-hussein <hussein.galal.ahmed.11@gmail.com>
2024-05-01 16:16:56 -04:00
Alejandro Ruiz f5d32fe214
Allow GeneratingHandlers to skip Apply if resource version didn't change (#341)
* Allow GeneratingHandlers to skip Apply if resource version didn't change

* Run go generate

* Add call count to FakeApply

* Add test for UniqueApplyForResourceVersion

* Simplify error handling

Co-authored-by: Kevin Joiner <10265309+KevinJoiner@users.noreply.github.com>

* Make generated code more readable

Co-authored-by: Kevin Joiner <10265309+KevinJoiner@users.noreply.github.com>

* Rename constant

* Rename seenResourceVersion to storeResourceVersion

* go generate

* Add comments to code generator

* Run go generate

* Upgrade golangci-lint GitHub action, since it always fails now

---------

Co-authored-by: Kevin Joiner <10265309+KevinJoiner@users.noreply.github.com>
2023-12-22 13:57:51 -05:00
Ricardo Weir d4a7d13cee Update module to v2 and update paths 2023-09-01 17:51:39 -07:00
Ricardo Weir b9331c2ef0 Add ImportPath for v2 2023-09-01 16:46:22 -07:00
Kevin Joiner 294dad04db Reduce generated clients/controllers.
The Generated Client, Controller, and Cache interfaces are now entirely
implemented by the generic Interfaces. These changes greatly reduce the
amount of generated code needed and allows users to use the mocks
directly with controllers without having to wrap them as an embedded
object.
2023-06-29 16:24:29 -04:00
Kevin Joiner 423d848a8f Adds impersonation for clients.
This commit imports new lasso changes to allow users to create a new
client that impersonates requests for specified user.
2023-06-29 16:24:29 -04:00
Kevin Joiner fc1fea5cad Add fake package for creating generic mocks for controllers, Clients, and Caches.
To support easy mocking generic interfaces were added for controllers and caches.
And generated code now uses these interfaces instead of the generic structure.
This commit also adds code comments to the generated interfaces, and a README for the fake package.
2023-03-03 12:25:50 -05:00
Kevin Joiner 8a99fb5ad2 Refactor generated controllers and caches to call the generic functions.
Moved Controler and Cache implmentations from template strings in ype_go.go
to generic/controller.go and generic/cache.go. The generation
of type specific interface was left so that dependent packages do not
experince any breaking changes.
2023-03-03 12:15:32 -05:00
Kevin Joiner eb2b386988 Code cleanup.
Removes unused member variables
`InformersPackage` `ClientsPackage` & `ListersPackage` from pkg/args.Group.
These variables were previously used to create import statements in our generated code.
Though the refactor in #85 made the variables obsolete.

Removes the generated function DeepCopy<type>OnChange.
This function is unused by our rancher products and does not work as initially intended.
This function's original intent was to be a helper function that creates
a Handler that modifies a copy of the provided object and then
updates the object if the modification produces a change.
This function was modified in 2044a7b2bb
so that it no longer returns a handler.
2023-03-03 12:15:32 -05:00
Ricardo Weir 6366d1aa3d Add function to copy factory and add user agent
Used lasso's configure user agent functionality to provide function
in factory template for making a copy of factory then configuring
it to use specified user agent.
2022-12-28 18:12:15 -07:00
Erik Kristensen 51b771b649 fix: TrimRight removes an extra character in certain conditions 2021-11-25 12:33:03 -07:00
Darren Shepherd 39dd8bf93e Don't run generating handlers on finalizing objects 2021-05-21 14:32:00 -07:00
Darren Shepherd 3970d28bb0 Add NewFactoryFromConfigWithOptionOrDie helper to generated code 2021-02-19 09:13:35 -07:00
Darren Shepherd 9465df8794 Don't blank out object on failed status update 2020-10-02 14:05:10 -07:00
Darren Shepherd a1e5f1c8fc
Merge pull request #89 from ekristen/enhancement/status-handler-lastupdatedtime
Update lastUpdatedTime for StatusHandler when Status Changes
2020-08-08 17:48:46 -07:00
Darren Shepherd 280755bca4 Add ability to scan folders for types 2020-07-14 13:04:54 -07:00
Darren Shepherd e1714e99d9 Don't require CRD to exist on start 2020-05-15 08:57:51 -07:00
Darren Shepherd 23f6fe0d6f Refactor to use AddToScheme for scheme.All 2020-05-15 08:57:51 -07:00
Erik Kristensen 79dd8a4cdc ensure the condition is set first 2020-04-28 10:42:17 -06:00
Erik Kristensen 0da9c1e4ff update lastUpdatedTime for StatusHandler only when the status has changed 2020-04-28 10:26:46 -06:00
Darren Shepherd 336ec59dc0 Don't require type to exist until controller is started 2020-04-27 10:18:15 -07:00
Darren Shepherd 464d24debe Lasso refactor 2020-04-15 22:19:21 -07:00
Darren Shepherd 47235df3f6 Optimistically delete objs when owner is deleted 2020-03-28 14:44:56 -07:00
Darren Shepherd 225a41c76b Upgrade to k8s 1.18 2020-03-26 12:13:23 -07:00
Darren Shepherd 428d9e306b Performance enhance for large index results 2020-03-01 21:34:49 -07:00
Darren Shepherd 661f00f286 Properly compare and mutate status 2019-12-05 12:06:17 -07:00
Darren Shepherd c2c1730b60 Add support for generating third party clientsets 2019-10-24 17:07:58 -07:00
Darren Shepherd f2a6ecca4f Import wrangler condition 2019-10-14 21:29:16 -07:00
Darren Shepherd 2044a7b2bb Add status handler and generating handlers 2019-10-14 10:15:49 -07:00
Darren Shepherd b179d5fcd4 Include equality package to avoid staging confusing 2019-09-05 12:39:12 -07:00
Darren Shepherd 85059e9562 Add plural name constant to generated code 2019-08-24 11:16:28 -07:00
Darren Shepherd 901068548f Don't require Kind/APIVersion to be set for object to passed to apply 2019-06-11 17:22:32 -07:00
Darren Shepherd 4202dbfa88 Create controller on Enqueue 2019-05-25 23:12:52 -07:00
Daishan Peng d1ff29d245 remove empty line 2019-05-07 15:07:02 -07:00
Darren Shepherd 11fc1ecb7b
Merge pull request #13 from luthermonson/codegen-gopath
initial try at gomod fix
2019-05-07 14:31:51 -07:00
Daishan Peng 31f3a4b0e3 make qps configurable 2019-05-03 11:29:30 -07:00
Luther Monson 3953c4f5e7 initial try at gomod fix 2019-04-30 12:49:06 -07:00
Luther Monson bb5670702e default if empty namespace 2019-04-19 11:09:18 -07:00
Luther Monson bce14d4085 code gen for config with namespace 2019-04-18 09:43:23 -07:00
Dan Ramich e12ee00f37 Fix filenames 2019-04-17 10:54:56 -07:00
Darren Shepherd 12a0422c63 Be explicit in package name 2019-04-17 10:35:57 -07:00
Dan Ramich 0f709cf0b7 Gen fakes for controllers 2019-04-05 16:58:10 -07:00
Darren Shepherd a6b17de10a Move norman frameworks to wrangler 2019-03-28 11:47:54 -07:00
Darren Shepherd 30e6416c03 More fixes around import paths 2019-03-20 10:18:36 -07:00
Darren Shepherd 978a871608 Add methods to get to generic informers from controllers 2019-03-20 09:05:15 -07:00
Darren Shepherd d44da127f6 Fix typos 2019-03-19 16:31:09 -07:00