Commit Graph

8 Commits

Author SHA1 Message Date
Dave Protasowski 36226ee206
Update Knative injection-gen to use gengov2 (#3146)
* refactor codegen into different packages and use gengo v2

This allows us to run this injection against types that have newer golang features - eg. 'any'

* updated go.mod drops gengo v1

* tweak scripts to support gengov2 framework

* drop verbose output
2025-02-11 17:07:50 +00:00
Dave Protasowski ee1db869c7
Update linter config and address lint warnings/failures (#3068)
* fix whitespace linter

* fix usestdlibvars

* fix staticheck

* ignore spancheck warning

* fix linter perfsprint

* fix nolintlint feedback

* fix nilerr lint checks

* fix misspell

* fix mirror lint

* fix intrange linter

* fix gofumpt linter

* fix gosec linter - ignore warning since default min tls version is 1.3

* fix gocritic linter

* fix whitespace

* fix fatcontext linter

* fix errorlint

* fix errname linter

* fix copyloopvar (go1.22) linter

* fix bodyclose linter

* update linter config

* add script to format code

* fix unit test
2024-06-25 14:49:36 +00:00
Stavros Kontopoulos f69f148b7c
Optionally generate an init func for an informer (#2989)
* Optionally generate an init func for an informer

* lint

* move condition to go template

* rename flag and fixes

* pass flag value via the generator
2024-03-28 13:51:56 +00:00
Dave Protasowski dfb4bf0463
Drop dynamic wrapper injection code generation (#2742)
* drop dynamic wrapper injection codegen

* run update codegen
2023-05-18 10:57:12 +00:00
Dave Protasowski 5dd89c68db
Support istio *List types where Items is an array of pointer types (#2613)
Generally K8s types have a list type where the 'Items' member is an
array of structs.

ie. https://pkg.go.dev/k8s.io/api@v0.25.3/apps/v1#DeploymentList

type DeploymentList struct {
	...
	// Items is the list of Deployments.
	Items []Deployment `json:"items" protobuf:"bytes,2,rep,name=items"`
}

Istio is an exception where the list contains pointers to structs

type GatewayList struct {
	...
	Items       []*Gateway `json:"items" protobuf:"bytes,2,rep,name=items"`
}

To hint that the list types are pointers you can now pass the flag
'--lister-has-pointer-elem'.

Ideally we could infer this info by inspecting the types but
unfortunately the generator doesn't load this information
2022-10-20 14:09:13 +00:00
Scott Nichols 8a6d25b309
Generate reconcilers for resources out of tree. (#1175)
* genreconciler:nonNamespaced

* Adding a force-kinds flag to the reconciler generator to allow us to generate reconcilers for non-owned types.

* force-kinds --> force-genreconciler-kinds

* some minor nits with the generators for non-knative types needed to be removed.

* remove whitespace

Co-authored-by: Nacho Cano <nachoacano@gmail.com>
2020-03-25 11:34:51 -07:00
Scott Nichols b317048346
Generate Base Reconciler Code for Injection Based Controllers. (#947)
* adding a reconciler generator to use as the base reconcilers for all of knative.

* mend

* fix tag names.

* use reconciler events

* trying new thing.

* base working reconciler gen

* working cleaned up reconciler generator.

* fix typo

* fix some ordering.

* fix interface path

* fix whitespace

* update deps.

* updates based on feedback.

* Remove core loop.

* reconcilerImpl

* add NewReconciler

* Fix copyright header

* Comment out finalizers

* remove finalizers from generated code.
2020-02-04 10:23:30 -08:00
Matt Moore 35bb0fc83b Add code-generation for the various injection stubs. (#438)
This is largely based on work by @n3wscott
2019-06-05 08:50:38 -07:00