Commit Graph

134 Commits

Author SHA1 Message Date
Tim Hockin
6607834207
Use the same report files as before 2023-05-09 19:33:21 -07:00
Tim Hockin
ef796dca9b
Simpler openapi gen - subprojects do themselves
This involves moving the report files, but it allows me to delete the
indirect variable and indirect array code in update-codgen.  As proud as
I was of figuring that out, I am also ashamed of myself for doing it.

This is my atonement.
2023-05-09 16:24:18 -07:00
Tim Hockin
93b2845bec
Codegen: subprojects openapi
Use the "subprojects" aspect of update-codegen to generat openapi for
the subprojects.  Next we can simplify and remove the generic support.

apiextensions-apiserver seems like it was ALWAYS broken:
k8s.io/apiextensions/ doesn't exist, but k8s.io/apiextensions-apiserver
does.

Fixing that causes different openapi results, obviously.
2023-05-09 16:24:17 -07:00
Alexander Zielenski
4721ec7519 include apiextensions types in apiextensions generated openapi
k8s_tag_files_matching looks for a slash after its argument, so the current value doesnt match anything

also update codegen

this is required for apiextensions-apiserver tests. After fixing apiextensions server tests to use type-aware SSA (instead of erroneously using untyped SSA) there were errors since none of the apiextensions types were actually used in the openapi given to tests.
2023-05-01 13:18:44 -07:00
Tim Hockin
5668399a87
Codegen: use openapi-gen via k8s.io/code-generator 2023-04-12 17:08:36 -07:00
Kubernetes Prow Robot
ad85a92dd4
Merge pull request #116281 from thockin/codegen_subproject_chdir
Codegen: subproject cleanups and chdir
2023-04-12 09:58:31 -07:00
Kubernetes Prow Robot
4c022ceb2c
Merge pull request #116283 from thockin/codegen_fix_full_regen
Codegen: fix full (burn it to the ground) regen
2023-04-11 15:35:56 -07:00
Tim Hockin
73eb7c0930
Codegen: easier to read logs for subproject output 2023-04-11 15:19:27 -07:00
Tim Hockin
bbbb695060
Codegen: subproject: chdir to the project dir
This makes it feel more like an API to be used in other repos (which is
really what it is for).
2023-04-11 15:18:08 -07:00
Tim Hockin
893ec0ca45
Codegen: simpler k8s.io/code-generator/examples
This moves the hack/ directory and scripts to the examples dir, which is
a distinct module.  This avoids some Go unpleasantness around module
boundaries and just makes more sense.
2023-04-11 14:19:45 -07:00
Maciej Szulik
27ad623b3d
Skip vendor directory when removing generated files 2023-03-27 19:07:43 +02:00
Tim Hockin
64ecb161d4
Codegen: git grep returns non-zero if no match 2023-03-05 12:20:15 -08:00
Tim Hockin
241d46d1dd
Codegen: deepcopy needs to run before swagger 2023-03-05 12:20:15 -08:00
Tim Hockin
3405853e6d
Codegen: clean up stray ls-files use 2023-03-05 12:20:14 -08:00
Kubernetes Prow Robot
a1f4fa0b0c
Merge pull request #116141 from thockin/codegen_script_wide_vars
Codegen: set LC_ALL and unset GREP_OPTIONS
2023-02-28 14:54:23 -08:00
Tim Hockin
6a09ba8f52
Codegen: set LC_ALL and unset GREP_OPTIONS
LC_ALL is always wanted and GREP_OPTIONS is never wanted.  The `grep
--color=never` dates back to 2016, an issue with OLD grep on Macs, which
was hard to deal with when this was all Makefile magic.  Now that it's a
script, we can do it simpler.
2023-02-28 10:17:52 -08:00
Tim Hockin
23eaa6e1e4
Fix codegen for older bash 2023-02-27 11:57:46 -08:00
Jordan Liggitt
71174aa2da
Generate proto uncontainerized if host has required protoc version 2023-01-26 18:00:10 -05:00
Kubernetes Prow Robot
91cfe7f0c3
Merge pull request #115246 from thockin/codegen-11-swagger-from-update-codegen
Generate swagger from update-codegen
2023-01-22 11:24:10 -08:00
Kubernetes Prow Robot
bc2fccaa96
Merge pull request #115245 from thockin/codegen-10-protobuf-from-update-codegen
Call update-generated-protobuf from update-codegen
2023-01-22 11:24:03 -08:00
Tim Hockin
1c466a8190
Generate swagger from update-codegen
Swagger "docs" are actually Go code, which is used by other codegen
tools, so if you really want to regen EVERYTHING, this is part of it and
sequence matters.
2023-01-21 16:51:25 -08:00
Tim Hockin
0ef664c278
Call update-generated-protobuf from update-codegen
Calling update-codegen.sh with no arguments runs all the functions in
definition order.  Client-generation depends on protobuf, so protobuf
codegen needs to be near the beginning.

Also add some debug output for protobuf generation.

Also hide some old, verbose debug output.
2023-01-21 16:32:18 -08:00
Tim Hockin
afae402865
Add debug output for protobindings generation 2023-01-21 15:17:46 -08:00
Tim Hockin
c8ce229e64
Codegen: rm protobindings 2023-01-21 15:17:45 -08:00
Tim Hockin
4dae505d53
Call update-proto-bindings from update-codegen
One script to bring them all ...
2023-01-21 15:17:42 -08:00
Kubernetes Prow Robot
589300dd84
Merge pull request #115198 from thockin/codegen-7-remove-genfiles-part1
Codegen: remove generated files before regenerating
2023-01-21 14:34:02 -08:00
Tim Hockin
ac90c60cff
Codegen: rm informer files before regen 2023-01-21 11:39:27 -08:00
Tim Hockin
9a11efa719
Codegen: rm lister files before regen 2023-01-21 11:39:09 -08:00
Tim Hockin
bb53ed4ff6
Codegen: rm client files before regen 2023-01-21 11:38:44 -08:00
Tim Hockin
b852b36555
Codegen: rm applyconfig files before regen 2023-01-21 11:38:17 -08:00
Tim Hockin
6aea6fe86b
Codegen: rm openapi files before regen 2023-01-21 11:31:04 -08:00
Tim Hockin
7f87ecfb9a
Codegen: rm conversion files before regen 2023-01-21 11:30:42 -08:00
Tim Hockin
e149f79d4e
Codegen: rm defaults files before regen 2023-01-21 11:30:22 -08:00
Tim Hockin
3f0c3f33ca
Codegen: rm prerelease files before regen 2023-01-21 11:30:05 -08:00
Tim Hockin
07f7941de6
Codegen: rm deepcopy files before regen 2023-01-21 11:29:40 -08:00
Tim Hockin
b201c08cea
Simplify find in codegen
The `find` tool has hard to comprehend syntax and does not consider
things excluded by .gitignore.  I keep tripping over this in my own
repos, where I have __stuff which gets found.

This converts update-codegen to use `git ls-files` in a seemingly
equivalent way (`-cmo --exclude-standard`).  I verified it finds the
same set of files as before.

This also drops some obsolete filtering.

Also hide grep errors for not-found files, which can happen if a file is
removed but git ls-files still knows it.

Re-running update-codegen shows no diffs.

This will make subsequent changes easier.
2023-01-21 11:22:39 -08:00
Tim Hockin
8fbcad4612
Call 'go install' instead of build.sh
The env vars are needed until go workspaces lands, then it can get
simpler.

Downsides to this:
  1) If you don't call kube::golang::setup_env, it might work but will
     just splat results somewhere
  2) The resultant binaries are not in _output/bin but instead in the
     phony GOPATH/bin (which setup_env puts in PATH)
2023-01-20 10:44:02 -08:00
Alexander Zielenski
63f109e149 use --null instead of -Z in grep invocation
BSD grep has a different behavior from GNU grep with -Z.

--null has consistent behavior accross both implementations
2023-01-13 15:31:05 -08:00
Tim Hockin
709dadb899
codegen: safer use of 'sort' and 'xargs'
`LC_ALL=C` is consistent regardless of locale

`xargs -0` is safe when filenames may have spaces
2022-12-26 16:08:59 -08:00
Tim Hockin
d8988801c2
Remove old make-helper script 2022-10-04 08:58:46 -07:00
Tim Hockin
7afaf23b01
Copy make's codegen logic to update-codegen.sh
The `make` rules which auto-generate some of our API stuff are
incredibly baroque, and hard to maintain.  They were originally added on
the assumption that we would stop checking generated files into git.
Since then we have moved away from that goal, and the worst problems
with generated files have been resolved.

Reasons to kill this:
* It is slow on every build, as opposed to just being slow when running
  the generators.  It is even slow to calculate that there's nothing to
  update.
* Most development work doesn't involve changing APIs.
* It only covers about half (or less) of the generated code, and making
  it cover more would be even slower.
* Approximately 1 person knows how this all works.
* We have CI to make sure changes do not get merged without updating
  this code.
* We have corner cases where this does the WRONG thing and tracking
  those down is ugly and hard in perpetuity.

So this commit puts all the same logic that WAS in the
Makefile.generated_files into update-codegen.sh.

I do not love this script, especially WRT sub-packages, but I am trying
not to boil the ocean.  I hope to follow up with some more cleanups over
time.

I have tested this manually and with the scripts and it still seems to
catch errors properly.

This includes a change to kube::util::read-array to make it not unset
variables and not over-write non-array variables.
2022-10-04 08:48:39 -07:00
Tim Hockin
b52b50bcea update-codegen: reorder some lines for later diffs 2022-10-04 08:45:57 -07:00
Tim Hockin
89e0e09eb9 Format calls to codegens
No functional changes here,just formatting.  Makes future commits
easier.
2022-10-04 08:45:57 -07:00
Jordan Liggitt
39f5c13510 drop vendor from go install paths 2022-05-05 08:47:33 -04:00
Joe Betz
987657a80f Add extract apply function generation 2021-03-10 06:13:51 -08:00
Joe Betz
293e07a836 Add Apply functions to client-gen 2021-03-06 20:49:06 -05:00
Joe Betz
09cc895c84 Add apply configuration generator 2021-03-04 10:29:54 -08:00
Kubernetes Prow Robot
e2c5387d3f
Merge pull request #93164 from roycaihw/fix/clientgen-use-canonical-import-path
Use canonical import path in client-gen input-base
2020-09-02 13:37:21 -07:00
Jordan Liggitt
d8b0f6fc50 Build code-generator tools directly 2020-08-02 10:56:46 -04:00
Haowei Cai
5de47de7cf use canonical import path in client-gen so that package comments are
honored
2020-07-16 14:54:06 -07:00