Commit Graph

10076 Commits

Author SHA1 Message Date
Tim Hockin
90e6546c68 Use go.work to auto-find internal modules 2024-03-02 14:38:25 -08:00
Kubernetes Prow Robot
0364c6cc3d Merge pull request #123623 from pohly/hack-protoc-search-path
hack: re-enable protobindings which use k8s.io/api
2024-03-02 10:26:20 -08:00
Tim Hockin
e2b96b2566 Add a header to go.work 2024-03-01 16:23:21 -08:00
Patrick Ohly
f34782bb92 hack: re-enable protobindings which use k8s.io/api
Before the workspace changes, it was possible to include proto files via the
vendor path and the symlinks there. Now those symlinks are gone, so the search
path for them must be given separately.
2024-03-01 21:53:13 +01:00
Kubernetes Prow Robot
df366107d1 Merge pull request #123529 from thockin/go-workspaces
Go workspaces for k/k and k/staging/*
2024-03-01 08:43:03 -08:00
Sotiris Salloumis
ce8bd8584e Configure cpumanager policy options in local-up-cluster
CPU Manager policy options cannot be configured with
KUBELET_FLAGS. They need to be included in kubelet
configuration instead.

This commit allows the configuration with the use
of three enviroment variables, following same approach
as done for enabling feature gates.
2024-03-01 11:38:02 +01:00
Tim Hockin
00e09374b6 Make update-codegen avoid sub-workspaces 2024-02-29 22:10:39 -08:00
Tim Hockin
70d803c1ff Make make fail better with bad inputs
Ultimately, we're hitting places where bash is just hard to get right.

Instead of:

```
$ make WHAT=nonexist
stat /home/thockin/src/kubernetes/nonexist: directory not found
!!! [0228 12:07:12] Call tree:
!!! [0228 12:07:12]  1: /home/thockin/src/kubernetes/hack/lib/golang.sh:930 kube::golang::normalize_go_targets(...)
!!! [0228 12:07:12]  2: hack/make-rules/build.sh:27 kube::golang::build_binaries(...)
+++ [0228 12:07:12] Building go targets for linux/amd64
     (non-static)
no Go files in /home/thockin/src/kubernetes
!!! [0228 12:07:12] Call tree:
!!! [0228 12:07:12]  1: /home/thockin/src/kubernetes/hack/lib/golang.sh:820 kube::golang::build_some_binaries(...)
!!! [0228 12:07:12]  2: /home/thockin/src/kubernetes/hack/lib/golang.sh:974 kube::golang::build_binaries_for_platform(...)
!!! [0228 12:07:12]  3: hack/make-rules/build.sh:27 kube::golang::build_binaries(...)
!!! [0228 12:07:12] Call tree:
!!! [0228 12:07:12]  1: hack/make-rules/build.sh:27 kube::golang::build_binaries(...)
!!! [0228 12:07:12] Call tree:
!!! [0228 12:07:12]  1: hack/make-rules/build.sh:27 kube::golang::build_binaries(...)
make: *** [Makefile:95: all] Error 1
```

We now get:

```
$ make WHAT=nonexist
+++ [0228 12:33:49] Building go targets for linux/amd64
    ./nonexist (non-static)
stat /home/thockin/src/kubernetes/nonexist: directory not found
!!! [0228 12:33:49] Call tree:
!!! [0228 12:33:49]  1: /home/thockin/src/kubernetes/hack/lib/golang.sh:823 kube::golang::build_some_binaries(...)
!!! [0228 12:33:49]  2: /home/thockin/src/kubernetes/hack/lib/golang.sh:976 kube::golang::build_binaries_for_platform(...)
!!! [0228 12:33:49]  3: hack/make-rules/build.sh:27 kube::golang::build_binaries(...)
!!! [0228 12:33:49] Call tree:
!!! [0228 12:33:49]  1: hack/make-rules/build.sh:27 kube::golang::build_binaries(...)
!!! [0228 12:33:49] Call tree:
!!! [0228 12:33:49]  1: hack/make-rules/build.sh:27 kube::golang::build_binaries(...)
make: *** [Makefile:95: all] Error 1

$ make test WHAT=nonexist
+++ [0228 12:33:53] Set GOMAXPROCS automatically to 6
+++ [0228 12:33:53] Running tests without code coverage and with -race
stat /home/thockin/src/kubernetes/nonexist: directory not found
make: *** [Makefile:190: test] Error 1
```
2024-02-29 22:07:43 -08:00
Tim Hockin
81ba0f3b44 Make golang::setup-env turn on workspaces
Both GO111MODULE and GOWORK default to on, so this just unsets them.  We
could set them to explicit values but this seems equivalent and cleaner.
2024-02-29 22:07:42 -08:00
Tim Hockin
1a4450f6ff Get rid of code-generator/cmd/openapi-gen
It's an exact duplicate of k8s.io/kube-openapi/cmd/openapi-gen.
2024-02-29 22:07:37 -08:00
Tim Hockin
067a328284 Move import-boss: k/code-generator/cmd -> k/k/cmd 2024-02-29 22:07:36 -08:00
Tim Hockin
14321ef959 Move doc-generation funcs into only caller 2024-02-29 22:07:33 -08:00
Tim Hockin
8288c06b2b Make hack scripts use go install and assume PATH
Now that they all call setup_env, we don't need find-binary (I think).
That was originally meant to hide the diff between docker and local
builds but all these tools do local builds anyway.
2024-02-29 22:07:32 -08:00
Tim Hockin
ea3696dbcf Remove legacy references to './output' 2024-02-29 22:07:31 -08:00
Tim Hockin
b68340e5b6 Get rid of gengo InputDirs flag 2024-02-29 22:07:23 -08:00
Tim Hockin
e78dc86288 Move import-boss to k/k, retool to not use gengo
* Moved code and tests out of gengo -> code_generator
* Reworked it to use packages.Load
* Reworked tests (still not comprehensive but pretty good?)
* Dropped test support from gengo (support for tests in
  x/tools/go/packages is pretty hostile to gengo, and nobody used it)
2024-02-29 22:07:21 -08:00
Tim Hockin
3a77592b2c Remove gengo verify-only - unused and untested
All of our own tools emit into a tmp tree and then diff that.
2024-02-29 22:07:17 -08:00
Tim Hockin
d0dd72b01e Move OutputFileBase flag to each tool 2024-02-29 22:07:16 -08:00
Tim Hockin
26a1a13b80 Rename output-package -> output-pkg
To parallel "output-dir".
2024-02-29 22:07:15 -08:00
Tim Hockin
6a375b8f4c Move the OutputBase flag to each tool
...and rename to --output-dir
2024-02-29 22:07:14 -08:00
Tim Hockin
0ff7dd1943 Rename gengo DefaultGen -> GolangGenerator 2024-02-29 22:07:12 -08:00
Tim Hockin
bd31265d23 Make update-vendor log the go env 2024-02-29 22:07:08 -08:00
Tim Hockin
4320631265 codegen: Don't need to pass --logtostderr
All the tools already set it internally
2024-02-29 22:07:06 -08:00
Tim Hockin
2c0da11c0a Make verify-shellcheck take optional args 2024-02-29 22:07:05 -08:00
Tim Hockin
19b37f046f Rename update-generated-* dockerized
Now they don't start with "update" and confuse dumb scripts which try to
run all the updates.
2024-02-29 22:07:04 -08:00
Tim Hockin
94b709c0e2 codegen: Use single-dash for '-v' 2024-02-29 22:07:04 -08:00
Tim Hockin
6dbc754ed6 Retool typecheck to be simpler
Instead of walking paths ourselves, just let Go's packages library do
it.  This is a slight CLI change - it wants "./foo" rather than "foo".

This also flagged a few things which seem to be legit failures.
2024-02-29 22:07:00 -08:00
Tim Hockin
965341390f Remove KUBE_GO_PACKAGE
Almost nobody should need it, and if you do, it should be an immediate
smell.
2024-02-29 22:06:58 -08:00
Tim Hockin
5a96a56c80 Fix make test-integration for workspaces 2024-02-29 22:06:57 -08:00
Tim Hockin
d61f299614 Call verify_go_version at the END of setup_env
Prior to this it would download Go, setup the environment, then (maybe)
download Go again.

I renamed verify_go_version to be internal and fixed all callers.
2024-02-29 22:06:56 -08:00
Tim Hockin
e84adf611f Remove references to "GO111MODULE" 2024-02-29 22:06:55 -08:00
Tim Hockin
2a1147a434 Call setup_env from verify-vendor 2024-02-29 22:06:54 -08:00
Tim Hockin
d2a4a1958f Tidy update-vendor-licenses for workspaces 2024-02-29 22:06:53 -08:00
Tim Hockin
d772f7719d Remove defunct references to "vendor" 2024-02-29 22:06:52 -08:00
Tim Hockin
10c32b3e2f Get rid of most references to GOPATH 2024-02-29 22:06:51 -08:00
Tim Hockin
3c2940f2ae Kill off PRJ_SRC_PATH 2024-02-29 22:06:50 -08:00
Tim Hockin
651297220e Fix pin-dependency for workspaces 2024-02-29 22:06:49 -08:00
Tim Hockin
1c3e701e0c Fix verify-spelling for workspaces 2024-02-29 22:06:48 -08:00
Tim Hockin
032dd890a5 Fix verify-external-dependencies-version for workspaces 2024-02-29 22:06:47 -08:00
Tim Hockin
bff2e92edd Fix update-netparse-cve for workspaces 2024-02-29 22:06:46 -08:00
Tim Hockin
fad5bb1cdd Fix lint-dependencies for workspaces 2024-02-29 22:06:45 -08:00
Tim Hockin
b2b9de88eb Fix update-import-aliases for workspaces 2024-02-29 22:06:44 -08:00
Tim Hockin
530c4352fb Rename new::setup_env back to setup_env 2024-02-29 22:06:44 -08:00
Tim Hockin
bece9bc3f4 Remove old::setup_env 2024-02-29 22:06:43 -08:00
Tim Hockin
f9ca58efe9 Remove run-in-gopath.sh 2024-02-29 22:06:42 -08:00
Tim Hockin
b32e207256 Fix last run-in-gopath user: typecheck
This now works across modules

Verified by introducing errors in 2 different modules and running.
2024-02-29 22:06:41 -08:00
Tim Hockin
91efe7e571 Fix import-boss wrt gengo/v2 2024-02-29 22:06:40 -08:00
Tim Hockin
f772410082 Make code-gen subprojects work on gengo/v2 2024-02-29 22:06:38 -08:00
Tim Hockin
251b22a7f8 Make update-codegen protobuf work on gengo/v2 2024-02-29 22:06:38 -08:00
Tim Hockin
7506048d3f Make update-codegen client work on gengo/v2 2024-02-29 22:06:36 -08:00