Commit Graph

166 Commits

Author SHA1 Message Date
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
Jordan Liggitt
0b32e142d4 Drop k8s.io/node-api packages 2020-02-07 10:07:14 -05:00
tanjunchen
b2f76cc780 add comment in hack/update-*.sh 2020-01-16 10:05:49 +08:00
Haines Chan
2d3893d2c1 Fix wrong indentation in shell 2019-07-05 17:11:15 +08:00
Christoph Blecker
badac1b31c
Swap mapfile out in update-codegen 2019-05-11 16:19:26 -07:00
SataQiu
9863f26706 fix shellcheck failures of hack/update-codegen.sh 2019-04-12 19:15:56 +08:00
yue9944882
cabe69faeb clean up unused vars in codegen scripts 2019-04-10 13:14:36 +08:00
yue9944882
ced03fb698 remove internal client from udpate-codegen script 2019-04-09 21:43:54 +08:00
Michelle Au
d2aa8178f2 Remove alpha CRD install 2019-04-02 10:59:11 -07:00
Tim Allclair
03fdecbde4 Add node-api code generators 2018-12-18 16:06:56 -08:00
zuoxiu.jm
efeec1edee remove internal informer/lister generator 2018-10-29 11:37:55 +08:00
Jan Safranek
5ceb26d224 Add new csi-api repo to staging 2018-08-31 03:49:50 -07:00
Matthias Bertschy
9b15af19b2 Update all script to use /usr/bin/env bash in shebang 2018-04-19 13:20:13 +02:00
fisherxu
32319d6ef7 add boilerplate.generatego.txt and let all code-generators use it
remove YEAR field in boilerplate under staging

add Do Not Edit for types_swagger_doc and add apiextensions-apiserver's example in codegen.sh
2018-03-08 17:52:44 +08:00
Christoph Blecker
57ca909d60
Partial revert of fb5caac2da 2018-02-14 11:31:51 -08:00
Kubernetes Submit Queue
fb5caac2da
Merge pull request #59797 from ipuustin/shell-bugfix3
Automatic merge from submit-queue (batch tested with PRs 59532, 59685, 59797). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Continue fixing bash scripts

**What this PR does / why we need it**:

This PR continues the work of fixing bugs in shell scripts (see https://github.com/kubernetes/kubernetes/pull/59572 for the previous PR). The fixed scripts are `hack/grab-profiles.sh` and `hack/update-codegen.sh`. Most of the issues are found by using `shellcheck`. The goal is to make the scripts work and behave as they did previously, but fix obvious bugs and make them more robust and resilient for irregular input such as file names with special characters or whitespace in them.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-02-13 18:48:33 -08:00
Ismo Puustinen
6beb1ddac3 hack/update-codegen.sh: fix finding api names.
Use "find -exec" instead of plain "find | xargs" to fix handling of
difficult file names (such as those containing spaces). Also, use
"mapfile" for creating the array from the output instead of letting the
shell split the results into the array. Add double quotes to places
where variable handling needs it to prevent splitting and globbing.
2018-02-13 15:45:37 +02:00
Ismo Puustinen
a9905f2ad3 hack/update-codegen.sh: fix finding items in an array.
The current code

  if ! [[ " ${INTERNAL_DIRS[@]:-} " =~ " ${int_group} " ]]; then

is broken because the array is concatenated in [[ .. ]] structure. This
means that the match will be done to any substring in the resulting
string which just happens to include ${int_group}. Fix this to use a
loop instead, and do exact matching. Also make tabs consistent in the
for loop.
2018-02-13 15:45:37 +02:00
Ismo Puustinen
b6fbe2aee5 hack/update-codegen.sh: split string into array robustly.
Use "mapfile" and "read" to split the $KUBE_AVAILABLE_GROUP_VERSIONS
string into an array using space as the delimiter. This prevents shell
from globbing and splitting the string in potentially wrong places.
2018-02-13 15:41:00 +02:00
Nikhita Raghunath
ebad418c29 add --go-header-file to use kube boilerplate 2018-02-13 12:34:54 +05:30
Dr. Stefan Schimanski
94d2a67263 client-gen: use --output-package instead of --clientset-path 2017-11-30 10:18:29 +01:00
gmarek
69e2a9cb48 Add new Events API group 2017-11-22 18:40:09 +00:00
Dr. Stefan Schimanski
3ba9d1d0e0 Remove unused pkg/apis/policy/v1alpha1 2017-11-14 13:47:29 +01:00
Kubernetes Submit Queue
899f7ff97d
Merge pull request #55403 from sttts/sttts-client-gen-ext-group-list
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

code-generator: move kube group list out of client-gen

We had a hard-coded group list in the client-gen code for the internal Kubernetes api groups. For the external groups, we collected the actual GVs in update-codegen.sh. This PR does the latter for internal groups as well.
2017-11-09 09:42:51 -08:00
Dr. Stefan Schimanski
12eb6a01eb code-generator: move kube group list out of client-gen 2017-11-09 15:06:43 +01:00
Dr. Stefan Schimanski
7e62297b68 pkg/apis/core: fix code generation 2017-11-09 12:14:07 +01:00
Maru Newby
adc338d330 Remove all traces of federation 2017-10-26 13:37:37 -07:00
James Munnelly
740afa0e65 Add sample CustomResourceDefinition controller
sample-controller: add API types

sample-controller: regenerate files

sample-controller: add implementation

sample-controller: update bazel

sample-controller: update make-rules and cache_go_dirs

sample-controller: Set noStatus tag. Remove openapi-gen tag.

sample-controller: add deletion tombstone handling logic

sample-controller: update README, remove use of reflect in UpdateFuncs

sample-controller: add OWNERS file

sample-controller: add LICENSE
2017-10-19 00:21:57 +01:00
Dr. Stefan Schimanski
e3a3d108fb Fixup after k8s.io/{kube-gen -> code-generator} rename 2017-08-17 17:55:12 +02:00
Dr. Stefan Schimanski
4b709e8485 kube-gen: unify update-codecgen.sh scripts 2017-08-04 08:03:15 +02:00
shashidharatd
1a93c46197 Stop generating federation internal clientset 2017-07-26 06:20:08 +05:30
Chao Xu
a87ed3871d generate clientset, external listers, and external informers to client-go directly 2017-07-21 13:13:35 -07:00
Dr. Stefan Schimanski
70947fa3a2 Make staging hack/update-codec.sh scripts relocatable and kube independent 2017-07-20 07:41:37 +02:00
Dr. Stefan Schimanski
edfbb9aa64 Fixup go2idl references 2017-07-20 07:41:37 +02:00
Chao Xu
0a853fec93 hack/lib/init.sh util.sh update-codegen.sh 2017-06-22 11:30:57 -07:00
Dr. Stefan Schimanski
33e50da9f4 Rename {kube- ->}apiextensions-{-> api}server 2017-06-06 12:06:31 +02:00
Solly Ross
0b43fffa48 Enable client-gen for k8s.io/metrics
This commit turns on client-gen for k8s.io/metrics.  Clients are
generated for `k8s.io/metrics/pkg/apis/metrics` (both internal and
v1alpha1).  `k8s.io/metrics/pkg/apis/custom_metrics` uses a bespoke
client due to the unique nature of its paths.
2017-05-10 13:33:18 -04:00
deads2k
ed27887ad2 wire new staging repo 2017-05-02 08:43:31 -04:00
Jordan Liggitt
ad116026d9
Remove vestiges of defaulting from conversion path, switch to top-level default registration only 2017-04-12 13:36:15 -04:00
Jess Frazelle
fe84363ce2
Add settings API and admission controller
export functions from pkg/api/validation

add settings API

add settings to pkg/registry

add settings api to pkg/master/master.go

add admission control plugin for pod preset

add new admission control plugin to kube-apiserver

add settings to import_known_versions.go

add settings to codegen

add validation tests

add settings to client generation

add protobufs generation for settings api

update linted packages

add settings to testapi

add settings install to clientset

add start of e2e

add pod preset plugin to config-test.sh

Signed-off-by: Jess Frazelle <acidburn@google.com>
2017-03-01 13:04:28 -08:00
deads2k
1d40c3ff76 update scripts for new kube-aggregator location 2017-02-14 14:16:59 -05:00
Irfan Ur Rehman
45bef274b4 [Federation] update client generation script to include autoscaling resources 2017-01-22 12:27:56 +05:30
deads2k
76af9ded47 disable setgen that no one uses and generates improperly 2017-01-17 11:10:33 -05:00
deads2k
e100e8990b update generation bash to handle vendor dir 2017-01-17 09:06:34 -05:00
deads2k
453651cbfc rename kubernetes-discovery to kube-aggregator 2017-01-10 12:27:42 -05:00
jianhuiz
c885dd40d3 update client generation scripts to include batch/Job for federation 2016-12-15 09:58:33 -08:00
Chao Xu
f6f71c32b6 change release_1_5 to clientset in staging/copy.sh
modify update-codegen.sh
2016-12-14 12:39:36 -08:00
deads2k
0a6193fbe4 add apiregistration types 2016-12-06 13:45:10 -05:00
Clayton Coleman
3e43343815
Use xargs -n1 dirname for greater bash compat on Mac 2016-12-03 18:57:31 -05:00
Andy Goldstein
3bc87f9338 Add generated informers 2016-11-30 09:17:12 -05:00
Clayton Coleman
35a6bfbcee
generated: refactor 2016-11-23 22:30:47 -06:00
Andy Goldstein
f85ac9023a Add lister-gen 2016-10-31 11:13:43 -04:00
Chao Xu
850729bfaf include multiple versions in clientset
update client-gen to use the term "internalversion" rather than "unversioned";
leave internal one unqualified;
cleanup client-gen
2016-10-29 13:30:47 -07:00
Marcin
a333687889 Add config map to federated client 2016-10-17 23:44:16 +02:00
Marcin
64d5335f98 Daemonset in federated clientset 2016-10-05 19:58:49 +02:00
Marcin
34753b6950 Add deployment to federation clientset 2016-10-05 13:43:59 +02:00
deads2k
7a8fa18116 update generation scripts to share API group version constants 2016-09-22 13:30:41 -04:00
Matthew Wong
cc958818db Add storage api group to hack/update-codegen.sh 2016-09-19 15:49:40 -04:00
Mike Danese
0c76cf5c5c fix hack/verify-codegen.sh 2016-09-14 16:33:19 -07:00
Chao Xu
eafc03cfb5 update the script 2016-09-08 16:03:07 -07:00
Matt Liggett
44b2c862ef Rewrite disruption e2e test to use versioned client. 2016-08-30 12:34:45 -07:00
nikhiljindal
2619d0440d Adding events to federation clientset and adding an e2e 2016-08-12 17:47:49 -07:00
Kubernetes Submit Queue
8da4d96839 Merge pull request #30112 from nikhiljindal/federationIngressAPI
Automatic merge from submit-queue

Adding ingress resource to federation apiserver

Fixes https://github.com/kubernetes/kubernetes/issues/29342

cc @kubernetes/sig-cluster-federation

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.kubernetes.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.kubernetes.io/reviews/kubernetes/kubernetes/30112)
<!-- Reviewable:end -->
2016-08-10 00:08:41 -07:00
nikhiljindal
af692e3714 Updating the generated client to include ingress 2016-08-05 16:04:34 -07:00
deads2k
32920b5617 add subjectaccessreviews resource 2016-08-05 11:20:56 -04:00
kshafiee
262ae3d021 Adding secrets to federation-apiserver & clientset, adding e2e tests 2016-08-03 02:43:48 +00:00
jianhuiz
6e3741d769 change client generation scripts to include extensions/ReplicaSet for federation 2016-07-21 14:00:35 -07:00
nikhiljindal
7b664cff47 Updating the federation clientset to include namespaces 2016-07-19 07:38:58 -07:00
Tim Hockin
9eb42ff108 Don't check in generated conversion code
Conversion is now generated by Makefile, on demand, rather than all at once.
Manually verified no net change in generated code.
2016-07-12 21:52:54 -07:00