Commit Graph

4425 Commits

Author SHA1 Message Date
Khachatur Ashotyan
be82893604 client-go: change permissions of directories and certs
Kubernetes-commit: c941877438c2219318b0625f5b4e321efe324171
2023-02-17 11:16:46 +04:00
Kubernetes Publisher
d0008d188f Merge pull request #115620 from odinuge/ou-relist-missing-delete
client-go/cache: fix missing delete event on replace

Kubernetes-commit: 814faade7fa3916478df963cfc6e34042e79ce89
2023-02-17 01:05:14 +00:00
Kubernetes Publisher
df55688a24 Merge pull request #115604 from pacoxu/fix-design-proposals-links
old design proposals are now moved to Design Proposals Archive repo

Kubernetes-commit: ffe410bbb4e43ba7b7ceaec379709575e817d866
2023-02-16 21:05:13 +00:00
Paco Xu
4bd9226d28 API docs: point to current docs instead of archived designs
Kubernetes-commit: 3d536bd14bba0586f20d1d96560073e5d9e82f97
2023-02-16 15:29:56 +08:00
Sean Sullivan
1369f160e9 New openapi v3 testing file client
Kubernetes-commit: 195a55c84c1a0ba9dcc278cc1cccee320334d5e1
2023-02-15 11:37:08 -08:00
Kubernetes Publisher
60f5c9b463 Merge pull request #115786 from liggitt/net-0.7.0-master
Update golang.org/x/net to v0.7.0

Kubernetes-commit: b3d8ac8496a23d65a907f9333d906bcd5463764e
2023-02-15 10:47:27 +00:00
Kubernetes Publisher
249eb86644 Merge pull request #115785 from liggitt/fix-kubectl-test
Revert "Refactor fake versions of openapi client into testing subdir"

Kubernetes-commit: 98406e2a3e88bd6a2affe5674b7a577aa0926d48
2023-02-14 21:26:39 -08:00
Jordan Liggitt
e850f4518c Update golang.org/x/net to v0.7.0
Kubernetes-commit: f8e00778ddca11c08117ccf1d1c410641c70c428
2023-02-14 23:14:30 -05:00
Jordan Liggitt
fb55d97d70 Revert "Refactor fake versions of openapi client into testing subdir"
This reverts commit 869da89eab37ce670759cea2c86325f36625e7fc.

Kubernetes-commit: f98944590058f936c7adb76ea2c974899a460fe2
2023-02-14 22:14:37 -05:00
Kubernetes Publisher
278918a593 Merge pull request #115465 from seans3/openapi-client-testing
Refactor fake versions of openapi client into testing subdir

Kubernetes-commit: 08bbecb8e315fc976e35575e4e33c8a4a0e1cd28
2023-02-15 06:24:06 +00:00
Kubernetes Publisher
8ef4d7d4e8 Merge pull request #115685 from skitt/rest-req-error
client-go: add an Error() function on Request

Kubernetes-commit: 30f15671456283f37c3ed09412299b27cb92bcb4
2023-02-13 14:53:41 -08:00
Odin Ugedal
b2a4f028d6 client-go/cache: update Replace comment to be more clear
Since the behavior is now changed, and the old behavior leaked objects,
this adds a new comment about how Replace works.

Signed-off-by: Odin Ugedal <ougedal@palantir.com>
Signed-off-by: Odin Ugedal <odin@uged.al>

Kubernetes-commit: 27f4bcae5c52a3bb88141f940ec23d907a15cde5
2023-02-13 11:23:50 +00:00
Odin Ugedal
a01b5a2a96 client-go/cache: rewrite Replace to check queue first
This is useful to both reduce the code complexity, and to ensure clients
get the "newest" version of an object known when its deleted. This is
all best-effort, but for clients it makes more sense giving them the
newest object they observed rather than an old one.

This is especially useful when an object is recreated. eg.

Object A with key K is in the KnownObjects store;
- DELETE delta for A is queued with key K
- CREATE delta for B is queued with key K
- Replace without any object with key K in it.

In this situation its better to create a DELETE delta with
DeletedFinalStateUnknown with B (with this patch), than it is to give
the client an DeletedFinalStateUnknown with A (without this patch).

Signed-off-by: Odin Ugedal <ougedal@palantir.com>
Signed-off-by: Odin Ugedal <odin@uged.al>

Kubernetes-commit: 7bcc3e00fc28b2548886d04639a2e352ab37fb55
2023-02-13 11:12:37 +00:00
Odin Ugedal
b250bf51ae client-go/cache: merge ReplaceMakesDeletionsForObjectsInQueue tests
Signed-off-by: Odin Ugedal <ougedal@palantir.com>
Signed-off-by: Odin Ugedal <odin@uged.al>

Kubernetes-commit: cd3e98b65c1339a8adc157175630de099a057d3f
2023-02-10 14:30:10 +00:00
Odin Ugedal
8279635aa4 client-go/cache: fix missing delete event on replace without knownObjects
This fixes an issue where a relist could result in a DELETED delta
with an object wrapped in a DeletedFinalStateUnknown object; and then on
the next relist, it would wrap that object inside another
DeletedFinalStateUnknown, leaving the user with a "double" layer
of DeletedFinalStateUnknown's.

Signed-off-by: Odin Ugedal <ougedal@palantir.com>
Signed-off-by: Odin Ugedal <odin@uged.al>

Kubernetes-commit: 0bf0546d9f75d92c801e81c9f7adf040bba64102
2023-02-10 14:16:26 +00:00
Stephen Kitt
22e2a9b6b1 client-go: add an Error() function on Request
Requests can accumulate errors with no obvious indication, e.g. if
their primary purpose is to construct a URL: URL() itself doesn't
return an error if r.err is non-nil.

Instead of changing URL() to return an error, which has quite a large
impact, add an Error() function and indicate on URL() that it should
be checked.

Signed-off-by: Stephen Kitt <skitt@redhat.com>

Kubernetes-commit: f69c1c47463ff70ad61adf6f38c4d5b7373e9d0a
2023-02-10 14:44:07 +01:00
Kubernetes Publisher
d46293369e Merge pull request #115665 from aramase/aramase/f/update_vendor_k8s_utils
Update k8s.io/utils to `a36077c30491`

Kubernetes-commit: 9a51625ebebcc8345c851afc2b5cc98eb19ac193
2023-02-10 01:08:12 +00:00
Anish Ramasekar
86a4c64374 Update k8s.io/utils to a36077c30491
Signed-off-by: Anish Ramasekar <anish.ramasekar@gmail.com>

Kubernetes-commit: 09e02052fdf3d248368b3d05d5c922d616528c4c
2023-02-09 20:09:41 +00:00
Odin Ugedal
2ded6b6eb8 client-go/cache: fix missing delete event on replace
This fixes a race condition when a "short lived" object
is created and the create event is still present on the queue
when a relist replaces the state. Previously that would lead in the
object being leaked.

The way this could happen is roughly;

1. new Object is added O, agent gets CREATED event for it
2. watch is terminated, and the agent runs a new list, L
3. CREATE event for O is still on the queue to be processed.
4. informer replaces the old data in store with L, and O is not in L
  - Since O is not in the store, and not in the list L, no DELETED event
    is queued
5. CREATE event for O is still on the queue to be processed.
6. CREATE event for O is processed
7. O is <leaked>; its present in the cache but not in k8s.

With this patch, on step 4. above it would create a DELETED event
ensuring that the object will be removed.

Signed-off-by: Odin Ugedal <ougedal@palantir.com>
Signed-off-by: Odin Ugedal <odin@uged.al>

Kubernetes-commit: 25d77218acdac2f793071add9ea878b08c7d328b
2023-02-08 14:57:23 +00:00
Kubernetes Publisher
efd0415f67 Merge pull request #115514 from pohly/event-broadcaster-shutdown
client-go: don't wait too long after EventBroadcaster.Shutdown

Kubernetes-commit: b0171f77f68427813efbb478c0ba89f48322d34a
2023-02-08 13:07:28 +00:00
Paco Xu
878a4f8bbe archived design proposals are now moved to Design Proposals Archive Repo.
Kubernetes-commit: 019d2615af3f7fd0ed0d593ef9df348f6d85b204
2023-02-08 11:12:22 +08:00
Kubernetes Publisher
00b9d76f44 Merge pull request #115315 from enj/enj/i/kas_kubelet_conn_close
kubelet/client: collapse transport wiring onto standard approach

Kubernetes-commit: 22b88dea360b0aae4ecaa57142718386b3cbd40d
2023-02-07 17:07:30 +00:00
Kubernetes Publisher
9c5046523c Merge pull request #115379 from artemvmin/serial-mkfs
Add an option to limit the number of concurrent mkfs calls

Kubernetes-commit: 6eb008620cd0ee3501326ee003d47fbaf1fa5b52
2023-02-07 05:07:29 +00:00
Kubernetes Publisher
2e3265cc1d Merge pull request #108396 from tkashem/retry-metric
client-go: add a metric to count request retries

Kubernetes-commit: 2ab3151936f1df6b3ffb4d49bf9dc90218264545
2023-02-07 05:07:26 +00:00
Iceber Gu
899a109017 leaderelection: using le.clock for the time calculations
Signed-off-by: Iceber Gu <wei.cai-nat@daocloud.io>

Kubernetes-commit: 9c31f14a7cfea7cc793a9a3f98bdd117cb438316
2023-02-07 13:00:55 +08:00
Monis Khan
d8b14dc089 kubelet/client: collapse transport wiring onto standard approach
Signed-off-by: Monis Khan <mok@microsoft.com>

Kubernetes-commit: 754cb3d601a820180d19567c3600a789d77b0f07
2023-02-05 20:51:54 -05:00
vinay kulkarni
85d57cfad9 Generated files and compat data from API changes
Kubernetes-commit: 3c70be1a1231e11c45698e209b01e91b92f8c5d2
2023-02-05 04:44:45 +00:00
Artem Minyaylov
13c89f7a54 Update k8s.io/utils to latest version
Update all usages of FakeExec to pointer to avoid copying the mutex

Kubernetes-commit: f573e149423dc578284789fdff8eeb3c195b5ccf
2023-02-03 14:51:25 -08:00
Patrick Ohly
f6a5a1f139 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.

Kubernetes-commit: 15b01af9c18a0840d71e2bb7dff4d8c29b158aad
2023-02-03 14:52:20 +01:00
Khachatur Ashotyan
71253f0b35 fix: comment about permission bits
Kubernetes-commit: fd17dcf3876458229ac15d426eb1bd58f8c52cb4
2023-02-03 13:40:33 +04:00
Khachatur Ashotyan
03568a1821 client-go: make generating certificate/key permissions more secure (600)
Kubernetes-commit: 5f81c3005f6d3aeb652a0626c3632ff68b036577
2023-02-02 14:52:45 +04:00
Sean Sullivan
bb1833cfed Refactor fake versions of openapi client into testing subdir
Kubernetes-commit: 869da89eab37ce670759cea2c86325f36625e7fc
2023-02-01 18:39:18 -08:00
Sean Sullivan
6eb57690dc OpenAPI V3 Root interface and basic implementation
Kubernetes-commit: 5b482476b1bb458b8206c122be045ced759550f2
2023-01-29 23:28:35 -08:00
Patrick Ohly
6a9f0eb8ac dependencies: update klog v2.90.1
This improves performance of the text formatting and ktesting.

Because ktesting no longer buffers messages by default, one unit
test needs to ask for that explicitly.

Kubernetes-commit: 961819a4d09488e20931103e0c36d2bed588fdcb
2023-01-23 18:19:54 +01:00
Iceber Gu
b4217e149b client-go: fix the wait time for trying to acquire the leader lease
Signed-off-by: Iceber Gu <wei.cai-nat@daocloud.io>

Kubernetes-commit: 9d80516abb4244ac1df4ceb84a32d3204fe5b308
2023-01-10 13:09:07 +08:00
Antoine Pelisse
e2867f9cdc Update kubernetes code for minor API changes to kube-openapi
Kubernetes-commit: 88ec8fba32f0ef7b768ec528cfbe44046877ea34
2022-12-29 12:12:33 -08:00
Antoine Pelisse
3d77c7c648 Update kube-openapi to 15aac26d736a
Kubernetes-commit: 9bbdb9f130516a14a73914d0b41396ddb72a88ea
2023-03-07 16:14:54 -08:00
Jefftree
eec00dc791 remove mime AddExtensionType in discovery test
Kubernetes-commit: 50c6b6c86a50d0196af4bc659948d8dfd2147308
2022-12-05 17:30:08 +00:00
austin ce
9668243c04 Integrate new metrics provider option in test case
Kubernetes-commit: 9e83e7e975dd5971e60e9768e06520aa5ebf9bf8
2022-12-02 14:08:11 -05:00
austin ce
e0785d6713 Remove options from queue ctors w/o metrics
Kubernetes-commit: 31f16db1959bb1db02fcc578f4aa7d47414a26f4
2022-12-02 14:06:37 -05:00
austin ce
89a4c1271f Add license header to new file
Kubernetes-commit: 95ad089ff8164d455f766694b1292ca8f1d200df
2022-12-01 18:28:02 -05:00
austin ce
98d0d1a9ba Allow setting per-queue metrics providers
Kubernetes-commit: da71811514ac6e8fedd265831fed71f897b97781
2022-11-29 20:47:33 -05:00
Timo Reimann
0536a4e40c Add tests
Kubernetes-commit: fc8b4657c18a6e58b2587060ad3c862d3d2ae262
2022-10-22 00:47:04 +02:00
Damien Grisonnet
9c7c60b695 events: fix EventSeries starting count discrepancy
The kube-apiserver validation expects the Count of an EventSeries to be
at least 2, otherwise it rejects the Event. There was is discrepancy
between the client and the server since the client was iniatizing an
EventSeries to a count of 1.

According to the original KEP, the first event emitted should have an
EventSeries set to nil and the second isomorphic event should have an
EventSeries with a count of 2. Thus, we should matcht the behavior
define by the KEP and update the client.

Also, as an effort to make the old clients compatible with the servers,
we should allow Events with an EventSeries count of 1 to prevent any
unexpected rejections.

Signed-off-by: Damien Grisonnet <dgrisonn@redhat.com>

Kubernetes-commit: d00364902bda05eed4f7f02051ab81f7be55f8a9
2022-09-08 23:50:41 +02:00
Claudiu Belu
79c893df5a 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.

Kubernetes-commit: 856bb5c8f266f5276f1a576f47be622d7cb384e7
2022-06-15 15:17:24 +03:00
Patrick Ohly
9445f86b9d Generate go.work files
This creates go.work and enables Go Workspaces.  This is a file that
includes info on k/k and all the staging modules.

This depends on go 1.22 and setting FORCE_HOST_GO=true (for kube
scripts, which try to be hermetic).

Make this part of the normal update/verify sequence.

The top-level go.work file contains no replace statements. Instead, the
replace statements in the individual go.mod files are used. For this to
work, replace statements in the individual go.mod files have to be
consistent.

hack/tools has different dependencies and can't be in the main
workspace, so this adds a go.work just for that.  Without this, go tries
to consider all deps in all modules and pick one that works for all.
This is problematic because there are so many of them that it is
difficult to manage.

Likewise for k8s.io/code-generator/examples and
k8s.io/kms/internal/plugins/_mock - add trivial go.work files.

For example k/k depends on an older version of a lib that gloangci-lint
needs (transitively) and it breaks.

This also updates vendor (needed to make go happy), and removes
vendor'ed symlinks.  This breaks a LOT of our build tools, which will be
fixed subsequently.

Result: `go` commands work across modules:

Before:
```
$ go list ./pkg/proxy/iptables/ ./staging/src/k8s.io/api/core/v1/
main module (k8s.io/kubernetes) does not contain package k8s.io/kubernetes/staging/src/k8s.io/api/core/v1

$ go build ./pkg/proxy/iptables/ ./staging/src/k8s.io/api
main module (k8s.io/kubernetes) does not contain package k8s.io/kubernetes/staging/src/k8s.io/api

$ go test ./pkg/proxy/iptables/ ./staging/src/k8s.io/api
main module (k8s.io/kubernetes) does not contain package k8s.io/kubernetes/staging/src/k8s.io/api
```

After:
```
$ go list ./pkg/proxy/iptables/ ./staging/src/k8s.io/api/core/v1/
k8s.io/kubernetes/pkg/proxy/iptables
k8s.io/api/core/v1

$ go build ./pkg/proxy/iptables/ ./staging/src/k8s.io/api

$ go test ./pkg/proxy/iptables/ ./staging/src/k8s.io/api
ok  	k8s.io/kubernetes/pkg/proxy/iptables	0.360s
ok  	k8s.io/api	2.302s
```

Result: `make` fails:

```
$ make
go version go1.22rc1 linux/amd64
+++ [0106 12:11:03] Building go targets for linux/amd64
    k8s.io/kubernetes/cmd/kube-proxy (static)
    k8s.io/kubernetes/cmd/kube-apiserver (static)
    k8s.io/kubernetes/cmd/kube-controller-manager (static)
    k8s.io/kubernetes/cmd/kubelet (non-static)
    k8s.io/kubernetes/cmd/kubeadm (static)
    k8s.io/kubernetes/cmd/kube-scheduler (static)
    k8s.io/component-base/logs/kube-log-runner (static)
    k8s.io/kube-aggregator (static)
    k8s.io/apiextensions-apiserver (static)
    k8s.io/kubernetes/cluster/gce/gci/mounter (static)
    k8s.io/kubernetes/cmd/kubectl (static)
    k8s.io/kubernetes/cmd/kubectl-convert (static)
    github.com/onsi/ginkgo/v2/ginkgo (non-static)
    k8s.io/kubernetes/test/e2e/e2e.test (test)
    k8s.io/kubernetes/test/conformance/image/go-runner (non-static)
    k8s.io/kubernetes/cmd/kubemark (static)
    github.com/onsi/ginkgo/v2/ginkgo (non-static)
    k8s.io/kubernetes/test/e2e_node/e2e_node.test (test)
test/e2e/e2e.go:35:2: cannot find package "k8s.io/api/apps/v1" in any of:
	/home/thockin/src/kubernetes/_output/local/go/src/k8s.io/kubernetes/vendor/k8s.io/api/apps/v1 (vendor tree)
	/home/thockin/src/kubernetes/_output/local/.gimme/versions/go1.22rc1.linux.amd64/src/k8s.io/api/apps/v1 (from $GOROOT)
	/home/thockin/src/kubernetes/_output/local/go/src/k8s.io/api/apps/v1 (from $GOPATH)
	... more ...
	... more ...
	... more ...
!!! [0106 12:13:41] Call tree:
!!! [0106 12:13:41]  1: /home/thockin/src/kubernetes/hack/lib/golang.sh:948 kube::golang::build_binaries_for_platform(...)
!!! [0106 12:13:41]  2: hack/make-rules/build.sh:27 kube::golang::build_binaries(...)
!!! [0106 12:13:41] Call tree:
!!! [0106 12:13:41]  1: hack/make-rules/build.sh:27 kube::golang::build_binaries(...)
!!! [0106 12:13:41] Call tree:
!!! [0106 12:13:41]  1: hack/make-rules/build.sh:27 kube::golang::build_binaries(...)
make: *** [Makefile:96: all] Error 1
```

Again, this requires go 1.22 (e.g. gotip), as go 1.21.x does not have
`go work vendor` support.

TO REPEAT:
    ( \
      ./hack/update-go-workspace.sh; \
      ./hack/update-vendor.sh; \
      ./hack/update-go-workspace.sh; \
    )

Kubernetes-commit: 65b841c077e0d3282d28b9199aec72d23d045104
2022-06-08 12:12:42 +02:00
Abu Kashem
d2388d199c client-go: add metric to count retries
Kubernetes-commit: b6c369f5c90bbef8058b3d44949f4e815dd6607f
2022-02-28 12:22:09 -05:00
Kubernetes Publisher
f457a57d6d Merge pull request #112072 from tkashem/retry-concurrency-test
client-go: add unit test for Request thread safety

Kubernetes-commit: 87759c73eb7d7804c8b5116becbce3f1066678bd
2023-01-31 01:46:49 -08:00
Abu Kashem
67f1485c1d client-go: add unit test for Request thread safety
Kubernetes-commit: ca492a9b62a586caf3e3cd22bc020108a63fb395
2022-08-26 13:24:36 -04:00
Kubernetes Publisher
b1350830d0 Merge pull request #115266 from pohly/gomega-update
dependencies: update gomega to v1.26.0

Kubernetes-commit: 6d17cb2051b3a9958ed3353df242312d85e75d43
2023-01-30 21:07:00 +00:00