Commit Graph

25 Commits

Author SHA1 Message Date
Francesco Guardiani ca02ef752a
Genreconciler properly generates reconciler for Resources with Status (#2004)
* Fix #2003

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Removed useless newline

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Removed useless check

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

* Now we don't have any newlines anymore

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
2021-01-29 16:18:31 -08:00
qibobo 1bbf0a6436
add LabelSelector to InformerFactory so that the informers only list and watch resources with the given labels (#1940)
* add  filtered InformerFactory and informers which only list and watch resources with the given labels

* rename to RegisterFilteredInformers

* generated files

* typo

* update per comments

* rename file

* rm old files
2021-01-19 08:21:23 -08:00
Victor Agababov 247841408e
Apply the cleanup to the pkg (#1776)
* Apply the cleanup to the pkg

This is probably the final iteration of my cleanup application.

* codegen

* one more try
2020-10-05 21:41:20 -07:00
Victor Agababov 5d1dfa9ef7
Improve the logging messages in the reconciler generator. (#1750)
And other minor nits.
2020-09-28 13:32:28 -07:00
Markus Thömmes 754da4653a
Enable unparam linter to catch unused parameters (#1731) 2020-09-22 09:13:40 -07:00
Scott Nichols ae9c3f7fa8
Refactor the genreconciler code to pull state out (#1544)
* Refactor the genreconciler code to pull state out

* don't generate the stubs

* fix indent
2020-07-22 23:02:57 -07:00
Weston Haught aa30bc3ac0
expect resoruces are krshaped by default (#1430) 2020-06-23 10:21:27 -07:00
Victor Agababov b10849aacf
Some nits in the genreconciler (#1328)
* Some nits in the genreconciler

- make sure we allocate proper amount of slice space
-  `t:=t` is needed only if you're doing goroutines in the loop
- extract constants outside of the loops.
- reformat

* meh, I was wrong
2020-05-12 12:11:30 -07:00
Weston Haught 2a7c3fd8e2
use our tag parser (#1327) 2020-05-12 10:45:58 -07:00
Weston Haught 00ce2bb1b4
krshaped should be part of genereconciler (#1326) 2020-05-12 08:28:03 -07:00
Weston Haught b559da3646
Generate common logic for krshaped resources (#1311)
* generate krshaped logic

* add logic to the tag

* Update injection/README.md

Co-authored-by: Matt Moore <mattmoor@vmware.com>

* move var to reconciler

Co-authored-by: Matt Moore <mattmoor@vmware.com>
2020-05-08 10:00:45 -07:00
Matt Moore 3da93ebb24
Properly set hasClass (#1296)
This was changed in #1277
2020-05-05 12:10:44 -07:00
Weston Haught 10ba977860
Create our own comment parser for codegen (#1277)
* Adapt our own comment parser

* Use our new comment parser to extract tags

* Update codegen/cmd/injection-gen/generators/comment_parser.go

Co-authored-by: Victor Agababov <vagababov@gmail.com>

* Update codegen/cmd/injection-gen/generators/comment_parser_test.go

Co-authored-by: Victor Agababov <vagababov@gmail.com>

* Update codegen/cmd/injection-gen/generators/comment_parser.go

Co-authored-by: Victor Agababov <vagababov@gmail.com>

* Update codegen/cmd/injection-gen/generators/comment_parser.go

Co-authored-by: Victor Agababov <vagababov@gmail.com>

* Update codegen/cmd/injection-gen/generators/comment_parser_test.go

Co-authored-by: Victor Agababov <vagababov@gmail.com>

* Update codegen/cmd/injection-gen/generators/packages.go

Co-authored-by: Victor Agababov <vagababov@gmail.com>

* suggestion didn't compile

* Update codegen/cmd/injection-gen/generators/comment_parser.go

Co-authored-by: Victor Agababov <vagababov@gmail.com>

* trimspace

* include test for ,,, case

* add empty check

* fix comment

Co-authored-by: Victor Agababov <vagababov@gmail.com>
2020-05-04 09:42:43 -07:00
Markus Thömmes c09083a601
Fix a few simple linter warnings: unused code, govet warnings etc. (#1191) 2020-04-06 08:21:20 -07: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 5d8a01d12c
Implement strongly typed class reconcilers (#1103)
* Implement strongly typed class reconcilers

* document class filters.

* matt is always right
2020-02-19 08:38:06 -08:00
Scott Nichols 72f3cd2bbc
[Genreconciler] Fix group names when client groups differ than their directory name. (#1097)
* looking at annotations for group overrides.

* checkpoint.

* checkpoint

* I think it is correct.

* ok

* trim down the files.

* simulate tekton

* working test out of checkin

* remove test client

* update docs

* and test.

* lint

* it ok

* update codegen
2020-02-18 17:14:59 -08:00
Scott Nichols 248c9f0353
fix filtering for reconcilers gen. (#1071) 2020-02-11 05:26:07 -08:00
Scott Nichols 85608a8329
Generate Managed Finalizers for Reconcilers (#1069)
* fix rando issues

* code in the group for finalizer name.

* Use FinalizeKind

* show the Finalizer interface.

* removing isFinalizing

* sync finalizers before calling reconcilekind

* missed the events change.
2020-02-10 19:46:06 -08:00
Scott Nichols b9974987c2
Fix issue with returning errors, and not adding scheme (#1049) 2020-02-04 18:03:30 -08: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 43ca049cdb Reduce the boilerplate for setting up duck.InformerFactory's. (#896)
This augments the injection codegen with the capability to produce a duck.InformerFactory
attached to context for each type that we process.

Now a `duck.InformerFactory` for "Addressable" can be produced by "Get"ing it from the context.

This is triggered by placing `// +genduck` on the type that implements `duck.Implementable`.
2019-11-25 09:57:10 -08:00
Dave Protasowski 528ad1c1dd Generate K8s Injection Code (#640)
* update codegen so the fatal error messages are more informative

String representation of an untyped nil is 'nil' so the Fatal messages weren't useful

* generate k8s injection code

* generate apiextensions injection code

* use Fatal & move output paths

* switch from Fatal to Panic

* injection creates a single factory
2019-09-09 12:52:11 -07:00
Matt Moore 222dd25986 Migrate pkg to use the knative.dev/pkg import path (#489)
* Manual changes.

* scripted changes.
2019-06-26 13:02:06 -07: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