Commit Graph

113713 Commits

Author SHA1 Message Date
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
Kubernetes Prow Robot
ca70940ba8
Merge pull request #115543 from aojea/revert-113298-e2e-wait-for-pods-with-gomega
Revert "e2e: wait for pods with gomega"
2023-02-06 06:11:00 -08:00
Kubernetes Prow Robot
06914bdaf5
Merge pull request #115521 from aojea/cloudprovidergcp
Improve performance on the cloud provider node-controller
2023-02-06 03:53:00 -08:00
Antonio Ojea
7f5ae1c0c1
Revert "e2e: wait for pods with gomega" 2023-02-06 12:08:22 +01:00
Kubernetes Prow Robot
561a35f358
Merge pull request #115038 from mercedes-benz/tobiasgiese/kubeadmfix-etcd-learner-join
kubeadm: fix etcd learner join
2023-02-06 02:09:01 -08:00
SataQiu
5fbd49c102 using BuildOpenAPISpecFromRoutes instead of deprecated BuildOpenAPISpec 2023-02-06 17:47:44 +08:00
Antonio Ojea
80d21e5929 parallelize node-controller
The node-controllers has 2 reconcilation methods:
- workqueue with workers, is using during bootstrap and process
nodes until the cloud provider taint is removed
- periodic loop, that runs every certain period polling the cloud
provider to get the instances metadata to update the node addresses,
since nodes can Update its addresses anytime during its lifecycle.

These follows up on the parallelization of the node-controller, that
previously increased the number of workers that handle the bootstrap.

This parallelize the periodic loop based on the input value of the
number of workers, and also uses the informer lister instead of doing
a new List to the apiserver.

Added an unit test that can used to evaluate the performance improvement
with different workers values:

=== RUN   TestUpdateNodeStatus/single_thread
    node_controller_test.go:2537: 1 workers: processed 100 nodes int 1.055595262s
=== RUN   TestUpdateNodeStatus/5_workers
    node_controller_test.go:2537: 5 workers: processed 100 nodes int 216.990972ms
=== RUN   TestUpdateNodeStatus/10_workers
    node_controller_test.go:2537: 10 workers: processed 100 nodes int 112.422435ms
=== RUN   TestUpdateNodeStatus/30_workers
    node_controller_test.go:2537: 30 workers: processed 100 nodes int 46.243204ms

Change-Id: I38870993431d38fc81a2dc6a713321cfa2e40d85
2023-02-06 09:06:29 +00:00
Madhav Jivrajani
64cf942ce8 hack/tools: Bump golangci-lint version
Bump golangci-lint version. This version
adds support for go1.20.

This consequently also bumps the version of
staticcheck. Note that this was changed to
use master to be compatible with 1.20. This
commit reverts back to using a tagged release.

Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>
2023-02-06 12:27:16 +05:30
Kubernetes Prow Robot
f3562d9dea
Merge pull request #115403 from apelisse/hasschema-pool
apiextensions: Benchmark escaping in SchemaHas and pool Schemas
2023-02-05 22:35:02 -08:00
Kubernetes Prow Robot
c35aa3d73e
Merge pull request #115490 from cici37/apiReviewer
Add cici37 as API reviewer
2023-02-05 21:28:59 -08:00
Peter Schuurman
773b45abc5 Add enablement/disablement unit test for StatefulSetStartOrdinal feature 2023-02-05 20:28:54 -08: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
Artem Minyaylov
f573e14942 Update k8s.io/utils to latest version
Update all usages of FakeExec to pointer to avoid copying the mutex
2023-02-04 11:05:22 -08:00
Antonio Ojea
bdd3e1d8c8 fake cloud provider don't lock emulating delay
Change-Id: Icf0cf5d67a4c1d53556f93bbda5f286faaa456b2
2023-02-04 16:15:44 +00: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
Kubernetes Prow Robot
0e3818e027
Merge pull request #115515 from dgrisonnet/scrape-and-compare
Add wrapper around ScrapeAndCompare
2023-02-03 13:46:29 -08:00
Kubernetes Prow Robot
1ded677b2a
Merge pull request #114894 from dipankardas011/validate-admission-policy-error-handling
Added error handling in ValidateAdmissionPolicy
2023-02-03 12:14:30 -08:00
Damien Grisonnet
c5774a703d component-base: add ScrapeAndCompare wrapper
Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>
2023-02-03 20:35:52 +01:00
Patrick Ohly
15b01af9c1 client-go: don't wait too long after EventBroadcaster.Shutdown
When Shutdown was called, delivery of each pending event would still be retried
12 times with a delay of ~10s between each retry. In apiserver integration
tests that caused the goroutine to linger long after the corresponding
apiserver of the test was shut down.
2023-02-03 20:02:48 +01:00
Kubernetes Prow Robot
c34ddb5054
Merge pull request #115485 from SergeyKanzhelev/epmeneralContainersQoS
small comment the ephemeral containers are not accounted for the QoS …
2023-02-03 08:46:29 -08:00
Abu Kashem
b6c369f5c9
client-go: add metric to count retries 2023-02-03 09:04:10 -05: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
Kubernetes Prow Robot
7a55b76f28
Merge pull request #115503 from princepereira/ppereira-kubeproxy-ipv6-master
[#115501] Fix for issue with missing Loadbalancer policies for IPV6 endpoints in Dualstack mode.
2023-02-02 23:46:27 -08:00
Prince Pereira
5eb6f82c1a [Issue:#115501] Fix for issue with Loadbalancer policy creation for IPV6 endpoints in Dualstack mode. 2023-02-03 11:14:20 +05:30
Kubernetes Prow Robot
49ddc510bc
Merge pull request #115488 from liggitt/lint
Add golang.org/x/lint to unwanted dependencies
2023-02-02 15:18:42 -08:00
Jordan Liggitt
1e4a032a34
Add golang.org/x/lint to unwanted dependencies 2023-02-02 17:12:23 -05:00
Kubernetes Prow Robot
5fd9a7abca
Merge pull request #115484 from soltysh/image_version
Don't explicitly set image version in tests
2023-02-02 12:52:49 -08:00
Kubernetes Prow Robot
d3a62dcb76
Merge pull request #114351 from ruiwen-zhao/event_ignore_nil
[Evented PLEG] Ignore container events with nil PodSandboxStatus
2023-02-02 12:52:42 -08:00
Kubernetes Prow Robot
0ebf9a3a1b
Merge pull request #115434 from ehashman/requests-limits-ratio-docs
Document relationship between requests/limits
2023-02-02 11:02:53 -08:00
Kubernetes Prow Robot
9812eefd43
Merge pull request #115377 from liggitt/go-version
Fetch go version using gimme if needed
2023-02-02 11:02:41 -08:00
Sergey Kanzhelev
b517d640a4 small comment the ephemeral containers are not accounted for the QoS calculation 2023-02-02 18:21:39 +00: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
ae23b0c11b
Merge pull request #115111 from kannon92/strategy-coverage-increase
increasing coverage from 78% to 94% for strategy.go for batch/job
2023-02-02 07:58:41 -08:00
Kubernetes Prow Robot
05121454ba
Merge pull request #115455 from dgrisonnet/verb
Rename "method" label to "verb" in rest_client_requests_total
2023-02-02 06:35:31 -08:00
Damien Grisonnet
c9944709bc restclient: rename "method" label to "verb"
Verb is the commonly used label when referring to HTTP verbs.
rest_client_requests_total is the only metric in the rest package using
`method` instead of `verb` which makes it inconsistent and confusing.

Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>
2023-02-02 14:09:21 +01:00
Cici Huang
f8ed80b58e Add cici37 as API reviewer 2023-02-02 12:11:09 +00:00
Dave Chen
5127cbf949 kubeadm: backup kubelet config file for upgrade apply
Back up kubelet config file for `kubeadm upgrade apply`, some code
refactoring is done to de-dup some redundant code logic.

Signed-off-by: Dave Chen <dave.chen@arm.com>
2023-02-02 12:09:18 +08:00
Dave Chen
9e6e13e562 kubeadm: include the err got from PrintDryRunFile
The error was ingored which means if anything wrong from `PrintDryRunFiles`,
it was sliently ignored.

Signed-off-by: Dave Chen <dave.chen@arm.com>
2023-02-02 12:00:19 +08:00
Dave Chen
c55a98fde9 kubeadm: fix invalid cross-device link error
The root cause for that error is because `rename` doesn't work
across different mount points.

The kubelet config file and back up directory are mounted to
different file system in kinder environment.

```
df /var/lib/kubelet/config.yaml | tail -n1 | awk '{print $1}'
/dev/sda2

df /etc/kubernetes/tmp/kubeadm-kubelet-configxxx | tail -n1 | awk '{print $1}'
overlay
```

Call `cp` instead of `rename` to back up the kubelet file would fix
that issue.

Signed-off-by: Dave Chen <dave.chen@arm.com>
2023-02-02 11:43:18 +08:00
Dave Chen
016cc0c120 kubeadm:[cherry-pick]backup kubelet config for "upgrade node"
This addresses the TODO item so that the old kubelet config file could
be recovered if something goes wrong.

Signed-off-by: Dave Chen <dave.chen@arm.com>
Co-authored-by: Paco Xu <paco.xu@daocloud.io>
2023-02-02 11:43:18 +08:00
Kubernetes Prow Robot
fc7b25cf72
Merge pull request #113104 from pawbana/add-workers-to-cloud-controller-manager
Added workerCount flag to node controller in cloud controller manager
2023-02-01 19:21:28 -08:00
Max Smythe
0ed74145fb
make CEL admission controller code consumable (#115412)
* Make policy decision object public

Signed-off-by: Max Smythe <smythe@google.com>

* Separate version conversion from validation

Signed-off-by: Max Smythe <smythe@google.com>

* Address review comments

Signed-off-by: Max Smythe <smythe@google.com>

* Fix variable name

Signed-off-by: Max Smythe <smythe@google.com>

---------

Signed-off-by: Max Smythe <smythe@google.com>
2023-02-01 17:29:30 -08:00
Kubernetes Prow Robot
d475085776
Merge pull request #114439 from alexzielenski/apiserver/smd/conversion-smaller
add direct construction of TypeConverter from OpenAPI
2023-02-01 14:51:35 -08:00
Jordan Liggitt
fa66ec647d
Invoke gimme from kube::golang::verify_go_version
Defaults to ensuring .go-version is used
Override the go version by setting GO_VERSION=1.x
Force using the host go version with FORCE_HOST_GO=y
2023-02-01 17:03:30 -05:00
Jordan Liggitt
f6bb29c2d2
Add gimme 2023-02-01 16:34:23 -05:00
Jordan Liggitt
7cc6b724ab
Defer builds to test-cmd and test-integration targets 2023-02-01 15:35:14 -05:00