Commit Graph

29094 Commits

Author SHA1 Message Date
Kubernetes Prow Robot
e551ea5ea5 Merge pull request #133678 from mortent/AllocatorPerfImprovements
DRA: Avoid unnecessary work in allocator
2026-01-09 01:19:41 +05:30
Morten Torkildsen
9562aa8ba5 DRA: Avoid unnecessary work in allocator 2026-01-08 16:52:44 +00:00
Kubernetes Prow Robot
26fd963327 Merge pull request #135664 from pohly/dra-upgrade-downgrade-refactor
DRA e2e: upgrade/downgrade refactor
2026-01-08 19:31:47 +05:30
Kubernetes Prow Robot
97bd924010 Merge pull request #134162 from zeqian-meng/update-npb-ep-image
Upgrade Debian and NPB for npb-ep e2e test
2026-01-08 13:21:38 +05:30
Kubernetes Prow Robot
8e4ba87939 Merge pull request #135689 from KasimVali2207/add-probe-stress-tests
Add stress tests for gRPC, HTTP, and TCP liveness probesAdd probe stress tests
2026-01-08 04:57:45 +05:30
Kubernetes Prow Robot
3619b0c8aa Merge pull request #135189 from haircommander/proc-e2e-node
e2e_node: update proc mount test to correctly handle baseline PSA
2026-01-08 04:57:37 +05:30
Kubernetes Prow Robot
817f68f75f Merge pull request #135377 from harche/dra_flake_test
Fix race condition in DRA health e2e test pod status update
2026-01-08 03:01:46 +05:30
Peter Hunt
da695e7b78 e2e_node: update proc mount test to correctly handle baseline PSA
Signed-off-by: Peter Hunt <pehunt@redhat.com>
2026-01-07 15:59:26 -05:00
Kubernetes Prow Robot
2eb312a14f Merge pull request #136066 from serathius/watchcache-cleanup-watch-without-rv
Cleanup WatchFromStorageWithoutResourceVersion feature gate
2026-01-07 22:33:41 +05:30
Kubernetes Prow Robot
08ad958d0d Merge pull request #135774 from pohly/e2e-framework-ginkgo-wrappers
E2E framework: make usage of Ginkgo wrappers optional
2026-01-07 19:01:38 +05:30
Patrick Ohly
4e6cf3ca0c ktesting: shorter error logging in WithError
Gomega formats errors by first showing Error() (already has all information
after WithError) and then again by dumping the error struct, which is redundant
in this case. We can avoid the latter by providing a GomegaString
implementation which returns nothing.
2026-01-07 14:11:33 +01:00
Patrick Ohly
01765f4a41 ktesting: more flexible Eventually/Consistently
Being able to call arbitrary functions is useful, even if it means giving up
some compile-time checking. Because we now use reflection,
Eventually/Consistently can be methods.
2026-01-07 14:11:33 +01:00
Patrick Ohly
c47ad64820 DRA e2e+integration: test ResourceSlice controller
The "create 100 slices" E2E sometimes flaked with timeouts (e.g. 95 out of 100
slices created). It created too much load for an E2E test.

The same test now uses ktesting as API, which makes it possible to run it as
integration test with the original 100 slices and with more moderate 10 slices
as E2E test.
2026-01-07 14:11:33 +01:00
Patrick Ohly
047682908d ktesting: replace Begin/End with TContext.Step
Manually pairing Being with End is too error prone to be useful. It had the
advantage of keeping variables created between them visible to the following
code, but that doesn't justify using those calls.

By using a callback we can achieve a few things:

- Code using it automatically shadows the parent tCtx, thus enforcing
  that within a code block the tCtx with step is used consistently.
- The code block is clearly delineated with curly braces.
- When the code block ends, the unmodified parent tCtx is automatically
  in scope again.

Downsides:

- Extra boilerplate for the anonymous function.
  Python's `with tCtx.Step(...) as tCtx: ` would be nicer.
  As an approximation of that `for tCtx := range tCtx.Step(...)` was
  tried with `Step` returning an iterator, but that wasn't very idiomatic.
- Variables created inside the code block are not visible outside of it.
2026-01-07 14:11:33 +01:00
Patrick Ohly
de47714879 DRA upgrade/downgrade: rewrite as Go unit test
tCtx.Run and sub-tests make it much simpler to separate the different steps
than with Ginkgo because unless a test runs tCtx.Parallel (which we don't do
here), everything runs sequentially in a deterministic order.

Right now we get:

    ...
        localupcluster.go:285: I1210 12:24:22.067524] bring up v1.34: stopping kubelet
        localupcluster.go:285: I1210 12:24:22.067548] bring up v1.34: stopping kube-scheduler
        localupcluster.go:285: I1210 12:24:22.067570] bring up v1.34: stopping kube-controller-manager
        localupcluster.go:285: I1210 12:24:22.067589] bring up v1.34: stopping kube-apiserver
    --- PASS: TestUpgradeDowngrade (94.78s)
        --- PASS: TestUpgradeDowngrade/after-cluster-creation (2.07s)
            --- PASS: TestUpgradeDowngrade/after-cluster-creation/core_DRA (2.05s)
            --- PASS: TestUpgradeDowngrade/after-cluster-creation/ResourceClaim_device_status (0.02s)
        --- PASS: TestUpgradeDowngrade/after-cluster-upgrade (4.10s)
            --- PASS: TestUpgradeDowngrade/after-cluster-upgrade/core_DRA (4.09s)
            --- PASS: TestUpgradeDowngrade/after-cluster-upgrade/ResourceClaim_device_status (0.01s)
        --- PASS: TestUpgradeDowngrade/after-cluster-downgrade (1.24s)
            --- PASS: TestUpgradeDowngrade/after-cluster-downgrade/core_DRA (1.21s)
            --- PASS: TestUpgradeDowngrade/after-cluster-downgrade/ResourceClaim_device_status (0.02s)
    PASS

It's even possible to use `-failfast` and
e.g. `-run=TestUpgradeDowngrade/after-cluster-creation/core_DRA`: `go test` then
runs everything up to that sub-test or any failing sub-test, then stops and
cleans up.
2026-01-07 14:11:33 +01:00
Patrick Ohly
7c7b1e1018 DRA e2e: make driver deployment possible in Go unit tests
This leverages ktesting as wrapper around Ginkgo and testing.T to make all
helper code that is needed to deploy a DRA driver available to Go unit
tests and thus integration tests.

How to proceed with unifying helper code for integration and E2E testing is
open. This is just a minimal first step in that direction. Ideally, such
code should be in separate packages where usage of Ginkgo, e2e/framework
and gomega.Expect/Eventually/Consistently are forbidden.

While at it, the builder gets extended to make cleanup optional.
This will be needed for upgrade/downgrade testing with sub-tests.
2026-01-07 14:11:33 +01:00
Marek Siarkowicz
fd2083450a Cleanup WatchFromStorageWithoutResourceVersion feature gate 2026-01-07 13:57:11 +01:00
Kubernetes Prow Robot
21f7c3ff68 Merge pull request #135777 from serathius/init-hook-default
Enable WatchCacheInitializationPostStartHook by default
2026-01-07 17:31:46 +05:30
Patrick Ohly
e4ab523161 E2E framework: make usage of Ginkgo wrappers optional
Previously it was necessary to use the Ginkgo wrappers when
using any of the custom arguments like WithSlow(). Now the
hook within Ginkgo for modifying arguments is used such that
e.g. the original ginkgo.It also works.
2026-01-07 12:05:43 +01:00
Patrick Ohly
47d02070ba E2E: remove unnecessary trailing spaces in test names
The spaces are unnecessary because Ginkgo adds spaces automatically.

This was detected before only for tests using the wrapper functions,
now it also gets detected for ginkgo methods.
2026-01-07 12:05:43 +01:00
Harshal Patil
1e71a25950 Fix race condition in DRA health e2e test pod status update
Signed-off-by: Harshal Patil <12152047+harche@users.noreply.github.com>
2026-01-05 14:13:40 -05:00
Patrick Ohly
65ef31973c DRA upgrade/downgrade: split out individual test steps
This approach with collecting results from callbacks in a main ginkgo.It and
using them as failures in separate ginkgo.It callbacks might be the best that
can be done with Ginkgo.

A better solution is probably Go unit tests with sub-tests.
2026-01-05 13:45:03 +01:00
Patrick Ohly
47b613eded e2e framework: support creating TContext
This makes it possible to call helper packages which expect a TContext from E2E
tests.

The implementation uses GinkgoT as TB and supports registering cleanup
callbacks which expect a context. These callbacks then run with a context that
comes from ginkgo.DeferCleanup, just as if they had called that directly.
2026-01-05 13:45:03 +01:00
Patrick Ohly
dab76ef8de ktesting: add namespace support
Many helper packages need to know the test namespace in addition to the client.
Supporting passing of that information through the TContext avoids adding
another parameter to such helper packages.

This mirrors similar functionality in framework.Framework which also provides
a namespace to the test and packages taking such a parameter.
2026-01-05 13:45:03 +01:00
Patrick Ohly
57ae8e991a ktesting: safer RESTConfig()
Instead of granting callers access to the instance stored in the context,
let's return a copy. Otherwise a caller might accidentally modify what is
stored in the context when they forget to make a copy themselves before
modifying fields.
2026-01-05 13:45:03 +01:00
Patrick Ohly
551cf6f171 ktesting: reimplement without interface
The original implementation was inspired by how context.Context is handled via
wrapping a parent context. That approach had several issues:

- It is useful to let users call methods (e.g. tCtx.ExpectNoError)
  instead of ktesting functions with a tCtx parameters, but that only
  worked if all implementations of the interface implemented that
  set of methods. This made extending those methods cumbersome (see
  the commit which added Require+Assert) and could potentially break
  implementations of the interface elsewhere, defeating part of the
  motivation for having the interface in the first place.

- It was hard to see how the different TContext wrappers cooperated
  with each other.

- Layering injection of "ERROR" and "FATAL ERROR" on top of prefixing
  with the klog header caused post-processing of a failed unit test to
  remove that line because it looked like log output. Other log output
  lines where kept because they were not indented.

- In Go <=1.25, the `go vet sprintf` check only works for functions and
  methods if they get called directly and themselves directly pass their
  parameters on to fmt.Sprint. The check does not work when calling
  methods through an interface. Support for that is coming in Go 1.26,
  but will depend on bumping the Go version also in go.mod and thus
  may not be immediately possible in Kubernetes.

- Interface documentation in
  https://pkg.go.dev/k8s.io/kubernetes@v1.34.2/test/utils/ktesting#TContext
  is a monolithic text block. Documentation for methods is more readable and allows
  referencing those methods with [] (e.g. [TC.Errorf] works, [TContext.Errorf]
  didn't).

The revised implementation is a single struct with (almost) no exported
fields. The two exceptions (embedded context.Context and TB) are useful because
it avoids having to write wrappers for several functions resp. necessary
because Helper cannot be wrapped. Like a logr.LogSink, With* methods can make a
shallow copy and then change some fields in the cloned instance.

The former `ktesting.TContext` interface is now a type alias for
`*ktesting.TC`. This ensures that existing code using ktesting doesn't need to
be updated and because that code is a bit more compact (`tCtx
ktesting.TContext` instead of `tCtx *ktesting.TContext` when not using such an
alias). Hiding that it is a pointer might discourage accessing the exported
fields because it looks like an interface.

Output gets fixed and improved such that:
- "FATAL ERROR" and "ERROR" are at the start of the line, followed by the klog header.
- The failure message follows in the next line.
- Continuation lines are always indented.

The set of methods exposed via TB is now a bit more complete (Attr, Chdir).

All former stand-alone With* functions are now also available as methods and
should be used instead of the functions. Those will be removed.

Linting of log calls now works and found some issues.
2026-01-05 13:45:03 +01:00
Patrick Ohly
8a10a1a4a4 ktesting: add tContext.Require and tContext.Assert
Assert is useful because sometimes one wants to check several different things
in the same test, without stopping after the first failed assertion.

Require gets added for symmetry and to mirror testify's require and
assert. Require is identical to Expect (gomega naming).
2026-01-05 13:45:03 +01:00
Patrick Ohly
095475485f ktesting: rewrite unit testing with mock TB
We need to see the actual effect that ktesting will have when used as wrapper
around testing.T. Producing an error hid that adding the klog header makes some
output sub-optimal:

     <klog header>: FATAL ERROR: ...

The problem with having the klog header at the beginning of the line is that
the Kubernetes `make test` post-processing treats this as log output instead
of the failure message of the test. Will be fixed separately.
2026-01-05 13:45:03 +01:00
Patrick Ohly
1a866b8795 e2e framework: fix inconsistency in log output
Example:

    I1208 16:01:05.852628 243 upgradedowngrade_test.go:239] get source code version: bring up v1.34: cluster is running, use KUBECONFIG=/var/run/kubernetes/admin.kubeconfig to access it
    I1208 16:01:05.869679     243 reflector.go:446] "Caches populated" type="*v1.ServiceAccount" reflector="k8s.io/client-go/tools/watch/informerwatcher.go:162"

The first line is printed via framework.Logf, which is meant to emulate the
format used by the klog text logger in the second line. The difference is that
klog formats the pid with 7 characters, padding on the left with spaces.

Consistency trumps brevity here, so let's format exactly as in klog.
2026-01-05 13:45:03 +01:00
Kubernetes Prow Robot
8d1296caf2 Merge pull request #135912 from pohly/scheduler-plugin-test-data-race
scheduler: plugin test DATA RACE fix
2025-12-29 14:46:35 +05:30
Kubernetes Prow Robot
ed4b5ee317 Merge pull request #134350 from macsko/add_scheduling_duration_collector
Add scheduling duration collector to scheduler_perf
2025-12-28 05:50:33 +05:30
Patrick Ohly
f758d0850b scheduler: plugin test DATA RACE fix
Reading numPreFilterCalled races with writing it in the scheduler, at least as
far as the data race detector is concerned. That the test waits for pod
scheduling is too indirect. enqueuePlugin.called has the same problem,
but hasn't triggered the race detector (yet).

We need to protect against concurrent access. The easiest way to enforce that
is via atomic.Int64. In contrast to a mutex it is impossible to use it wrong.

Shutting down the scheduler first was also tried, but didn't work out because
"teardown" does more than just stopping the scheduler, it also cancels a
context that is needed during test shutdown.
2025-12-23 19:13:53 +01:00
Maciej Skoczeń
4954c5e3b0 Disable SchedulerAsyncAPICalls in v1.35 due to performance issues 2025-12-23 12:34:47 +00:00
Kubernetes Prow Robot
9bd81471eb Merge pull request #135805 from humblec/etcd-3.6.7
etcd: Update etcd to v3.6.7
2025-12-22 16:28:39 -08:00
Kubernetes Prow Robot
9f68013b1e Merge pull request #135501 from shivamwayal37/fix/113359-win-snapshot-fs-size
Fix: Use Get-Volume for Windows snapshot size verification
2025-12-22 09:08:31 -08:00
Kubernetes Prow Robot
99e77f8c46 Merge pull request #134243 from lucming/lucming/enhan-stsfs-type
fix: Check Statfs_t type using unix package only
2025-12-20 15:48:31 -08:00
Kubernetes Prow Robot
7d0b8f979c Merge pull request #135629 from jsafrane/selinux-fix-completed-pods
selinux: Fix the controller to ignore finished pods
2025-12-19 11:52:33 -08:00
Kubernetes Prow Robot
268bdbe214 Merge pull request #135836 from pohly/ginkgo-gomega-update
dependencies: ginkgo v2.27.3 + gomega v1.38.3
2025-12-19 08:36:39 -08:00
Jan Safranek
02d4c11b00 Added e2e tests with disabled SELinux
Added few tests with a CSI driver that does not support SELinux and has it
disabled in its CSIDriver instance
2025-12-19 14:45:38 +01:00
Marek Siarkowicz
8b0cdec46b Enable genericfeatures.WatchCacheInitializationPostStartHook as default
Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2025-12-19 13:48:48 +01:00
Patrick Ohly
db841afdbb dependencies: ginkgo v2.27.3 + gomega v1.38.3
This fixes some issues found in Kubernetes (data race in ginkgo CLI, gomega
formatting) and helps with diagnosing OOM killing in CI jobs (exit status of
processes).

The modified gomega formatting shows up in some of the output tests for the E2E
framework. They get updated accordingly.
2025-12-19 10:37:54 +01:00
hongkang
be9b3d5a46 Add e2e test for VolumeAttachment cleanup when CSIDriver AttachRequired changes
Signed-off-by: hongkang <mzhkcj50@gmail.com>
2025-12-19 15:56:33 +08:00
Kubernetes Prow Robot
86b66f6f33 Merge pull request #135510 from dims/add-utility-to-summarize-feature-gates-in-markdown
Add utility to summarize feature gates in markdown
2025-12-18 21:34:31 -08:00
Davanum Srinivas
8703640651 add utility for generating markdown for feature gates
Signed-off-by: Davanum Srinivas <davanum@gmail.com>

fix for review comments

Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2025-12-18 22:53:56 -05:00
Kubernetes Prow Robot
8d7db1d19e Merge pull request #135834 from dgrisonnet/revert-135680
Revert "test/e2e: increase memory limits in pod resize tests"
2025-12-18 18:32:37 -08:00
Kubernetes Prow Robot
b9d491f56e Merge pull request #134556 from carlory/fix-133160
lock the feature-gate VolumeAttributesClass to default (true)
2025-12-18 15:13:17 -08:00
Damien Grisonnet
315c38fb8a Revert "test/e2e: increase memory limits in pod resize tests"
This reverts commit a2cf7f770d.
2025-12-18 19:05:47 +01:00
Humble Devassy Chirammal
8dc8edf49b etcd: Update etcd to v3.6.7
ETCD 3.6.7 has some critical bug fixes
https://github.com/etcd-io/etcd/blob/main/CHANGELOG/CHANGELOG-3.6.md

Signed-off-by: Humble Devassy Chirammal <humble.devassy@gmail.com>
2025-12-18 19:05:14 +05:30
Patrick Ohly
ad79e479c2 build: remove deprecated '// +build' tag
This has been replaced by `//build:...` for a long time now.

Removal of the old build tag was automated with:

    for i in $(git grep -l '^// +build' | grep -v -e '^vendor/'); do if ! grep -q '^// Code generated' "$i"; then sed -i -e '/^\/\/ +build/d' "$i"; fi; done
2025-12-18 12:16:21 +01:00
Kubernetes Prow Robot
a504b1b4eb Merge pull request #135755 from pohly/dra-logging
DRA: log more information
2025-12-18 02:10:38 -08:00