Commit Graph

4516 Commits

Author SHA1 Message Date
Tim Hockin
10c32b3e2f
Get rid of most references to GOPATH 2024-02-29 22:06:51 -08:00
Tim Hockin
530c4352fb
Rename new::setup_env back to setup_env 2024-02-29 22:06:44 -08:00
Tim Hockin
25b97dae82
Change ipamperf test to new setup_env 2024-02-29 22:06:12 -08:00
Tim Hockin
8b579b2347
Change the build_binaries path to use modules
This makes "new" and "old" setup_env functions. In subsequent commits,
all callers of the "old" form will be fixed, and the "new" will be
renamed back.

The old and new functions diff:

```diff
--- /tmp/a	2023-12-14 09:02:57.804092696 -0800
+++ /tmp/b	2023-12-14 09:03:09.679999585 -0800
@@ -1,4 +1,4 @@
-kube::golang::old::setup_env() {
+kube::golang:🆕:setup_env() {
   kube::golang::verify_go_version

   # Set up GOPATH.  We have tools which depend on being in a GOPATH (see
@@ -7,9 +7,9 @@
   # Even in module mode, we need to set GOPATH for `go build` and `go install`
   # to work.  We build various tools (usually via `go install`) from a lot of
   # scripts.
-  #   * We can't set GOBIN because that does not work on cross-compiles.
-  #   * We could use `go build -o <something>`, but it's subtle when it comes
-  #     to cross-compiles and whether the <something> is a file or a directory,
+  #   * We can't just set GOBIN because that does not work on cross-compiles.
+  #   * We could always use `go build -o <something>`, but it's subtle wrt
+  #     cross-compiles and whether the <something> is a file or a directory,
   #     and EVERY caller has to get it *just* right.
   #   * We could leave GOPATH alone and let `go install` write binaries
   #     wherever the user's GOPATH says (or doesn't say).
@@ -20,16 +20,6 @@
   #
   # Eventually, when we no longer rely on run-in-gopath.sh we may be able to
   # simplify this some.
-  local go_pkg_dir="${KUBE_GOPATH}/src/${KUBE_GO_PACKAGE}"
-  local go_pkg_basedir
-  go_pkg_basedir=$(dirname "${go_pkg_dir}")
-
-  mkdir -p "${go_pkg_basedir}"
-
-  # TODO: This symlink should be relative.
-  if [[ ! -e "${go_pkg_dir}" || "$(readlink "${go_pkg_dir}")" != "${KUBE_ROOT}" ]]; then
-    ln -snf "${KUBE_ROOT}" "${go_pkg_dir}"
-  fi
   export GOPATH="${KUBE_GOPATH}"

   # If these are not set, set them now.  This ensures that any subsequent
@@ -40,24 +30,10 @@
   # Make sure our own Go binaries are in PATH.
   export PATH="${KUBE_GOPATH}/bin:${PATH}"

-  # Change directories so that we are within the GOPATH.  Some tools get really
-  # upset if this is not true.  We use a whole fake GOPATH here to collect the
-  # resultant binaries.
-  local subdir
-  subdir=$(kube::realpath . | sed "s|${KUBE_ROOT}||")
-  cd "${KUBE_GOPATH}/src/${KUBE_GO_PACKAGE}/${subdir}" || return 1
-
-  # Set GOROOT so binaries that parse code can work properly.
-  GOROOT=$(go env GOROOT)
-  export GOROOT
-
   # Unset GOBIN in case it already exists in the current session.
   # Cross-compiles will not work with it set.
   unset GOBIN

-  # This seems to matter to some tools
-  export GO15VENDOREXPERIMENT=1
-
-  # Disable workspaces
-  export GOWORK=off
+  # Explicitly turn on modules.
+  export GO111MODULE=on
 }
```

Result: `make` works for k/k:

```
$ make kubectl
+++ [1211 11:07:31] Building go targets for linux/amd64
    k8s.io/kubernetes/cmd/kubectl (static)

$ make WHAT=./cmd/kubectl/
+++ [1211 11:08:19] Building go targets for linux/amd64
    k8s.io/kubernetes/./cmd/kubectl/ (non-static)

$ make WHAT=k8s.io/kubernetes/cmd/kubectl
+++ [1211 11:08:52] Building go targets for linux/amd64
    k8s.io/kubernetes/cmd/kubectl (static)
```

Result: `make` works for staging by package:

```
$ make WHAT=k8s.io/api
+++ [1211 11:11:37] Building go targets for linux/amd64
    k8s.io/api (non-static)
```

Result: `make` fails for staging by path:

```
$ make WHAT=./staging/src/k8s.io/api
+++ [1211 11:12:44] Building go targets for linux/amd64
    k8s.io/kubernetes/./staging/src/k8s.io/api (non-static)
cannot find module providing package k8s.io/kubernetes/staging/src/k8s.io/api: import lookup disabled by -mod=vendor
	(Go version in go.work is at least 1.14 and vendor directory exists.)
!!! [1211 11:12:44] Call tree:
!!! [1211 11:12:44]  1: /home/thockin/src/kubernetes/hack/lib/golang.sh:850 kube::golang::build_some_binaries(...)
!!! [1211 11:12:44]  2: /home/thockin/src/kubernetes/hack/lib/golang.sh:1012 kube::golang::build_binaries_for_platform(...)
!!! [1211 11:12:44]  3: hack/make-rules/build.sh:27 kube::golang::build_binaries(...)
!!! [1211 11:12:44] Call tree:
!!! [1211 11:12:44]  1: hack/make-rules/build.sh:27 kube::golang::build_binaries(...)
!!! [1211 11:12:44] Call tree:
!!! [1211 11:12:44]  1: hack/make-rules/build.sh:27 kube::golang::build_binaries(...)
make: *** [Makefile:96: all] Error 1
```

Result: `make test` fails:

```
$ make test WHAT=./cmd/kubectl
+++ [1211 11:13:38] Set GOMAXPROCS automatically to 6
+++ [1211 11:13:38] Running tests without code coverage and with -race
cmd/kubectl/kubectl.go:25:2: cannot find package "k8s.io/client-go/plugin/pkg/client/auth" in any of:
	/home/thockin/src/kubernetes/_output/local/go/src/k8s.io/kubernetes/vendor/k8s.io/client-go/plugin/pkg/client/auth (vendor tree)
	/home/thockin/sdk/gotip/src/k8s.io/client-go/plugin/pkg/client/auth (from $GOROOT)
	/home/thockin/src/kubernetes/_output/local/go/src/k8s.io/client-go/plugin/pkg/client/auth (from $GOPATH)
cmd/kubectl/kubectl.go:20:2: cannot find package "k8s.io/component-base/cli" in any of:
	/home/thockin/src/kubernetes/_output/local/go/src/k8s.io/kubernetes/vendor/k8s.io/component-base/cli (vendor tree)
	/home/thockin/sdk/gotip/src/k8s.io/component-base/cli (from $GOROOT)
	/home/thockin/src/kubernetes/_output/local/go/src/k8s.io/component-base/cli (from $GOPATH)
cmd/kubectl/kubectl.go:21:2: cannot find package "k8s.io/kubectl/pkg/cmd" in any of:
	/home/thockin/src/kubernetes/_output/local/go/src/k8s.io/kubernetes/vendor/k8s.io/kubectl/pkg/cmd (vendor tree)
	/home/thockin/sdk/gotip/src/k8s.io/kubectl/pkg/cmd (from $GOROOT)
	/home/thockin/src/kubernetes/_output/local/go/src/k8s.io/kubectl/pkg/cmd (from $GOPATH)
cmd/kubectl/kubectl.go:22:2: cannot find package "k8s.io/kubectl/pkg/cmd/util" in any of:
	/home/thockin/src/kubernetes/_output/local/go/src/k8s.io/kubernetes/vendor/k8s.io/kubectl/pkg/cmd/util (vendor tree)
	/home/thockin/sdk/gotip/src/k8s.io/kubectl/pkg/cmd/util (from $GOROOT)
	/home/thockin/src/kubernetes/_output/local/go/src/k8s.io/kubectl/pkg/cmd/util (from $GOPATH)
make: *** [Makefile:191: test] Error 1
```
2024-02-29 00:22:07 -08:00
Kubernetes Prow Robot
98bd90fbe2
Merge pull request #114672 from pohly/log-text-split-streams
log: split streams also for text output
2024-02-26 01:44:58 -08:00
Kubernetes Prow Robot
38638adaee
Merge pull request #123418 from rikatz/kep-1860-to-beta
Promote LoadBalancerIPMode to Beta
2024-02-24 12:48:07 -08:00
Kubernetes Prow Robot
31a482a149
Merge pull request #120344 from rohitssingh/disable_force_detach
Add a flag to disable force detach behavior in kube-controller-manager
2024-02-22 13:02:38 -08:00
Rohit Singh
13dddca6a2 Add "disable-force-detach-on-timeout" flag to kube-controller-manager 2024-02-22 18:31:52 +00:00
Ricardo Katz
d816ab7657 Promote LoadBalancerIPMode to Beta 2024-02-22 08:35:12 -03:00
Kubernetes Prow Robot
3d3d705a6d
Merge pull request #122883 from Jefftree/agg-discovery-block-stale
Aggregated Discovery, mark APIServices stale before initial health check
2024-02-21 12:02:41 -08:00
Jefftree
6726e65619 Aggregated Discovery, mark stale before initial health check 2024-02-20 18:15:13 -05:00
Kubernetes Prow Robot
64386c5aba
Merge pull request #122419 from pohly/scheduler-perf-create-any
scheduler-perf: create any object from YAML
2024-02-19 07:44:40 -08:00
Jordan Liggitt
d5d3eddb95
Add allowed/denied metrics for authorizers 2024-02-16 08:20:59 -05:00
Kubernetes Prow Robot
66d038d84d
Merge pull request #121946 from liggitt/reload-authz
KEP-3221: Implement authorization configuration file reloading
2024-02-15 18:37:13 -08:00
Kubernetes Prow Robot
50b4cfc414
Merge pull request #123321 from mimowo/job-reset-metrics
Reset metrics in the Job integration test before testing
2024-02-15 10:57:58 -08:00
Kubernetes Prow Robot
47f92ce231
Merge pull request #123242 from mimowo/fast-backoff-for-replacment-policy-tests
Improve accuracy of the PodsCreationTotal metric and use fast pod failure backoff for ReplacementPolicy integration tests
2024-02-15 09:54:53 -08:00
Michal Wozniak
ab8cdae3b1 Reset metrics in the Job integration test before testing 2024-02-15 14:50:24 +01:00
Michal Wozniak
115dc90633 Increase accuracy of the pods_creation_total metric and improve test exec time 2024-02-15 10:59:01 +01:00
Anish Ramasekar
0feb1d5173
Add integration test for multiple audience in structured authn
Signed-off-by: Anish Ramasekar <anish.ramasekar@gmail.com>
2024-02-14 18:50:46 -08:00
Kubernetes Prow Robot
72c3c7c924
Merge pull request #123282 from enj/enj/i/authn_config_algs
Support all key algs with structured authn config
2024-02-14 18:08:32 -08:00
Kubernetes Prow Robot
ba450636a4
Merge pull request #123165 from aramase/aramase/f/kep_3331_audience_match_policy
Add `AudienceMatchPolicy` and support multiple audiences in AuthenticationConfiguration
2024-02-14 17:00:04 -08:00
Jordan Liggitt
5dc92ada06
Implement authz config file reloading 2024-02-14 18:09:15 -05:00
Anish Ramasekar
18c563546a
support multiple audiences with jwt authenticator
Signed-off-by: Anish Ramasekar <anish.ramasekar@gmail.com>
2024-02-14 10:47:07 -08:00
Monis Khan
b5e0068325
Support all key algs with structured authn config
Signed-off-by: Monis Khan <mok@microsoft.com>
2024-02-14 09:40:25 -05:00
Monis Khan
b8a59346fe
test/oidc: extract key type to allow testing different algs
Signed-off-by: Monis Khan <mok@microsoft.com>
2024-02-13 17:05:33 -05:00
Anish Ramasekar
77241d3125
Add apiserver_encryption_config_controller_automatic_reloads_total
metric

- Adds `apiserver_encryption_config_controller_automatic_reloads_total`
  metric with status label for encryption config reload success/failure.
- Deprecated `apiserver_encryption_config_controller_automatic_reload_failures_total` and `apiserver_encryption_config_controller_automatic_reload_success_total`

Signed-off-by: Anish Ramasekar <anish.ramasekar@gmail.com>
2024-02-12 21:47:46 -08:00
Kubernetes Prow Robot
3bf9477b52
Merge pull request #122472 from pacoxu/flowcontrolv1
flowcontrol: set the serialization version to v1
2024-02-12 13:17:48 -08:00
Patrick Ohly
da0c9a93ae scheduler_perf: use dynamic client to create arbitrary objects
With a dynamic client and a rest mapper it is possible to load arbitrary YAML
files and create the object defined by it. This is simpler than adding specific
Go code for each supported type.

Because the version now matters, the incorrect version in the DRA YAMLs were
found and fixed.
2024-02-11 10:51:38 +01:00
Patrick Ohly
c46ae1b26a scheduler_perf: use ktesting.TContext + staging StartTestServer
ktesting.TContext combines several different interfaces. This makes the code
simpler because less parameters need to be passed around.

An intentional side effect is that the apiextensions client interface becomes
available, which makes it possible to use CRDs. This will be needed for future
DRA tests.

Support for CRDs depends on starting the apiserver via
k8s.io/kubernetes/cmd/kube-apiserver/app/testing because only that enables the
CRD extensions. As discussed on Slack, the long-term goal is to replace the
in-tree StartTestServer with the one in staging, so this is going in the right
direction.
2024-02-11 10:51:38 +01:00
Kubernetes Prow Robot
42941cb88a
Merge pull request #122635 from carlory/KEP-2799
Promote LegacyServiceAccountTokenCleanUp to GA
2024-02-02 12:47:23 -08:00
Alexander Zielenski
b636984004 test: remove unnecessary skip healthz check from test
snuck in there while I was working on the test, but is ultimately not necessary to test the functionality.

skipping healthz check resulted in leaking goroutines from poststarthooks.
2024-02-01 14:50:54 -08:00
Alexander Zielenski
71559bd026 bugfix: dont skip reconcile for unchanged policy if last sync failed 2024-01-29 11:16:59 -08:00
Lukasz Szaszkiewicz
41e706600a client-go/reflector: make UseWatchList a pointer
until #115478(use streaming against the etcd storage)
is resolved the cacher need a way to disable the streaming.
2024-01-19 14:40:18 +01:00
Patrick Ohly
8f4c9c7605 k8s.io/component-base/logs: replace klog text implementation
This replaces the klog formatting and message routing with a simpler
implementation that uses less code. The main difference is that we skip the
entire unused message routing.

Instead, the same split output streams as for JSON gets implemented in the
io.Writer implementation that gets passed to the textlogger.
2024-01-17 13:50:03 +01:00
Kensei Nakada
f29d6970c9 doc(scheduler_perf): enrich the documentation 2024-01-15 08:50:08 +00:00
Patrick Ohly
04b772c661 logs benchmark: really write through pipe
While the benchmark is focused on encoding, it becomes a bit more realistic
when actually passing the encoded data to the Linux kernel. Features like
output buffering are more likely to have a visible effect when invoking
syscalls.
2024-01-12 07:49:17 +01:00
Patrick Ohly
7f1a30f8d5 logs benchmark: fix config handling
The logs config must be reset explicitly now when changing it multiple times
per process.
2024-01-12 07:49:17 +01:00
carlory
0fc1b9c9aa Promote LegacyServiceAccountTokenCleanUp to GA 2024-01-08 10:58:49 +08:00
Davanum Srinivas
7a236bd7e0
Add providerless tags appropriately in test/
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2024-01-07 08:16:05 -05:00
Kubernetes Prow Robot
60dcf7fd8d
Merge pull request #119079 from sanposhiho/decouple-scheduler-perf-from-kk
make scheduler_perf usable from other repositories
2024-01-07 12:12:13 +01:00
Kubernetes Prow Robot
9bd0ef5f17
Merge pull request #122558 from linxiulei/webhook-http2
Use http/2 for localhost webhook
2024-01-04 19:11:26 +01:00
Eric Lin
246e69fb99 Use http/2 for localhost webhook
Signed-off-by: Eric Lin <exlin@google.com>
2024-01-04 09:09:10 +00:00
Kubernetes Prow Robot
a7af34e1b8
Merge pull request #122347 from aramase/aramase/c/move_kms_apis
kmsv2: move encryption config types to standard API server config location
2024-01-03 16:16:18 +01:00
Paco Xu
f73bba51c9 flowcontrol: set the serialization version to v1 2023-12-25 14:24:50 +08:00
Kubernetes Prow Robot
f68a965e5a
Merge pull request #122032 from carlory/remove-fg-APISelfSubjectReview
remove feature-gate APISelfSubjectReview in 1.30
2023-12-20 16:46:53 +01:00
Anish Ramasekar
75695dae10
move encryption config types to standard API server config location
Signed-off-by: Anish Ramasekar <anish.ramasekar@gmail.com>
2023-12-18 20:54:24 +00:00
AxeZhan
be48c93689 Sched framework: expose NodeInfo in all functions of PluginsRunner interface 2023-12-15 11:30:06 +08:00
Kubernetes Prow Robot
4189053453
Merge pull request #121755 from kerthcet/fix/node-update-event
Fix nodeUpdate event missing some potential changes
2023-12-13 22:36:03 +01:00
Kubernetes Prow Robot
bd4c29b7e3
Merge pull request #115502 from pwschuurman/speedup-autodelete-sts-integration-tests
Reduce running time of TestAutodeleteOwnerRefs StatefulSet Integration Tests
2023-12-13 22:33:57 +01:00
Kubernetes Prow Robot
c5473f1710
Merge pull request #117667 from carlory/fix-009
Remove ability to re-enable serving deprecated storage APIs
2023-12-13 21:25:15 +01:00