Commit Graph

22850 Commits

Author SHA1 Message Date
Patrick Ohly
136f89dfc5 e2e: use error wrapping with %w
The recently introduced failure handling in ExpectNoError depends on error
wrapping: if an error prefix gets added with `fmt.Errorf("foo: %v", err)`, then
ExpectNoError cannot detect that the root cause is an assertion failure and
then will add another useless "unexpected error" prefix and will not dump the
additional failure information (currently the backtrace inside the E2E
framework).

Instead of manually deciding on a case-by-case basis where %w is needed, all
error wrapping was updated automatically with

    sed -i "s/fmt.Errorf\(.*\): '*\(%s\|%v\)'*\",\(.* err)\)/fmt.Errorf\1: %w\",\3/" $(git grep -l 'fmt.Errorf' test/e2e*)

This may be unnecessary in some cases, but it's not wrong.
2023-02-06 15:39:13 +01:00
Patrick Ohly
9878e735dd e2e pod: unit test for pod status + API error
This covers new behavior in gomega.
2023-02-06 15:39:13 +01:00
Patrick Ohly
1bd1167d56 e2e pod: remove dead code 2023-02-06 15:39:13 +01:00
Patrick Ohly
3bb735e6fa e2e pod: use gomega.Eventually in WaitForRestartablePods 2023-02-06 15:39:13 +01:00
Patrick Ohly
1e346c4e4a e2e pod: convert ProxyResponseChecker into matcher
Instead of pod responses being printed to the log each time polling fails, we
get a consolidated failure message with all unexpected pod responses if (and
only if) the check times out or a progress report gets produced.
2023-02-06 15:39:13 +01:00
Patrick Ohly
c3266cde77 e2e: consolidate pod response checking
This renames PodsResponding to WaitForPodsResponding for the sake of
consistency and adds a timeout parameter. That is necessary because some other
users of NewProxyResponseChecker used a much lower timeout (2min vs. 15min).

Besides simplifying some code, it also makes it easier to rewrite
ProxyResponseChecker because it only gets used in WaitForPodsResponding.
2023-02-06 15:39:13 +01:00
Patrick Ohly
89a5d6d8af e2e pod: use gomega.Eventually in WaitForPodNotFoundInNamespace 2023-02-06 15:39:13 +01:00
Patrick Ohly
9df3e2a47a e2e: replace WaitForPodToDisappear with WaitForPodNotFoundInNamespace
WaitForPodToDisappear was always called such that it listed all pods, which
made it less efficient than trying to get just the one pod it was checking for.

Being able to customize the poll interval in practice wasn't useful, therefore
it can be replaced with WaitForPodNotFoundInNamespace.
2023-02-06 15:39:12 +01:00
Patrick Ohly
45d4631069 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-02-06 15:39:12 +01:00
Patrick Ohly
d8428c6fb1 e2e pod: use gomega.Eventually in WaitTimeoutForPodReadyInNamespace/WaitForPodCondition
These get converted together because they relied on FinalErr which now isn't
needed anymore.
2023-02-06 15:39:12 +01:00
Patrick Ohly
01a40d9d6b e2e framework: support getting list of objects
This is similar to the previous support for getting a single object.
2023-02-06 15:39:12 +01:00
Patrick Ohly
3dd185aa40 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-02-06 15:39:12 +01:00
Patrick Ohly
afbb2c5323 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-02-06 15:39:12 +01:00
Patrick Ohly
4d63e7d4d6 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-02-06 15:39:12 +01:00
Patrick Ohly
8181f97ecc 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-02-06 15:39:12 +01:00
Patrick Ohly
005a9da0cc 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-02-06 15:39:12 +01:00
Patrick Ohly
71dc81ec89 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-02-06 15:39:12 +01:00
Patrick Ohly
d17ce64ac5 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-02-06 15:39:12 +01:00
Antonio Ojea
7f5ae1c0c1
Revert "e2e: wait for pods with gomega" 2023-02-06 12:08:22 +01:00
Kubernetes Prow Robot
cf14b50b0d
Merge pull request #114502 from cpanato/go1.20
[go] Bump images, dependencies and versions to go 1.20
2023-02-04 13:40:28 -08:00
Kubernetes Prow Robot
85aa0057c6
Merge pull request #113298 from pohly/e2e-wait-for-pods-with-gomega
e2e: wait for pods with gomega
2023-02-04 05:26:29 -08:00
cpanato
b9ddf07a75
[go] Bump images, dependencies and versions to go 1.20
Signed-off-by: cpanato <ctadeu@gmail.com>
2023-02-03 22:55:24 +01:00
pwschuurman
7bf175d5a2
Add integration tests for StatefulSetStartOrdinal feature (#115466)
* Add integration tests for StatefulSetStartOrdinal feature

* Move expensive test setup (apiserver and running controller) to be run once in StatefulSetStartOrdinal parameterized tests
2023-02-03 05:26:29 -08:00
Maciej Szulik
8b48ff3584
Don't explicitly set image version in tests
Image versions are already explicitly set in our manifests
configuration, so tests should not be setting these values
to ensure we're using the same versions across the board.
2023-02-02 19:06:00 +01:00
Kubernetes Prow Robot
f97d14c6c8
Merge pull request #115453 from sarveshr7/multicidr-tests
Add integration tests for MultiCIDRRangeAllocator
2023-02-01 12:21:45 -08:00
Kubernetes Prow Robot
d415647739
Merge pull request #115441 from bobbypage/busybox-mirror-test
test: Use preloaded busybox image in mirror pod test
2023-02-01 12:21:36 -08:00
Sarvesh Rangnekar
9875c1b661 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 PodCIDRs to new nodes.
- Tie break behavior when multiple ClusterCIDRs are eligible to
  allocate PodCIDRs to a node.
2023-02-01 13:48:07 +00:00
Kubernetes Prow Robot
36450ee422
Merge pull request #115423 from pohly/scheduler-perf-goroutine-leak
scheduler perf: goroutine leak
2023-02-01 04:51:06 -08:00
Patrick Ohly
a7f658e442 test/integration: fix Broadcaster leak
When starting a scheduler, the event broadcaster for it wasn't stopped.
2023-02-01 12:42:50 +01:00
Kubernetes Prow Robot
3a4cef70f2
Merge pull request #115445 from bobbypage/gh-115381
test: Fix node e2e device plugin flake
2023-02-01 02:55:06 -08:00
Kubernetes Prow Robot
bb7c9739a3
Merge pull request #114759 from my-git9/chore/k8staint
chore: add k8s node-role.kubernetes.io/control-plane taint
2023-01-31 21:01:17 -08:00
David Porter
225658884b test: Fix node e2e device plugin flake
The device plugin test expects that no other pods are running prior to
the test starting. However, it has been observed that in some cases
some resources may still be around from previous tests. This is because
the deletion of resources from other tests is handled by deleting that
test's framework's namespace which is done asynchronously without
waiting for the other test's namespace to be deleted.

As a result, when the node e2e device plugin starts, there may still be
other pods in process of termination. To work around this, add a retry
to the device plugin test to account for the time it takes to delete the
resources from the prior test.

Signed-off-by: David Porter <david@porter.me>
2023-01-31 17:36:10 -08:00
Kubernetes Prow Robot
046595f11f
Merge pull request #115437 from bobbypage/115219-followup
test: Update runtime class detection logic
2023-01-31 17:05:19 -08:00
Kubernetes Prow Robot
abf8f35356
Merge pull request #113896 from nilekhc/kms-hot-reload-tests
chore: improves tests for hot reload of encryptionconfig
2023-01-31 15:50:53 -08:00
David Porter
a3291a87d7 test: Use preloaded busybox image in mirror pod test
Instead of hardcoding the busybox image, use the one that is preloaded
during the test using imageutils.

Signed-off-by: David Porter <david@porter.me>
2023-01-31 13:34:13 -08:00
David Porter
83652673b6 test: Update runtime class detection logic
In the `NodeSupportsPreconfiguredRuntimeClassHandler`, update the check
for the runtime handler to return a failure if the
`/etc/containerd/config.toml` or `/etc/crio/crio.conf` config files do
not exist. If an error is returned, then the underlying test will be
skipped.

Test manually with starting a kind cluster and moving the containerd
config file and verifying that the test is skipped:

```
$ docker exec -it kind-worker /bin/bash
root@kind-worker:/# mv /etc/containerd/config.toml /etc/containerd/config.toml.bak
```

```
make WHAT="test/e2e/e2e.test"
$ ./_output/bin/e2e.test -kubeconfig /tmp/kubeconfig_kind -ginkgo.focus=".*should run a Pod requesting a RuntimeClass with a configured handler.*" --num-nodes=1 2>&1 -ginkgo.v=1 | tee -i "/tmp/build-log.txt"

[sig-node] RuntimeClass [It] should run a Pod requesting a RuntimeClass with a configured handler [NodeFeature:RuntimeHandler]
test/e2e/common/node/runtimeclass.go:85

  [SKIPPED] Skipping test as node does not have E2E runtime class handler preconfigured in container runtime config: command terminated with exit code 1
```

Signed-off-by: David Porter <david@porter.me>
2023-01-31 11:38:49 -08:00
Antonio Ojea
5b22b13f68 Revert "Add integration tests for MultiCIDRRangeAllocator"
This reverts commit 203b91c486.
2023-01-31 17:13:23 +00:00
Kubernetes Prow Robot
eaa5104dee
Merge pull request #115214 from ii/create-apiservice-test-v4
Write APIService lifecycle test + 4 Endpoints
2023-01-31 07:38:49 -08:00
Kubernetes Prow Robot
c2299bc65f
Merge pull request #115411 from bobbypage/gh-115380
test: Bump timeout for `runPausePod`
2023-01-31 05:25:02 -08:00
Patrick Ohly
222f655062 e2e: use error wrapping with %w
The recently introduced failure handling in ExpectNoError depends on error
wrapping: if an error prefix gets added with `fmt.Errorf("foo: %v", err)`, then
ExpectNoError cannot detect that the root cause is an assertion failure and
then will add another useless "unexpected error" prefix and will not dump the
additional failure information (currently the backtrace inside the E2E
framework).

Instead of manually deciding on a case-by-case basis where %w is needed, all
error wrapping was updated automatically with

    sed -i "s/fmt.Errorf\(.*\): '*\(%s\|%v\)'*\",\(.* err)\)/fmt.Errorf\1: %w\",\3/" $(git grep -l 'fmt.Errorf' test/e2e*)

This may be unnecessary in some cases, but it's not wrong.
2023-01-31 13:01:39 +01:00
Patrick Ohly
5973e2c8cb e2e pod: unit test for pod status + API error
This covers new behavior in gomega.
2023-01-31 13:01:39 +01:00
Patrick Ohly
901928cd54 e2e pod: remove dead code 2023-01-31 13:01:39 +01:00
Patrick Ohly
f5782f1dbd e2e pod: use gomega.Eventually in WaitForRestartablePods 2023-01-31 13:01:39 +01:00
Patrick Ohly
5d8e970be6 e2e pod: convert ProxyResponseChecker into matcher
Instead of pod responses being printed to the log each time polling fails, we
get a consolidated failure message with all unexpected pod responses if (and
only if) the check times out or a progress report gets produced.
2023-01-31 13:01:39 +01:00
Patrick Ohly
3b579fca91 e2e: consolidate pod response checking
This renames PodsResponding to WaitForPodsResponding for the sake of
consistency and adds a timeout parameter. That is necessary because some other
users of NewProxyResponseChecker used a much lower timeout (2min vs. 15min).

Besides simplifying some code, it also makes it easier to rewrite
ProxyResponseChecker because it only gets used in WaitForPodsResponding.
2023-01-31 13:01:39 +01:00
Patrick Ohly
4491c80074 e2e pod: use gomega.Eventually in WaitForPodNotFoundInNamespace 2023-01-31 13:01:39 +01:00
Patrick Ohly
6eea1b2efa e2e: replace WaitForPodToDisappear with WaitForPodNotFoundInNamespace
WaitForPodToDisappear was always called such that it listed all pods, which
made it less efficient than trying to get just the one pod it was checking for.

Being able to customize the poll interval in practice wasn't useful, therefore
it can be replaced with WaitForPodNotFoundInNamespace.
2023-01-31 13:01:39 +01:00
Kubernetes Prow Robot
f8cb002452
Merge pull request #115291 from sarveshr7/multicidr-tests
Add integration tests for MultiCIDRRangeAllocator
2023-01-31 01:47:00 -08:00
Stephen Heywood
27c8184e17 Update Conformance metadata for e2e test 2023-01-31 22:09:42 +13:00
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
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
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
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
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
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
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
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
97636ed781
Merge pull request #115382 from liggitt/typecheck-stdlib
Avoid typechecking stdlib
2023-01-29 16:15:00 -08:00
Jordan Liggitt
a5d7f516d4
Avoid typechecking stdlib 2023-01-28 23:32:50 -05:00
Kubernetes Prow Robot
8e642d3d0d
Merge pull request #115310 from mzaian/etcd-3.5.7-build-image
etcd: Update to version 3.5.7
2023-01-28 10:20:42 -08:00
Kubernetes Prow Robot
86455ae12e
Merge pull request #115094 from GCES-Kubernetes-2022-2/e2e-apps
E2e apps
2023-01-28 08:52:34 -08:00
Paulo Gonçalves Lima
d1278a0830 Fix: Improves the log for failing tests in e2e/apps.
Issue #105678
2023-01-28 02:50:32 -03:00
Hemant Kumar
32851bb316 Add e2e for node expansion with missing staging path 2023-01-27 16:51:21 -05:00
Mohamed Zaian
90570b7595 etcd: Update to version 3.5.7 2023-01-27 17:24:00 +01:00
Richa Banker
452343367c Enable ComponentSLIs as beta feature 2023-01-26 17:46:21 -08:00
Richa Banker
eb55e2b980 Add e2e test for checking /metrics/slis endpoint for API server 2023-01-26 17:46:21 -08:00
Kubernetes Prow Robot
cec91d9c00
Merge pull request #115219 from bobbypage/gh-108804-skipper
e2e node: Update runtime class handler skip logic
2023-01-26 17:42:25 -08:00
Kubernetes Prow Robot
0e6f4d3a35
Merge pull request #115271 from kevindelgado/field-validation-conformance
Field validation e2e tests and GA graduation
2023-01-26 09:34:26 -08:00
Kubernetes Prow Robot
ea09f81009
Merge pull request #115311 from atwamahmoud/fix-scaleup-hpa-e2e-tests
Decrease target value for scale up tests in HPA
2023-01-26 07:34:26 -08:00
Kevin Delgado
2d5ceb9b15 drop Enabled() checks for ServerSideFieldValidation feature gate 2023-01-26 14:16:58 +00:00
Kubernetes Prow Robot
3d6c7efc23
Merge pull request #115322 from aojea/hotfix
Fix panic on ClusterIP allocation for /28 subnets
2023-01-26 00:38:26 -08:00
David Porter
6cb022ff4a test: Update Host Exec to support node e2e
Node E2E tests do not run a scheduler, so the host exec pod must have
the `spec.nodeName` set explicitly.

Signed-off-by: David Porter <david@porter.me>
2023-01-26 00:37:01 -08:00
Kubernetes Prow Robot
fab126d7f3
Merge pull request #113121 from aramase/expiring-cache
kmsv2: implement expire cache with clock
2023-01-25 19:04:25 -08:00
Anish Ramasekar
4804baa011
kmsv2: implement expire cache with clock
Signed-off-by: Anish Ramasekar <anish.ramasekar@gmail.com>
2023-01-25 22:50:32 +00:00
Antonio Ojea
ea99593fa1 Fix panic on ClusterIP allocation for /28 subnets
The ClusterIP allocator tries to reserve on part of the ServiceCIDR
to allocate static IPs to the Services.

The heuristic of the allocator to obtain the offset was taking into
account the whole range size, not the IPs available in the range, the
subnet address and the broadcast address for IPv4 are not available.

This caused that for CIDRs with 16 hosts, /28 for IPv4 and /124 for
IPv6, the offset calculated was higher than the max number of available
addresses on the allocator, causing this to panic.

Change-Id: I6c6f527b0a600b3612be37769e405b8fb3dd33a8
2023-01-25 20:32:40 +00:00
Mahmoud Atwa
72d96f61d0 Decrease target value for scale up tests in HPA 2023-01-25 12:58:38 +00:00
David Porter
b96290c08f e2e node: Update runtime class handler skip logic
There are two runtime class tests which required the container runtime
config to include explicit configuration for `test-handler`. The current
logic skips these tests in non GCE environments. This skip is too strict
since the test is skipped in node e2e environments and in other
environments such as kind, which support running the test and also
configure `test-handler`.

Instead of skipping based on provider, add a new function
`NodeSupportsPreconfiguredRuntimeClassHandler` which examines the
underlying container runtime config and checks if the config includes
`test-handler`. The check is a bit brittle since it assumes container
runtime config paths, but it is a net improvement over skipping the test
entirely on non GCE environments.

This results in the test working in the common test environments, namely
GCE kube-up, node e2e, and kind.

Signed-off-by: David Porter <david@porter.me>
2023-01-24 14:43:24 -08:00
Lucas Severo Alves
096d2e5895 remove unwanted newlines 2023-01-24 21:45:32 +01:00
Kevin Delgado
3b6c4d307f Graduate field validation to GA 2023-01-24 17:48:57 +00:00
Kubernetes Prow Robot
703361f381
Merge pull request #115283 from daman1807/master
e2e/network_policy: using expected==observed as condition for polling probeConnectivity
2023-01-24 09:04:17 -08:00
Lucas Severo Alves
636f8e1a3e chore: changes needed before #111155 2023-01-24 17:55:32 +01:00
Kubernetes Prow Robot
c801053791
Merge pull request #115259 from MikeSpreitzer/fix115200
More carefully compose RequestURI for metrics request
2023-01-24 03:58:27 -08:00
Kubernetes Prow Robot
765f2ef7c7
Merge pull request #114981 from adisky/revert
[Test] Revert "Fix:[Flake] [sig-node] Restart [Serial] [Slow] [Disruptive] K…
2023-01-24 03:58:15 -08:00
Daman
a832d1dbdf e2e/network_policy: using expected==observed as condition for polling in probeConnectivity function 2023-01-24 03:59:01 +05:30
Kevin Delgado
f45505d19a Conformance tests for server side field validation 2023-01-23 18:30:58 +00:00
Adrian Reber
86b62b86d8
Extend checkpoint e2e test to check for results
When the e2e_node/checkpoint_container.go test was introduced no CRI
implementation supported the new CheckpointContainer RPC yet.

With the release of CRI-O 1.25 the CheckpointContainer is implemented
and the test has been extended to see if the content of the checkpoint
is as expected.

The test is skipped if the ContainerCheckpoint feature gate is disabled
or if the CRI implementation does not support the CheckpointContainer
RPC.

Signed-off-by: Adrian Reber <areber@redhat.com>
2023-01-23 18:07:35 +00:00
Mike Spreitzer
1d199db03e Carefully compute request path for metrics
Preserve the previx before "api/v1".
2023-01-23 09:44:21 -05:00
Patrick Ohly
bc6c7fa912 logging: fix names of keys
The stricter checking with the upcoming logcheck v0.4.1 pointed out these names
which don't comply with our recommendations in
https://github.com/kubernetes/community/blob/master/contributors/devel/sig-instrumentation/migration-to-structured-logging.md#name-arguments.
2023-01-23 14:24:29 +01:00
Kubernetes Prow Robot
0fcc3dbd55
Merge pull request #115240 from thockin/codegen-9-use-ls-files
Use `git ls-files` in a few places instead of `find`
2023-01-23 00:26:21 -08:00
Kubernetes Prow Robot
bec431642e
Merge pull request #115254 from dims/do-not-use-global-variable-for-etcd-url
Do not use a global variable for etcdURL
2023-01-22 15:26:15 -08:00
Tim Hockin
7229364f0a
Make generated-stable-metrics use git ls-files 2023-01-22 15:22:55 -08:00
Kubernetes Prow Robot
5a3540f462
Merge pull request #114825 from pohly/e2e-pod-consistently-pending
e2: fix check of "pod is consistently pending"
2023-01-22 12:56:02 -08:00
Davanum Srinivas
1671efe7a8
Do not use a global variable for etcdURL
we are saving this information in an env variable `KUBE_INTEGRATION_ETCD_URL`

So just pick it up from there when needed. Currently when someone uses
framework.RunCustomEtcd directly, the global variable is *not* set and the
code that uses `GetEtcdURL` returns empty string.

Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2023-01-22 14:11:26 -05:00
Kubernetes Prow Robot
d9c371a2c4
Merge pull request #115207 from daman1807/master
e2e/network_policy: using Poll Immediate for intra pod connectivity probes
2023-01-20 21:18:02 -08:00
Kubernetes Prow Robot
92f0818cf2
Merge pull request #114609 from pohly/log-runtime-verbosity-level
runtime log verbosity level changes
2023-01-20 19:34:02 -08:00
Kubernetes Prow Robot
b0ed87078e
Merge pull request #115113 from smarterclayton/exponential_context
wait: ExponentialBackoffWithContext should take context-aware fn
2023-01-20 07:38:15 -08:00
Daman
faee4c33de e2e/network_policy: using PollImmediate for intra pod connectivity probes 2023-01-20 20:05:28 +05:30
Kubernetes Prow Robot
02f893b6e2
Merge pull request #115125 from adisky/update-cni-version
Update CNI version to 1.2.0
2023-01-20 03:34:15 -08:00
Kubernetes Prow Robot
5fe3563ad7
Merge pull request #114915 from brianwang12/master
test images: Update CudaVectorAdd test image to support arm64
2023-01-19 20:30:14 -08:00
Kubernetes Prow Robot
56a14025b0
Merge pull request #115193 from SataQiu/update-storage-api-20230119
apiserver: update serialization version priority for policy API
2023-01-19 13:44:15 -08:00
Kubernetes Prow Robot
285e7969b2
Merge pull request #114544 from ritazh/kmsv2-keyid-staleness
[KMSv2] Use status key ID to determine staleness of encrypted data
2023-01-19 10:28:16 -08:00
Rita Zhang
510ac9b391
kmsv2: use status key ID to update staleness of encrypted data
Signed-off-by: Rita Zhang <rita.z.zhang@gmail.com>
2023-01-19 08:09:24 -08:00
Swati Sehgal
340db7109d node: e2e: topologymgr: add tests for topology manager metrics
Add node e2e tests to verify population of topology metrics.

Signed-off-by: Swati Sehgal <swsehgal@redhat.com>
2023-01-19 14:40:37 +00:00
Swati Sehgal
51c6a1fbe7 node: e2e: cpumgr: Rename: s/getCPUManagerMetrics/getKubeletMetrics
Since we need to gather kubelet metrics for CPU Manager and Topology
Manager, renaming this function to a more generic name.

Signed-off-by: Swati Sehgal <swsehgal@redhat.com>
2023-01-19 14:18:05 +00:00
SataQiu
571582b5b2 apiserver: update serialization version priority for policy API 2023-01-19 14:42:26 +08:00
briwan01
2aed699d8c test images: Update CudaVectorAdd test image to support arm64
Signed-off-by: briwan01 <Brian.Wang@arm.com>
2023-01-19 10:18:17 +08:00
Kubernetes Prow Robot
dfbe1c0120
Merge pull request #113789 from jsafrane/add-selinux-tests
Add multi-pod tests with SELinux mounts
2023-01-18 14:48:46 -08:00
Mike Danese
6bdb8ed566 switch spdy round trip tests to simple http proxy
github.com/elazarl/goproxy does not properly handle upgrades over HTTP
proxy. The problem is this misinterpretation:

6691876326/vendor/github.com/elazarl/goproxy/proxy.go (L89-L95)

These should be stripped but recalculated then added back:

https://cs.opensource.google/go/go/+/refs/tags/go1.19.3:src/net/http/httputil/reverseproxy.go;l=292-297;drc=f6d844510d5f1e3b3098eba255d9b633d45eac3b

Let's just stop using goproxy, and use the stdlib instead. The
functionality we need is straightforward to implement and goproxy is
overkill.
2023-01-18 18:31:50 +00:00
Viacheslav Panasovets
6adf60fdf4
Do not create endpoints if service of type ExternalName (#114814) 2023-01-18 03:12:34 -08:00
Aditi Sharma
d83c37c311 Update CNI version to 1.2.0
Signed-off-by: Aditi Sharma <adi.sky17@gmail.com>
2023-01-18 13:24:40 +05:30
Kubernetes Prow Robot
46f3821bf4
Merge pull request #114586 from andrewsykim/apiserver-lease-rename
Rename apiserver identity lease labels to apiserver.kubernetes.io/identity
2023-01-17 21:36:34 -08:00
Kubernetes Prow Robot
84200d0470
Merge pull request #115135 from Jefftree/rename-enum-integration
Rename enum openapi test
2023-01-17 16:06:47 -08:00
Kubernetes Prow Robot
c913e6ce62
Merge pull request #114542 from pacoxu/EphemeralContainers
cleanup: EphemeralContainers feature gate related codes
2023-01-17 11:18:34 -08:00
Kubernetes Prow Robot
f7b02260f6
Merge pull request #114922 from ibihim/kmsv2-interface-move
[KMSv2] apiserver/kmsv2: mv Service interface into kmsv2
2023-01-17 10:10:33 -08:00
Jefftree
a26174155d Rename enum integration test 2023-01-17 17:22:24 +00:00
Maciej Szulik
3d3da44e96
Wait for logs pod to complete before counting lines 2023-01-17 13:39:35 +01:00
Jan Safranek
b9c2449569 Rework createSELinuxMountPreHook to switch() 2023-01-17 11:23:19 +01:00
Jan Safranek
d2bb866d3f Remove useless Sprintf 2023-01-17 11:22:39 +01:00
Jan Safranek
de4ce7b58c Remove defer
Replace it with ginkgo.DeferCleanup
2023-01-17 11:22:12 +01:00
Patrick Ohly
a41424d4c8 k8s.io/component-base/logs: allow overriding os.Stdout and os.Stderr
This is useful for tests which need to discard or capture the output.
2023-01-17 10:25:57 +01:00
Patrick Ohly
9b86f457e9 k8s.io/component-base/logs: support changing verbosity of JSON output
The GlogSetter method is used by three components to change verbosity at
runtime through HTTP APIs. This used to work only for text output with klog
calls, but not for text output through the klog logger or for JSON output.

Now loggers can also provide a callback for changing their verbosity at
runtime. Implementing that implies that the Create factory method has to be
extended, which is an API break for the Go package, but not an API break for
the configuration file and command line flags, which is what matters for the
"api/v1" component API.
2023-01-17 10:25:54 +01:00
Krzysztof Ostrowski
b7701b00ea
apiserver/kmsv2: mv Service interface into kmsv2
Signed-off-by: Krzysztof Ostrowski <kostrows@redhat.com>
2023-01-17 10:05:16 +01:00
Paco Xu
ae574993c2 cleanup(kubectl-e2e): remove invalid comments 2023-01-17 10:13:21 +08:00
Clayton Coleman
34bfdc3635
wait: ExponentialBackoffWithContext should take context-aware fn
The condition methods will eventually all take a context. Since we
have been provided one, alter the accepted condition type and
change the four references in tree.

Collers of ExponentialBackoffWithContext should use a condition
aware function (ConditionWithContextFunc). If the context can be
ignored the helper ConditionFunc.WithContext can be used to convert
an existing function to the new type.
2023-01-16 14:57:57 -05:00
Kubernetes Prow Robot
62d7937b2e
Merge pull request #115046 from pacoxu/default-container-e2e
add e2e test for kubectl default container annotation
2023-01-16 08:42:50 -08:00
Paco Xu
b45f0a8def move kubectl log e2e to new file & add e2e test for kubectl default container annotation
Signed-off-by: Paco Xu <paco.xu@daocloud.io>
2023-01-16 21:29:43 +08:00
Patrick Ohly
6af5bf0585 e2e: enhance tests that check for pod staying pending
Using WaitTimeoutForPodRunningInNamespace followed by ExpectError was not very
precise (any error passed the check, not just the expected timeout) and
hard to read. Now the test's expectation is spelled out explicitly: the pod
must stay in pending.
2023-01-16 09:12:30 +01:00
Patrick Ohly
6b5f77b163 e2e framework/pod: add gomega matchers
They can be used for polling with a get function and gomega.Eventually or
gomega.Consistently.
2023-01-16 09:05:37 +01:00
Patrick Ohly
17eba2b2f7 e2e framework/pod: add Get helper
This helper will be used by several different tests and makes those tests more
readable.
2023-01-16 09:05:37 +01:00
Patrick Ohly
63ab23200b e2e framework: support polling with Get
These helper functions can be used in combination with
omega.Eventually/Consistently to implement polling of objects that is aware of
Kubernetes apiserver conventions:

- retry on certain errors instead of giving up,
  with "not found" handling decided by the caller (may or may not
  be fatal, depending on the test)
- sleep if requested by apiserver
2023-01-16 09:05:37 +01:00
Patrick Ohly
22341590bd e2e framework: add NamespacedName
The E2E framework contains several functions which only differ in how they get
name and namespace: from an API object (WaitForPodRunningInNamespace) or as
separate parameters (WaitTimeoutForPodRunningInNamespace).

NamespacedName and the NamedObject interface enable writing helper functions
that can be called with both an API object (like *v1.Pod, which implements
Object and thus NamedObject) and name+namespace string (via
NamespacedName).

The other advantage of NamespacedName is that the order of name and namespace
parameter cannot be mixed up.

NamespacedName was derived from k8s.io/apimachinery/pkg/types.NamespacedName. A
separate type in the framework package was chosen a) to avoid additional
imports in test code and b) because the interface might not be suitable for
k8s.io/apimachinery.
2023-01-16 09:05:37 +01:00
Patrick Ohly
1ec4c7a41c e2e framework: add test case for early abort of pod polling
The early exit support was added in 004c1b6441
but without a corresponding test case.
2023-01-16 09:05:36 +01:00
Paco Xu
70e56fa71a cleanup: EphemeralContainers feature gate related codes 2023-01-15 21:15:01 +08:00
Andrew Sy Kim
a7de3e15a5 apiserver: use the identity value in the apiserver identity hash
Signed-off-by: Andrew Sy Kim <andrewsy@google.com>
2023-01-13 16:20:14 -05:00
Andrew Sy Kim
fb066a883d apiserver: update lease identity prefix from kube-apiserver- to apiserver-
Signed-off-by: Andrew Sy Kim <andrewsy@google.com>
2023-01-13 15:37:22 -05:00