Commit Graph

24762 Commits

Author SHA1 Message Date
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
4b20f81c19
Fix verify-conformance-yaml 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
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
db590ecd89
Fix scripts to avoid testdata 2024-02-29 22:06:21 -08:00
Tim Hockin
25b97dae82
Change ipamperf test to new setup_env 2024-02-29 22:06:12 -08:00
Tim Hockin
238b33de3b
Change test/instrumentation/update-* to new setup_env 2024-02-29 22:06:12 -08:00
Tim Hockin
b725fd20c2
Fix update/verify-mocks.sh
There appears to be a bug in `go generate` for workspaces which will be
fixed in the 1.22.1 release.
2024-02-29 22:06:00 -08:00
Tim Hockin
5f490b4fe8
Clarify, document KUBE_OUTPUT_* variables 2024-02-29 22:05:42 -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
ecd20dc39a
Merge pull request #122117 from ii/create-volume-attachment-lifecycle-test
Create e2e test for VolumeAttachment endpoints
2024-02-28 19:00:36 -08:00
Stephen Heywood
a3dfba8f50 Create e2e test for VolumeAttachment endpoints
e2e test validates the following 7 endpoints
- createStorageV1VolumeAttachment
- deleteStorageV1CollectionVolumeAttachment
- deleteStorageV1VolumeAttachment
- listStorageV1VolumeAttachment
- patchStorageV1VolumeAttachment
- readStorageV1VolumeAttachment
- replaceStorageV1VolumeAttachment
2024-02-29 13:38:48 +13:00
Kubernetes Prow Robot
7ec1e1a55e
Merge pull request #121606 from saschagrunert/user-namespaces-serial-test
KEP-127: Add UserNamespacesPodSecurityStandards e2e test
2024-02-28 13:54:25 -08:00
Kubernetes Prow Robot
aeeb029d83
Merge pull request #123183 from SergeyKanzhelev/addFeatureOwnersToTestFeatures
added OWNERS to test/e2e/feature/feature.go
2024-02-28 10:02:09 -08:00
Kubernetes Prow Robot
6409fde49f
Merge pull request #120251 from liyuerich/apps
e2e_apps:stop using deprecated framework.ExpectError
2024-02-28 10:02:00 -08:00
Davanum Srinivas
fa44b9ca15
Fix panic in getNpdPodStat
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2024-02-28 10:50:43 -05:00
Kubernetes Prow Robot
f7ca532472
Merge pull request #123281 from seans3/remote-command-websocket-beta
RemoteCommand over WebSockets to Beta
2024-02-27 21:01:55 -08:00
Kubernetes Prow Robot
47c92e2ab7
Merge pull request #123521 from pohly/dra-e2e-structure
dra e2e: fix stack unwinding in helper function
2024-02-27 03:14:40 -08:00
liyuerich
c3caddf3e6 e2e_apps:stop using deprecated framework.ExpectError
Signed-off-by: liyuerich <yue.li@daocloud.io>
2024-02-27 13:46:36 +08:00
Kubernetes Prow Robot
e457683e6c
Merge pull request #123444 from pohly/test-context-expect-no-error
ktesting: several fixes and better unit testing
2024-02-26 20:05:40 -08:00
Sean Sullivan
a147693deb remote command turn on feature gates 2024-02-27 02:05:24 +00:00
Rajalakshmi-Girish1
fd5019a546 ktesting: ut flake fix for CI 2024-02-26 07:26:20 -05: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
689dca08e1
Merge pull request #123479 from Jefftree/sample-apiserver-129
Fix sample-apiserver rbac and bump to 1.29
2024-02-25 16:41:38 -08:00
Patrick Ohly
840ef14907 ktesting: doc updates and fixes
First-in-first-out is wrong for cleanup, it's LIFO.

Updated some comments to make them more informative and fixed indention.
2024-02-25 18:13:58 +01:00
Kubernetes Prow Robot
be4b7de022
Merge pull request #123488 from dims/skip-autoscaling-tests-when-we-hit-rate-limits
Skip autoscaling tests when we hit rate limits
2024-02-25 06:40:24 -08:00
Kubernetes Prow Robot
237d3dfda7
Merge pull request #123486 from pohly/test-context-unit-test-flake
ktesting: unit test flake because of timing check
2024-02-24 15:55:01 -08:00
Davanum Srinivas
d7735f32d0
Skip autoscaling tests when we hit rate limits
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2024-02-24 18:07:49 -05: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
Patrick Ohly
1ecd4053de ktesting: skip timing check in unit test
Extending the duration and the allowed delta in f6682370b1 was still not enough
to make the unit test run reliably in pull-kubernetes-unit.

Now it uses the original, stricter timing again, but only when run locally. In
Prow (detected by checking the "CI" env variable), the duration check is
skipped.
2024-02-24 19:26:29 +01:00
Patrick Ohly
8980b4b846 Revert "fix flaky ut in TestCause contexthelper_test"
This reverts commit f6682370b1.
2024-02-24 19:21:01 +01:00
Kubernetes Prow Robot
4c15f5f7b0
Merge pull request #123473 from dims/fix-for-persistent-horizontal-pod-autoscaling-failures
Fix for persistent Horizontal pod autoscaling failures
2024-02-24 05:51:16 -08:00
Jefftree
bbef156ef5 update 129 2024-02-23 23:53:54 -05:00
Jefftree
b3216214f9 Fix sample-apiserver rbac for v1.27 and bump e2e 2024-02-23 23:53:54 -05:00
Davanum Srinivas
e2ff63103d
fix for persistent Horizontal pod autoscaling failures
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2024-02-23 20:07:31 -05:00
Jefftree
148757903a release v1.29.2 for sampleapiserver 2024-02-23 19:40:27 -05:00
Kubernetes Prow Robot
a54d84d17f
Merge pull request #123138 from carlory/remove-ExpectNotEqual
remove deprecated framework.ExpectNotEqual
2024-02-23 02:57:09 -08:00
Jordan Liggitt
e1ac3e1de7
Fix kubectl proxy e2e test 2024-02-22 23:50:23 -05:00
Kubernetes Prow Robot
5d39bc5680
Merge pull request #122977 from Jefftree/add-e2e-agg-discovery
e2e for aggregated discovery
2024-02-22 16:09:59 -08:00
Jefftree
52dd603055 initial e2e for aggregated discovery 2024-02-22 22:33:19 +00: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
Kubernetes Prow Robot
ef19539cdc
Merge pull request #123416 from pacoxu/fix-flaky-ut
fix flaky ut in TestCause contexthelper_test
2024-02-22 07:13:34 -08:00
Kubernetes Prow Robot
0863144a1d
Merge pull request #123423 from dims/fix-nfs-related-issues-on-gcp-ubuntu
Fix NFS related issues on GCP/Ubuntu
2024-02-22 06:13:04 -08:00
Patrick Ohly
e9193b4f33 e2e: remove dead code for providers
The dead code was found with:

    deadcode -test -filter=k8s.io/kubernetes/test/e2e/framework/... ./test/e2e ./test/e2e_node ./test/e2e_node ./test/e2e_kubeadm

See https://go.dev/blog/deadcode for an introduction.

This removes everything that was reported as dead code for
test/e2e/framework/providers.
2024-02-22 12:42:17 +01:00
Ricardo Katz
d816ab7657 Promote LoadBalancerIPMode to Beta 2024-02-22 08:35:12 -03:00
Patrick Ohly
4cb4228522 ktesting: improve unit test coverage
In particular ExpectNoError needed testing, as it was unused so far and not
functional in its initial implementation.
2024-02-22 12:04:42 +01:00
Patrick Ohly
4ffa628ead ktesting: add missing methods to error context
Expect and ExpectNoError were not implemented and thus unintentionally
inherited from the base TContext.
2024-02-22 11:43:54 +01:00
Patrick Ohly
dc6abc3ff8 ktesting: add Underlier type alias
This may help avoid importing both this ktesting and klog's ktesting.
2024-02-22 11:42:48 +01:00