Commit Graph

4425 Commits

Author SHA1 Message Date
Arda Güçlü
21fffc1153 Embed context deadline exceeded in error to let errors.Is can work
Currently, watch package embeds context deadlineexceeded error
in it's own error using `%v`, as can be seen in here;

`fmt.Errorf("UntilWithSync: unable to sync caches: %v", ctx.Err())`

However, consumers of this function can not use
`errors.Is(err, context.DeadlineExceeded)` due this `%v`.

To let consumers can distinguish context deadlineexceeded errors,
this PR changes error embedding format to `%w`.

Kubernetes-commit: 6b7c365f8f6d50280c2dab171efdd4b93d964f32
2022-12-19 15:26:08 +03:00
Kubernetes Publisher
089645a7c5 Merge pull request #114559 from liggitt/gofmt
Fix indentation/spacing in comments to render correctly in godoc

Kubernetes-commit: 76522eb1a339a95544523c1ed85da09f287f1ade
2022-12-19 01:08:52 +00:00
Jordan Liggitt
422fe1f61e Fix indentation/spacing in comments to render correctly in godoc
Kubernetes-commit: 78cb3862f11225135afdf76f3424e2d7b33104c7
2022-12-17 17:31:05 -05:00
Paco Xu
20ca706950 cleanup: EphemeralContainers feature gate related codes
Kubernetes-commit: 70e56fa71af5aa4f3d1448fcbc26e86309cd0cf3
2022-12-16 23:46:47 +08:00
Kubernetes Publisher
97591331ce Merge pull request #113985 from lavalamp/improved-has-synced
Propagate HasSynced properly

Kubernetes-commit: 843b40aeb421347ae00f206ea879bc1e1ae2912d
2022-12-15 21:18:24 +00:00
Max Horstmann
24248303bf client-go: properly return error in fake discovery (#79612)
Fake discovery should return an error if an error-returning reactor was prepended.

This is relevant e.g. for unit tests which test a function which relies
on discovery to check if an API Server is available.

Matches existing behavior of other fake types, for example fake_namespace.

Adds unit test coverage as well.

Kubernetes-commit: b47748103a53c0fe5ba1ddc950662ffc9bd9ed0f
2022-12-14 11:41:10 -05:00
Brian Pursley
d0842249d3 portforward: return error on lost connection to pod
Currently, when the remote connection is unexpected closed, forward() prints an error message saying "lost connection to pod" via runtime.HandleError, but then it returns nil for the error.

This prevents the caller from being able to handle this error differently.

This commit changes forward() to return the "lost connection to pod" error so that it can be handled by the caller.

Making this change enables kubectl port-forward to exit with code 1, instead of 0, which is the expected behavior for a command that has failed.

Kubernetes-commit: a9f04103854893056237a09250ad3335867b0391
2022-12-13 13:32:42 -05:00
Damien Grisonnet
e3ded99476 tools/events: retry on AlreadyExist for Series
When attempting to record a new Event and a new Serie on the apiserver
at the same time, the patch of the Serie might happen before the Event
is actually created. In that case, we handle the error and try to create
the Event. But the Event might be created during that period of time and
it is treated as an error today. So in order to handle that scenario, we
need to retry when a Create call for a Serie results in an AlreadyExist
error.

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

Kubernetes-commit: 2f83117bcfe30ad3ada7f1ca66f4b885a1d5df25
2022-12-01 15:40:01 +01:00
Damien Grisonnet
4b578e1242 tools/events: fix data race when emitting series
There was a data race in the recordToSink function that caused changes
to the events cache to be overriden if events were emitted
simultaneously via Eventf calls.

The race lies in the fact that when recording an Event, there might be
multiple calls updating the cache simultaneously. The lock period is
optimized so that after updating the cache with the new Event, the lock
is unlocked until the Event is recorded on the apiserver side and then
the cache is locked again to be updated with the new value returned by
the apiserver.

The are a few problem with the approach:

1. If two identical Events are emitted successively the changes of the
   second Event will override the first one. In code the following
   happen:
   1. Eventf(ev1)
   2. Eventf(ev2)
   3. Lock cache
   4. Set cache[getKey(ev1)] = &ev1
   5. Unlock cache
   6. Lock cache
   7. Update cache[getKey(ev2)] = &ev1 + Series{Count: 1}
   8. Unlock cache
   9. Start attempting to record the first event &ev1 on the apiserver side.

   This can be mitigated by recording a copy of the Event stored in
   cache instead of reusing the pointer from the cache.

2. When the Event has been recorded on the apiserver the cache is
   updated again with the value of the Event returned by the server.
   This update will override any changes made to the cache entry when
   attempting to record the new Event since the cache was unlocked at
   that time. This might lead to some inconsistencies when dealing with
   EventSeries since the count may be overriden or the client might even
   try to record the first isomorphic Event multiple time.

   This could be mitigated with a lock that has a larger scope, but we
   shouldn't want to reflect Event returned by the apiserver in the
   cache in the first place since mutation could mess with the
   aggregation by either allowing users to manipulate values to update
   a different cache entry or even having two cache entries for the same
   Events.

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

Kubernetes-commit: 55ec09d377274b4a6107fe0b7a061ad408fe05a7
2022-12-01 15:39:34 +01:00
Daniel Smith
5d70a118df Enable propagration of HasSynced
* Add tracker types and tests
* Modify ResourceEventHandler interface's OnAdd member
* Add additional ResourceEventHandlerDetailedFuncs struct
* Fix SharedInformer to let users track HasSynced for their handlers
* Fix in-tree controllers which weren't computing HasSynced correctly
* Deprecate the cache.Pop function

Kubernetes-commit: 8100efc7b3122ad119ee8fa4bbbedef3b90f2e0d
2022-11-18 00:12:50 +00:00
Kubernetes Publisher
e7e7d01afd Merge pull request #110991 from thockin/svc-typenames-starTrafficPolicyType
Svc typenames star traffic policy type

Kubernetes-commit: 923ee203f362aa947a7b0c9b1357488e0a244ea7
2022-12-13 04:24:09 +00:00
Steve Kuznetsov
9bcbb56a27 code-generator: refer to the API package for GV{R,K}
There should only be one source of truth for the API group's name and
version.

Signed-off-by: Steve Kuznetsov <skuznets@redhat.com>

Kubernetes-commit: e13198ec6f52c4a6405388e90053954dc7656a31
2022-11-06 07:05:42 -07:00
Paco Xu
be1f5d4ebb client-go: remove extensions psp only
Kubernetes-commit: e41b1bff5853c616f7872ccf36fbefa480f72892
2022-11-03 10:12:16 +08:00
wongearl
5d95f80033 diff.ObjectReflectDiff is DEPRECATED use cmp.Diff
Kubernetes-commit: 6da08775f9fc8d70f867435f55cf712d3a6ef056
2022-11-02 17:40:19 +08:00
Patrick Ohly
beb71aae41 dependencies: update to ginkgo v2.6.1, gomega v1.24.2
Ginkgo v2.5.0 adds support for a "timeline": a full description of what happened
while a specific test ran, including failures, timeouts, and log output.

Ginkgo v2.6.0 adds ReportBeforeSuite which we need for
https://github.com/kubernetes/kubernetes/issues/114313.

Kubernetes-commit: f3ef4004317c1a12d84021be29dd5f92badc8eff
2022-11-02 09:07:12 +01:00
Damien Grisonnet
1113415196 event_broadcaster: update isomorphic event def
Update the definition of an isomorphic event in the events/v1 client to
match the aggregation logic that was already present in the core/v1
implementation.

The note field was omitted even though the message was used in the core
API aggregation because we didn't reach consensus.

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

Kubernetes-commit: 21f2f746abc1a5a1b3193274401f5728e19cc26f
2022-09-09 19:16:40 +02:00
Paco Xu
6a07cedcd3 kubelet: add key encipherment usage only if it is rsa key
remove allowOmittingUsageKeyEncipherment as it is always true

Signed-off-by: Paco Xu <paco.xu@daocloud.io>

Kubernetes-commit: 160f015ef4affe903f98e74cf42b40fceef15cb9
2022-08-03 16:41:09 +08:00
Tim Hockin
31e7d402a3 ServiceInternalTrafficPolicyType: s/Type//
Rename ServiceInternalTrafficPolicyType => ServiceInternalTrafficPolicy

Kubernetes-commit: dd0a50336e283775e05e54b0b174b7c7a9367d99
2021-11-09 23:30:23 -08:00
Tim Hockin
f5f28c4de4 ServiceExternalTrafficPolicyType: s/Type//
Rename ServiceExternalTrafficPolicyType => ServiceExternalTrafficPolicy

Kubernetes-commit: d0e2b068500b260851f48c636185e1dcbb438d2e
2021-11-09 23:25:43 -08:00
Kubernetes Publisher
5a489e8d10 Merge pull request #114404 from hoskeri/discovery-error-check
Check the correct error in d.downloadAPIs

Kubernetes-commit: 47d58265ae6661fa5e21575f688ce761a11c090e
2022-12-11 00:05:15 -08:00
Abhijit Hoskeri
4dbb1cd1d5 Check the correct error in d.downloadAPIs
The error result of `d.downloadAPIs()` is set in `aerr`,
not `err`.

This prevents a nil-ptr dereference of apiGroups in the next step.

Signed-off-by: Abhijit Hoskeri <abhijithoskeri@gmail.com>

Kubernetes-commit: 450ba4f50638ad9ee4d287a762a8530c64e89ebd
2022-12-10 16:32:02 -08:00
Kubernetes Publisher
58ff029093 Merge pull request #113933 from liggitt/retry-race
Fix client-go request retry race

Kubernetes-commit: 8d2fbfc5a9635bc3247d7f739f8a057962049aca
2022-12-10 23:34:13 +00:00
Kubernetes Publisher
ca60156554 Merge pull request #111898 from ncdc/reflector-unstructured-fixes
Reflector: support logging Unstructured type

Kubernetes-commit: 054274d77c3fc12eeb56fd03d6e371d4aa61f0c1
2022-12-10 03:34:09 +00:00
Kubernetes Publisher
d21defd4b1 Merge pull request #113904 from apelisse/add-owners-apelisse
Add apelisse into some more OWNERS files

Kubernetes-commit: b47752022b5b856a3516ad5377e3b020f43c4f2b
2022-12-09 23:33:52 +00:00
Kubernetes Publisher
6cbd19f22f Merge pull request #114319 from liggitt/net-master
Update golang.org/x/net 1e63c2f

Kubernetes-commit: 72acaad83924360960e21915aa94cd1db8d0196c
2022-12-07 02:03:56 +00:00
Jordan Liggitt
b044399795 Update golang.org/x/net 1e63c2f
Includes fix for CVE-2022-41717

Kubernetes-commit: afe5378db9d17b1e16ea0028ecfab432475f8e25
2022-12-06 17:29:11 -05:00
Andy Goldstein
fbb7f087d1 reflector: refactor setting typeDescription & expectedGVK
Signed-off-by: Andy Goldstein <andy.goldstein@redhat.com>

Kubernetes-commit: 784ec157e67c86bc3383b326bbfe8ee70737aa4d
2022-12-02 12:39:58 -05:00
Antoine Pelisse
0193d08605 Add jpbetz to k8s.io/client-go/applyconfigurations
Kubernetes-commit: a1f5e36fab45645ad4776eca927347d8dc715c8b
2022-11-17 14:54:41 -08:00
Jordan Liggitt
e2f402cda3 Limit request retrying to []byte request bodies
Kubernetes-commit: 69fad419a7666ac416307de4c3ee88c7e61b94db
2022-11-15 17:47:35 -05:00
Antoine Pelisse
a4d38f89cb Add apelisse into some more OWNERS files
Kubernetes-commit: b5f2130f240b0a9ebd1d0edd400b899d0efb8b2b
2022-11-14 16:28:14 -08:00
Kubernetes Publisher
1ac8d45935 Merge pull request #113797 from seans3/force-no-aggregated
Adds field to force non-aggregated discovery

Kubernetes-commit: 418608e926049e7458f03226fe27f101e7fdc47f
2022-11-14 21:50:55 +00:00
Kubernetes Publisher
c8ffed3108 Merge pull request #111023 from pohly/dynamic-resource-allocation
dynamic resource allocation

Kubernetes-commit: d1c0171aed848900daa07212370c991c19c318b1
2022-11-12 01:50:36 +00:00
Kubernetes Publisher
61cd728579 Merge pull request #113826 from jsafrane/add-openstack
Add CSI migration of OpenStack Cinder volumes

Kubernetes-commit: e4d46148de9d83c23001323d6613618c2897a427
2022-11-11 21:50:36 +00:00
Kubernetes Publisher
cfd682c60b Merge pull request #113375 from atiratree/PodHealthyPolicy-api
api: add unhealthyPodEvictionPolicy for PDBs

Kubernetes-commit: cc704f97784c3359db4690b97201ebfe6b481869
2022-11-11 13:50:33 +00:00
Patrick Ohly
522eaa15ef api: generated files
Kubernetes-commit: 9683c60c05491a9e9cafd3419c150caf7355bf49
2022-11-10 20:22:42 +01:00
Filip Křepinský
f1c80d7a4f generated
Kubernetes-commit: 3e3912467a0d7b00ec8a5231da3603b3aa31337d
2022-11-10 18:41:33 +01:00
Kubernetes Publisher
acc9fa7e04 Merge pull request #113186 from ttakahashi21/KEP-3294
Introduce APIs to support CrossNamespaceSourceProvisioning

Kubernetes-commit: d94261e904c90578e913c42c4d2a0fc8cb30937f
2022-11-10 17:39:30 +00:00
Jan Safranek
f2b10f39ac Remove OpenStack cloud provider
And keep OpenStack Cinder CSI translation

Kubernetes-commit: 6005c3b5120d2bfa1ce72b02389ac951a0482545
2022-11-10 18:26:00 +01:00
Jan Safranek
a3d3eb0cc9 Revert "Remove references to openstack and cinder"
This reverts commit 9bbf01bae93600d3314bce0acbff1f3a0a42e74b.

Kubernetes-commit: 5b284a50b78cb7d68b12825f5c0cfa29503c1577
2022-11-10 18:22:07 +01:00
Takafumi Takahashi
c7bdab2154 Generate code
Kubernetes-commit: cb12a2bc5118fe34e2eb396dc1a3b8e7cc1de9f4
2022-11-09 21:21:52 +00:00
Kubernetes Publisher
0a1f6a8fd0 Merge pull request #112744 from pwschuurman/statefulset-slice-impl
Add implementation of KEP-3335, StatefulSetSlice

Kubernetes-commit: ff19efdf9bd2d1f4abece3229f1e36c1d58b96df
2022-11-09 21:30:32 +00:00
Sean Sullivan
3ac73ea2c8 Adds bool to force non-aggregated discovery
Kubernetes-commit: a84d877310ba5cf9237c8e8e3218229c202d3a1e
2022-11-09 12:30:05 -08:00
Kubernetes Publisher
1c7a870d4f Merge pull request #113485 from MikeSpreitzer/apf-borrowing
Add borrowing between priority levels in APF

Kubernetes-commit: 1193a9abcbd6c6ce6fc7d4ce38872f1933ef5159
2022-11-09 13:30:37 +00:00
Kubernetes Publisher
7280270f31 Merge pull request #113599 from seans3/discovery-client-update
Aggregated discovery client

Kubernetes-commit: c288251818d9d39ffc10d8d133a5094288e73b3b
2022-11-09 09:30:03 +00:00
Marly Puckett
769443557e Update redacting functionality to redact all sensitive info in config when printing with view (#109189)
* Add RedactSecrets function

* Move RedactSecrets method to existing RawBytesData case

* Update TestRedactSecrets to use new pattern of os.CreateTemp()

Kubernetes-commit: e721272d10dd6c4d85ff613182ba0eaddcec9272
2022-11-08 17:30:10 +00:00
Kubernetes Publisher
4b1a9fdfb5 Merge pull request #113314 from cici37/celIntegration
CEL validation in Admission chain

Kubernetes-commit: 595ea324113580ae61f4a15ab3e5b22303a195cf
2022-11-08 05:49:13 +00:00
Kubernetes Publisher
ea9ec91697 Merge pull request #112905 from alexzielenski/kubectl-apply-csa-migration
kubectl: `apply --server-side` managed fields migration

Kubernetes-commit: 2f837dc113ba35f84e7012a6d1b06b075b349353
2022-11-08 05:49:10 +00:00
Kubernetes Publisher
3daf180aa6 Merge pull request #113688 from dashpole/update_utils
Update k8s.io/utils to fix util tracing panic

Kubernetes-commit: fa2e203a6bde89a84443ee9813e1f27aa31326a9
2022-11-08 05:49:08 +00:00
David Ashpole
dbe034bd24 update k8s.io/utils to fix util tracing panic
Kubernetes-commit: 3f1511c8e9a64cf60821036aa1fc3ec9d58a2931
2022-11-07 19:30:21 +00:00
Kubernetes Publisher
7ed3193a72 Merge pull request #111545 from jlsong01/rewrite_signature_of_StartEventWatcher
rewrite signature of function StartEventWatcher

Kubernetes-commit: f33209a6ede53ce6ead8aed6cfc1823df1afedfc
2022-11-08 05:49:05 +00:00