Commit Graph

74 Commits

Author SHA1 Message Date
Felipe C. Gehrke 670648da81 reverting back 2024-10-09 15:48:18 -03:00
Felipe C. Gehrke 62427bff02 adjusting error message 2024-10-09 15:39:30 -03:00
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 432899a5aa removed exp/maps 2024-10-02 18:49:02 -03:00
Felipe C. Gehrke 433b7d1214 addressing comments from tomleb 2024-09-30 14:50:39 -03:00
Felipe C. Gehrke 2317fcbd24 updated to add openapi dependencies + another fix 2024-09-26 18:17:42 -03:00
Felipe C. Gehrke 39d89c60f8 added openapi codegen 2024-09-24 15:52:01 -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 ac51d2631c Comment regarding package fields 2023-09-06 10:11:11 -07: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
Matt Farina 004a7a2100
Updating per lint scan
Signed-off-by: Matt Farina <matt.farina@suse.com>
2023-02-27 14:15:52 -05:00
Kevin Joiner 707ef06124 Fix golangci-lint errors 2023-02-21 09:14:27 -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 e84375eed7 Sort packages to ensure consistent codegen 2020-07-19 22:35:48 -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
Daishan 6a731953f0 Fix owner reference bug, add CustomColumn support 2019-10-21 09:55:22 -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
Daishan 4eeae2144a Make mock optional 2019-09-04 23:34:12 -07:00
Darren Shepherd 85059e9562 Add plural name constant to generated code 2019-08-24 11:16:28 -07:00
Dan Ramich ba6009c463 Make mock generation optional 2019-07-02 15:21:53 -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
Darren Shepherd c66eb51b3a Add back missing copy 2019-05-24 23:32:06 -07:00