Commit Graph

113876 Commits

Author SHA1 Message Date
Stephen Heywood
539d0a0f6c Create APIService lifecycle e2e test
The test validates the following endpoints
- deleteApiregistrationV1CollectionAPIService
- patchApiregistrationV1APIServiceStatus
- replaceApiregistrationV1APIService
- replaceApiregistrationV1APIServiceStatus
2023-01-31 20:47:51 +13:00
Patrick Ohly
4740d34edb e2e: consolidate checking a pod list
WaitForPods is now a generic function which lists pods and then checks the pods
that it found against some provided condition. A parameter determines how many
pods must be found resp. match the condition for the check to succeed.
2023-01-31 07:52:26 +01:00
Patrick Ohly
cd0c756c72 e2e pod: use gomega.Eventually in WaitTimeoutForPodReadyInNamespace/WaitForPodCondition
These get converted together because they relied on FinalErr which now isn't
needed anymore.
2023-01-31 07:52:26 +01:00
Patrick Ohly
5c1723d81f e2e framework: support getting list of objects
This is similar to the previous support for getting a single object.
2023-01-31 07:52:26 +01:00
Patrick Ohly
671835e976 e2e pod: use gomega.Eventually in WaitForPodsRunningReady
The code becomes simpler (78 insertions, 91 deletions), easier to read (all
code entirely inside WaitForPodsRunningReady, no need to declare and later
overwrite variables) and possibly more correct (if all API calls failed,
the resulting error was ignored when allowedNotReadyPods > 0).
2023-01-31 07:52:26 +01:00
Patrick Ohly
b6ede21ff1 e2e framework: turn function into gomega.Matcher
The intention is to use this inside a helper function where the
corresponding Expect call is known.
2023-01-31 07:52:26 +01:00
Patrick Ohly
3ebab68c8a e2e: remove unused label filter from WaitForPodsRunningReady
None of the users of the functions passed anything other than nil or an empty
map and the implementation ignore the parameter - it seems like a candidate for
simplification.
2023-01-31 07:52:26 +01:00
Patrick Ohly
1b5da1035a e2e framework: include additional stack backtrace in failures
When a Gomega failure is converted to an error, the stack at the time when the
failure occurs may be useful: error wrapping provides some bread crumbs that
can be followed to determine where the failure really occurred, but error
wrapping may be missing or ambiguous.

To provide the additional information, a FailureError now includes a full stack
backtrace. The backtrace intentionally makes no attempt to exclude framework
functions besides the gomega support itself because helpers like
e2e/framework/pod may be relevant.

That backtrace is not included in the failure message for the sake of
brevity. Instead, it gets logged as part of the test's output.
2023-01-31 07:52:26 +01:00
Patrick Ohly
e8a50b0583 e2e framework: implement pod polling with gomega.Eventually
gomega.Eventually provides better progress reports: instead of filling up the
log with rather useless one-line messages that are not enough to to understand
the current state, it integrates with Gingko's progress reporting (SIGUSR1,
--poll-progress-after) and then dumps the same complete failure message as
after a timeout. That makes it possible to understand why progress isn't
getting made without having to wait for the timeout.

The other advantage is that the failure message for some unexpected pod state
becomes more readable: instead of encapsulating it as "observed object" inside
an error, it directly gets rendered by gomega.
2023-01-31 07:52:26 +01:00
Patrick Ohly
0872e8d927 e2e framework: gomega assertions as errors
Calling gomega.Expect/Eventually/Consistently deep inside a helper call chain
has several challenges:
- the stack offset must be tracked correctly, otherwise the callstack
  for the failure starts at some helper code, which is often not informative
- augmenting the failure message with additional information from each
  caller implies that each caller must pass down a string and/or format
  string plus arguments

Both challenges can be solved by returning errors:
- the stacktrace is taken at that level where the error is
  treated as a failure instead of passing back an error, i.e.
  inside the It callback
- traditional error wrapping can add additional information, if
  desirable

What was missing was some easy way to generate an error via a gomega
assertion. The new infrastructure achieves that by mirroring the
Gomega/Assertion/AsyncAssertion interfaces with errors as return values instead
of calling a fail handler.

It is intentionally less flexible than the gomega APIs:
- A context must be passed to Eventually/Consistently as first
  parameter because that is needed for proper timeout handling.
- No additional text can be added to the failure through this
  API because error wrapping is meant to be used for this.
- No need to adjust the callstack offset because no backtrace
  is recorded when a failure occurs.

To avoid the useless "unexpected error" log message when passing back a gomega
failure, ExpectNoError gets extended to recognize such errors and then skips
the logging.
2023-01-31 07:52:26 +01:00
Patrick Ohly
b3366ce895 e2e storage: remove WaitForPodTerminatedInNamespace
Calling WaitForPodTerminatedInNamespace after testFlexVolume is useless because
the client pod that it waits for always gets deleted by testVolumeClient:

0fcc3dbd55/test/e2e/framework/volume/fixtures.go (L541-L546)

Worse, because WaitForPodTerminatedInNamespace treats "not found" as "must keep
polling", these two tests always kept waiting for 5 minutes:

    Kubernetes e2e suite: [It] [sig-storage] Flexvolumes should be mountable
    when non-attachable 	6m4s

The only reason why these tests passed is that WaitForPodTerminatedInNamespace
used to return the "not found" API error. That is not guaranteed and about to
change.
2023-01-31 07:52:26 +01:00
Kubernetes Prow Robot
f9a3fd2810
Merge pull request #115346 from gnufied/set-staging-path-expansion
Set node_stage_path whenever available
2023-01-30 21:38:47 -08:00
David Porter
71719a6036 test: Bump timeout for runPausePod
The `runPausePod` timeout was 1 minute previously which appears to be
too short and timing out in some tests.

Switch to `f.Timeouts.PodStartShort` which is the common timeout used to wait
for pods to start which defaults to 5min.

Also refactor to remove `runPausePodWithoutTimeout` and instead rely on
`runPausePod` since we do not make the timeout customizable directly
(it can be changed via the test framework if desired).

Signed-off-by: David Porter <david@porter.me>
2023-01-30 21:27:59 -08:00
Kubernetes Prow Robot
e150be6872
Merge pull request #115375 from liggitt/validate-timezone
Validate format of timeZone before calling system LoadLocation method
2023-01-30 19:48:48 -08:00
Kubernetes Prow Robot
981c4d59fb
Merge pull request #115155 from adrianreber/2023-01-18-checkpoint-test-result
Extend checkpoint e2e test to check for results
2023-01-30 18:43:16 -08:00
Kubernetes Prow Robot
423f62d69a
Merge pull request #115138 from danwinship/kep-3453-beta
Move KEP-3453 MinimizeIPTablesRestore to beta
2023-01-30 18:43:08 -08:00
Kubernetes Prow Robot
4df945853e
Merge pull request #115137 from swatisehgal/topologymgr-metrics
node: topologymgr: add metrics about admission requests and errors
2023-01-30 18:43:00 -08:00
Kubernetes Prow Robot
3244ebd532
Merge pull request #113973 from my-git9/invalidurl
fix invalid url
2023-01-30 18:42:48 -08:00
Kubernetes Prow Robot
9fb6306068
Merge pull request #115292 from SergeyKanzhelev/wrongDirName
change the comment in CRI API to point to the correct logs directory
2023-01-30 17:37:00 -08:00
Kubernetes Prow Robot
559014f13e
Merge pull request #115273 from SergeyKanzhelev/restartCountRegexFix
use a proper regex looking for the restartCount
2023-01-30 17:36:49 -08:00
Kubernetes Prow Robot
5d4776adc1
Merge pull request #114948 from haoruan/feature-api-doc-field-linter
Add linter to check if api docs match field tag names
2023-01-30 16:21:09 -08:00
Kante Yin
3d0894fabf
Fix failure(context canceled) in scheduler_perf benchmark (#114843)
* Fix failure in scheduler_perf benchmark

Signed-off-by: Kante Yin <kerthcet@gmail.com>

* Fatal when error in cleaning up nodes in scheduler perf tests

Signed-off-by: Kante Yin <kerthcet@gmail.com>

* Use derived context to better organize the codes

Signed-off-by: Kante Yin <kerthcet@gmail.com>

* Change log level to 2 in scheduler perf-test

Signed-off-by: Kante Yin <kerthcet@gmail.com>

---------

Signed-off-by: Kante Yin <kerthcet@gmail.com>
2023-01-30 16:21:00 -08:00
Kubernetes Prow Robot
2eb2c88b1d
Merge pull request #109869 from mauriciopoppe/ephemeral-generic-patch-sc
Skip Generic Ephemeral Volume tests if VolumeBindingMode is immediate and it's a multi-topology environment
2023-01-30 16:20:48 -08:00
Nilekh Chaudhari
b3f326722d
chore: improves tests
Signed-off-by: Nilekh Chaudhari <1626598+nilekhc@users.noreply.github.com>
2023-01-30 23:18:14 +00:00
Jordan Liggitt
7e19850f31
Validate format of timeZone 2023-01-30 17:01:45 -05:00
Kubernetes Prow Robot
0cb1eabbf0
Merge pull request #115339 from kevindelgado/patch-opton-params
Separate Put and Patch Options
2023-01-30 13:49:00 -08:00
Kubernetes Prow Robot
d863d04adc
Merge pull request #114580 from pohly/e2e-ginkgo-timeout-fixes
e2e ginkgo timeout fixes, III
2023-01-30 13:48:48 -08:00
Abu Kashem
ca492a9b62
client-go: add unit test for Request thread safety 2023-01-30 16:24:02 -05:00
Sarvesh Rangnekar
203b91c486 Add integration tests for MultiCIDRRangeAllocator
Adds integration tests for the following scenarios with
MultiCIDRRangeAllocator enabled:
- ClusterCIDR is released when an associated node is deleted.
- ClusterCIDR delete when a node is associated, validate the finalizer
  behavior, make sure that deleted ClusterCIDR is cleaned up after the
  associated node is deleted.
- ClusterCIDR marked as terminating due to deletion must not be used for
  allocating Pod CIDRs to new nodes.
- Tie break behavior when multiple ClusterCIDRs are eligible to
  allocate Pod CIDRs to a node.
2023-01-30 20:42:55 +00:00
Kubernetes Prow Robot
c9e281df23
Merge pull request #115341 from tkashem/delete-collection
apiserver: remove 34s timeout from DELETECOLLECTION rest handler
2023-01-30 12:41:01 -08:00
Kubernetes Prow Robot
6d17cb2051
Merge pull request #115266 from pohly/gomega-update
dependencies: update gomega to v1.26.0
2023-01-30 12:40:49 -08:00
Sarvesh Rangnekar
a8f120b76c Fix the delete flow for ClusterCIDR objects
Fixes the deletion of ClusterCIDR object, when a Node is associated(has
Pod CIDRs allocated from this ClusterCIDR) with it. Currently the
ClusterCIDR finalizer is never cleaned up as there is no reconciliation
happening after the associated Node has been deleted. This commit fixes
the issue by adding workitems from all events to a worker queue and
reconcile until the delete is successful.
2023-01-30 19:35:41 +00:00
Kevin Delgado
f0394dd6e0 Separate Put and Patch Options 2023-01-30 19:16:10 +00:00
Antoine Pelisse
06aff8a546 apiextensions: SchemaHas predicate must be read-only/non-captured 2023-01-30 11:08:16 -08:00
Antoine Pelisse
7dea3409d4 apiextensions: Pool schemas in SchemaHas
Using a `sync.Pool` to re-use the buffers that have to escape in the
predicate significantly reduces the number of allocations needed to run
the SchemaHas method, as shown in the following example:

```
> benchstat old.bench new.bench
name         old time/op    new time/op    delta
SchemaHas-8    11.0ms ± 0%     2.1ms ± 1%   -80.60%  (p=0.008 n=5+5)

name         old alloc/op   new alloc/op   delta
SchemaHas-8    37.5MB ± 0%     0.0MB ± 0%  -100.00%  (p=0.008 n=5+5)

name         old allocs/op  new allocs/op  delta
SchemaHas-8     73.1k ± 0%      0.0k       -100.00%  (p=0.008 n=5+5)
```
2023-01-30 11:07:52 -08:00
Chris Henzie
dbc7d8ded0 feat: support preemption for pods using ReadWriteOncePod PVCs
PVCs using the ReadWriteOncePod access mode can only be referenced by a
single pod. When a pod is scheduled that uses a ReadWriteOncePod PVC,
return "Unschedulable" if the PVC is already in-use in the cluster.

To support preemption, the "VolumeRestrictions" scheduler plugin
computes cycle state during the PreFilter phase. This cycle state
contains the number of references to the ReadWriteOncePod PVCs used by
the pod-to-be-scheduled.

During scheduler simulation (AddPod and RemovePod), we add and remove
reference counts from the cycle state if they use any of these
ReadWriteOncePod PVCs.

In the Filter phase, the scheduler checks if there are any PVC reference
conflicts, and returns "Unschedulable" if there is a conflict.

This is a required feature for the ReadWriteOncePod beta. See for more context:
https://github.com/kubernetes/enhancements/tree/master/keps/sig-storage/2485-read-write-once-pod-pv-access-mode#beta
2023-01-30 10:59:22 -08:00
Kubernetes Prow Robot
ad2a9f2f33
Merge pull request #113863 from msau42/owners
update sig-storage owners
2023-01-30 10:10:50 -08:00
Antoine Pelisse
a7c0467e01 apiextensions: Benchmark escaping in SchemaHas
SchemaHas needs to escape the apiextensions.JSONSchemaProps pointer
since it's calling an arbitrary predicate function that can keep a copy
of the pointer (even though it shouldn't, but the compiler can't know
that). The leak is resulting in a fair amount of memory allocation when
installing many CRDs in a row (about 3% of the memory allocated happens
in this method).
2023-01-30 10:07:53 -08:00
Kubernetes Prow Robot
5681b0da14
Merge pull request #115338 from danwinship/nodeutil.gethostname
Move GetHostname() from k/k/pkg/util/node to k/component-helpers/node/util
2023-01-30 09:07:20 -08:00
Kubernetes Prow Robot
4b074c816e
Merge pull request #115298 from knelasevero/StartTestServerCtx
Pass context to StartTestServer to get contextualized logger from it during tests
2023-01-30 09:07:12 -08:00
Kubernetes Prow Robot
d0584179f4
Merge pull request #114367 from liggitt/kubelet-csr-init
Check for initial kubelet certificates more frequently
2023-01-30 09:07:05 -08:00
Kubernetes Prow Robot
d529048a3e
Merge pull request #112809 from tkashem/cors-cve
apiserver: fix cve for CORS
2023-01-30 09:06:52 -08:00
Hemant Kumar
c9fc35c496 reword the warning that gets printed on external expansion 2023-01-30 11:37:30 -05:00
Kubernetes Prow Robot
4198d66457
Merge pull request #108835 from guettli/patch-2
Extend example to contain --as=...
2023-01-30 08:00:50 -08:00
Abu Kashem
709748a34e
apiserver: remove 34s from DELETECOLLECTION rest handler 2023-01-30 10:55:52 -05:00
Kubernetes Prow Robot
c829397f7a
Merge pull request #115354 from pohly/dra-reserved-for-list-type
dynamic resource allocation: avoid apiserver complaint about list content
2023-01-30 06:24:50 -08:00
Kubernetes Prow Robot
7b243cef1a
Merge pull request #115368 from tzneal/correct-comment
update comment to match implementation
2023-01-29 17:21:16 -08:00
Kubernetes Prow Robot
232c0de57a
Merge pull request #115101 from HirazawaUi/delte-pkg-kubelet-unused-functions
delete unused functions in pkg/kubelet directory
2023-01-29 17:21:08 -08:00
Kubernetes Prow Robot
e205779856
Merge pull request #115062 from neersighted/drop_pause_workaround
pause: remove obsolete Windows buildx workaround
2023-01-29 17:21:01 -08:00
Kubernetes Prow Robot
a94a35293b
Merge pull request #114490 from MadhavJivrajani/update-contention-profiling-docs
*: Make docs more accurate for the contention-profiling flag
2023-01-29 17:20:49 -08:00