Commit Graph

20744 Commits

Author SHA1 Message Date
Ruediger Pluem
988bc86016 Appease gofmt 2024-04-08 20:06:56 +02:00
Ruediger Pluem
db51d5f99c Fix linter hints 2024-04-08 17:51:24 +02:00
Ruediger Pluem
0e13fa24ae Move flag mapping to a separate function and unit test it 2024-04-08 17:16:35 +02:00
cpanato
d19bff9a02 Update publishing-bot rules to Go 1.21.9
Signed-off-by: cpanato <ctadeu@gmail.com>
2024-04-06 12:34:48 +02:00
cpanato
1366f1f447 [go] Bump images, dependencies and versions to go 1.22.2 and distroless iptables
Signed-off-by: cpanato <ctadeu@gmail.com>
2024-04-05 14:27:57 +02:00
Maciej Szulik
b40057db2a Update applyconfig-gen for pacakges where group and dir differ in name
It is possible that package paths might differ from the group name, see
https://github.com/openshift/api/blob/master/operatorcontrolplane/v1alpha1/doc.go
notice that pacakge name is `operatorcontrolplane` whereas the group is
`controlplane.operator...`. This confuses the generator since it tries
to extrapolate the name of the package based on the group name. Whereas
the ImportTracker can properly recognize the import path. This leads to
cyclical imports in packages where the group name is different from the
actual import path.
2024-04-05 13:20:45 +02:00
Ben Luddy
8df914ae87 Add tests for CBOR encoder handling of duplicate field names/tags. 2024-04-04 11:55:02 -04:00
Ruediger Pluem
3e646cd8cf Align go.mod and go.sum
Signed-off-by: Ruediger Pluem <ruediger.pluem@vodafone.com>
2024-04-04 14:34:12 +02:00
Ruediger Pluem
2bdacbf685 Fix bind mounts of filesystems with specific mount options set
Currently bind mounts of filesystems with nodev, noexec, nosuid,
noatime, relatime or nodiratime options set fail if we are running in a
user namespace if the same options are not set for the bind mount.

In case we are running in a user name space fix this by searching the
mount options of the source filesystem for nodev, noexec, nosuid,
noatime, relatime or nodiratime and retry the bind mount with the
options found added.

Signed-off-by: Ruediger Pluem <ruediger.pluem@vodafone.com>
2024-04-04 14:25:30 +02:00
Davanum Srinivas
99fac38d28 Update x/net for CVE-2023-45288
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2024-04-03 19:56:04 -04:00
Kubernetes Prow Robot
c9f6d4e172 Merge pull request #124019 from alexzielenski/fix-ratcheting-flake
fix test flake caused by not waiting for CRD schema update
2024-04-02 07:00:11 -07:00
Dr. Stefan Schimanski
62d379fa5a kubectl: fix plugin lookup with positional arguments
Signed-off-by: Dr. Stefan Schimanski <stefan.schimanski@gmail.com>
2024-03-31 19:45:41 +02:00
Alex Zielenski
0add741012 fix test flake caused by not waiting for CRD schema update 2024-03-29 08:54:10 -07:00
zhanluxianshen
609b01f971 Fix typos in rbac api.
Signed-off-by: zhanluxianshen <irelandabby883@gmail.com>
2024-03-29 06:49:19 +08:00
Andrew DeMaria
9edf1fc51c generate fully qualified type references
Currently type references for non-local names are output as relative
types which is subject to the resolution rules as defined at
https://protobuf.com/docs/language-spec#reference-resolution
This works fine within the k8s.io namespace where no subpackages are
named k8s, but other users of go-to-protobuf likely have k8s in their
package name. This causes conflicts in the search resolution when
executing `go-to-protobuf`:

```
company.example.com/k8s/custom/pkg/apis/custom.k8s.example.com/v1/generated.proto:64:12: "k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta" is resolved to "company.example.com.k8s.custom.pkg.apis.custom.k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta", which is not defined. The innermost scope is searched first in name resolution. Consider using a leading '.'(i.e., ".k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta") to start from the outermost scope.
```

To avoid this we can output fully qualified type references using a
preceding dot (.)

This results in a change for k8s generated.proto files, but the
effect is a noop.

Fixes kubernetes/code-generator#147

Signed-off-by: Andrew DeMaria <ademaria@cloudflare.com>
2024-03-28 09:34:11 -06:00
Davanum Srinivas
06e69e4b09 releng: update publishing bot rules for 1.30
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2024-03-27 10:42:45 -04:00
Patrick Ohly
1a13b0aa33 DRA api: ResourceHandle.DriverName is required
It was already required via validation, but not declared as such by the
OpenAPI.
2024-03-27 11:22:35 +01:00
Patrick Ohly
8774dee09e DRA api: explicitly reserve finalizer for Kubernetes
The k8s.io in the string and conventions around finalizers for DRA driver
controllers implied that this is for use by Kubernetes, but it's better to be
explicit about this.
2024-03-27 11:20:37 +01:00
Aldo Culquicondor
1a2dba426f Update API comment for nodeName to match system behavior
Change-Id: I039b441f4525d280b1ea693d782fe0f43794d9f7
2024-03-26 19:04:48 +00:00
Patrick Ohly
5a130d2b71 apimachinery runtime: support contextual logging
In contrast to the original HandleError and HandleCrash, the new
HandleErrorWithContext and HandleCrashWithContext functions properly do contextual
logging, so if a problem occurs while e.g. dealing with a certain request and
WithValues was used for that request, then the error log entry will also
contain information about it.

The output changes from unstructured to structured, which might be a breaking
change for users who grep for panics. Care was taken to format panics
as similar as possible to the original output.

For errors, a message string gets added. There was none before, which made it
impossible to find all error output coming from HandleError.

Keeping HandleError and HandleCrash around without deprecating while changing
the signature of callbacks is a compromise between not breaking existing code
and not adding too many special cases that need to be supported. There is some
code which uses PanicHandlers or ErrorHandlers, but less than code that uses
the Handle* calls.

In Kubernetes, we want to replace the calls. logcheck warns about them in code
which is supposed to be contextual. The steps towards that are:
- add TODO remarks as reminder (this commit)
- locally remove " TODO(pohly): " to enable the check with `//logcheck:context`,
  merge fixes for linter warnings
- once there are none, remove the TODO to enable the check permanently
2024-03-26 17:28:45 +01:00
Haibing Zhou
87b4279e07 workqueue: make queue as configurable
The default queue implementation is mostly FIFO and it is not
exchangeable unless we implement the whole `workqueue.Interface` which
is less desirable as we have to duplicate a lot of code. There was one
attempt done in [kubernetes/kubernetes#109349][1] which tried to
implement a priority queue. That is really useful and [knative/pkg][2]
implemented something called two-lane-queue. While two lane queue is
great, but isn't perfect since a full slow queue can still slow down
items in fast queue.

This change proposes a swappable queue implementation while not adding
extra maintenance effort in kubernetes community. We are happy to
maintain our own queue implementation (similar to two-lane-queue) in
downstream.

[1]: https://github.com/kubernetes/kubernetes/pull/109349
[2]: https://github.com/knative/pkg/blob/main/controller/two_lane_queue.go
2024-03-25 20:47:15 -07:00
Amirsadra Abdollahi
0413376489 Fix: correct dryRunStratergy typo in kubectl expose cmd 2024-03-25 19:13:38 +03:30
Claudiu Belu
856bb5c8f2 Replaces path.Operation with filepath.Operation (staging)
The path module has a few different functions:
Clean, Split, Join, Ext, Dir, Base, IsAbs. These functions do not
take into account the OS-specific path separator, meaning that they
won't behave as intended on Windows.

For example, Dir is supposed to return all but the last element of the
path. For the path "C:\some\dir\somewhere", it is supposed to return
"C:\some\dir\", however, it returns ".".

Instead of these functions, the ones in filepath should be used instead.
2024-03-25 15:42:53 +00:00
Wojciech Tyczyński
a26ee12395 Relax WatchSemanticsTest to make it faster 2024-03-22 08:26:55 +01:00
Abhishek Kr Srivastav
eb5d2ca9d8 Added locks when accessing dummyStorage to prevent data race
Removed redundant locks

Removed locks and used existing func
2024-03-20 14:38:29 +05:30
Stephen Kitt
ecb965287c code-generator: use cases.Title instead of strings.Title
This pulls in language.Und for basic capitalisation.

Signed-off-by: Stephen Kitt <skitt@redhat.com>
2024-03-19 23:50:11 +01:00
Kubernetes Prow Robot
fe9e4698a3 Merge pull request #123994 from serathius/undo-double-run-test-watch-semantics
Undo double run of the TestWatchSemantics test to avoid hitting timeout
2024-03-19 09:49:39 -07:00
Marek Siarkowicz
225749eb68 Undo double run of the TestWatchSemantics test to avoid hitting timeout 2024-03-19 15:17:50 +01:00
Kubernetes Prow Robot
065a0f2d51 Merge pull request #123785 from seans3/streamtunnel-unit-tests
Adds unit tests to `PortForward` streamtunnel
2024-03-18 07:31:17 -07:00
David Eads
de302c73e9 Remove k8s.io/apiserver ability to bind insecure ports
The project does not recommend using insecure ports.  Even
unauthenticated TLS is an improvement since it provides confidentiality.
If you relied upon this, please update to secure serving options.
2024-03-18 09:25:49 -04:00
Marek Siarkowicz
0130072b05 Serve watch without resourceVersion from cache and introduce a WatchFromStorageWithoutResourceVersion feature gate to allow serving watch from storage. 2024-03-18 11:55:13 +01:00
Lan Liang
dc992adad3 cleanup: delete rand.Seed(time.Now().UnixNano()) and using global number generator.
see https://tip.golang.org/doc/go1.20

Signed-off-by: Lan Liang <gcslyp@gmail.com>
2024-03-18 08:10:12 +00:00
Kubernetes Prow Robot
89b1db79d7 Merge pull request #123676 from serathius/rv0
Fix enabling consistent list from watch cache also works for resourceVersion=0
2024-03-15 09:51:00 -07:00
Ziqi Zhao
91af1145bf fix for comments to ignore the request without request info
Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>
2024-03-15 09:42:42 +08:00
Kubernetes Prow Robot
d194e6d06c Merge pull request #123932 from pohly/dra-api-resource-model-rename
dra api: NodeResourceModel -> ResourceModel
2024-03-14 12:11:35 -07:00
Kubernetes Prow Robot
89f03e3988 Merge pull request #123926 from p0lyn0mial/upstream-deflake-test-get-list-non-recursive-with-consistent-list
apiserver/storage/cacher: deflake TestGetListNonRecursiveWithConsistentListFromCache
2024-03-14 11:02:46 -07:00
Kubernetes Prow Robot
6ef2fec0df Merge pull request #123909 from AkihiroSuda/fix-123906
kubelet: fix mixing up runtime classes with runtime handlers
2024-03-14 11:02:39 -07:00
Patrick Ohly
a0add8d2c7 dra api: NodeResourceModel -> ResourceModel
When renaming NodeResourceSlice to ResourceSlice, the embedded
[Node]ResourceModel also should have been renamed.
2024-03-14 18:07:36 +01:00
Marek Siarkowicz
0b8e79580e Fix enabling consistent list from watch cache also works for resourceVersion=0 2024-03-14 16:55:56 +01:00
Lukasz Szaszkiewicz
d21b86d53a apiserver/storage/cacher: decrease running time of TestCacheWatcherDrainingNoBookmarkAfterResourceVersionReceived
before:
go test -v -race -count 1 -run ^TestCacheWatcherDrainingNoBookmarkAfterResourceVersionReceived$
ok  	k8s.io/apiserver/pkg/storage/cacher	3.792s

after:
go test -v -race -count 1 -run ^TestCacheWatcherDrainingNoBookmarkAfterResourceVersionReceived$
ok  	k8s.io/apiserver/pkg/storage/cacher	1.783s
2024-03-14 11:15:13 +01:00
Lukasz Szaszkiewicz
c44cc9a575 apiserver/storage/cacher: deflake TestGetListNonRecursiveWithConsistentListFromCache 2024-03-14 09:08:29 +01:00
Lukasz Szaszkiewicz
f5d945eb43 apiserver/storage/cacher: decrease running time of TestWatchNotHangingOnStartupFailure
before:
go test -v -race -count 1 -run ^TestWatchNotHangingOnStartupFailure$
ok  	k8s.io/apiserver/pkg/storage/cacher	6.775s

after:
go test -v -race -count 1 -run ^TestWatchNotHangingOnStartupFailure$
ok  	k8s.io/apiserver/pkg/storage/cacher	2.781s
2024-03-14 09:01:14 +01:00
Akihiro Suda
1dc05009fe api: NodeStatus: rename RuntimeClasses to RuntimeHandlers
The runtime classes are apiserver's concept, while the handlers are kubelet's concept.
For NodeStatus, it makes more sense to return the latter ones here.

This commit modifies the following files:

- pkg/apis/core/types.go
- staging/src/k8s.io/api/core/v1/types.go
- pkg/kubelet/nodestatus/setters.go
- pkg/kubelet/kubelet_node_status.go
- pkg/registry/core/node/strategy.go
- test/e2e_node/mount_rro_linux_test.go

Other changes were auto-generated by running `make update`.

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2024-03-14 08:06:39 +09:00
Kubernetes Prow Robot
3a75a8c8d9 Merge pull request #123891 from p0lyn0mial/upstream-cacher-decrease-running-time-of-test-wait-unti-fresh
apiserver/storage/cacher: decrease of running time of TestWaitUntilWatchCacheFreshAndForceAllEvents
2024-03-13 06:49:18 -07:00
Kubernetes Prow Robot
308d664e3f Merge pull request #123887 from p0lyn0mial/upstream-cacher-decrease-running-time-of-tests
apiserver/storage/cacher: decrease the running time of tests in the cacher package.
2024-03-13 04:59:33 -07:00
Lukasz Szaszkiewicz
5a74c8e220 apiserver/storage/cacher: decrease the running time of tests in the cacher package.
It turns out that kube has a custom timeout for tests of 3 minutes.
The tests in the cacher package are utilizing nearly the
entire time and are being terminated, resulting in failing jobs.

Before the change, the TestWatchSemantics took ~43s to run. With this simple change, it now takes ~18s.

When we created the tests, we didn't measure the running time and assumed that waiting 1 second on a watch channel
to make sure no more events are received was sufficient.
This PR decreases the waiting time to 300 milliseconds.
Modern computers can perform many tasks within that time.
In addition to that, the tests are serial in nature, meaning that there is no other
actor that could add items to the database, which could result in receiving new items.

After the change the total running time decreased by 17%.
Before the tests needed ~176s after they need ~146s.
The changes also improved TestWatchSemanticInitialEventsExtended.
2024-03-13 11:59:20 +01:00
Kubernetes Prow Robot
881cc5bc96 Merge pull request #123897 from p0lyn0mial/upstream-cacher-decrease-running-time-of-empty-watch-event-cache
apiserver/storage/cacher: decrease of running time of TestEmptyWatchEventCache
2024-03-13 03:55:54 -07:00
Lukasz Szaszkiewicz
926122c035 apiserver/storage/cacher: decrease of running time of TestEmptyWatchEventCache
updates the test to wait 300 ms instead of 3s
the watch was established otherwise
we would be blocking on a call to cache.Watch(...)
in addition to that, the tests are serial in nature,
meaning that there is no other actor
that could add items to the database,
which could result in receiving new items.

Before:
go test -race  -run TestEmptyWatchEventCache
ok  	k8s.io/apiserver/pkg/storage/cacher	8.450s

After:
go test -race  -run TestEmptyWatchEventCache
ok  	k8s.io/apiserver/pkg/storage/cacher	2.635s
2024-03-13 09:00:51 +01:00
Ziqi Zhao
1aeb0ba314 add http method to span name
Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>
2024-03-13 13:25:36 +08:00
Joel Speed
0a10014162 Update test to track status prefix on paths 2024-03-12 17:35:34 +00:00