Commit Graph

101 Commits

Author SHA1 Message Date
Yuan Chen
a24aef6510 Replace a function closure
Replace more closures with pointer conversion

Replace deprecated Int32Ptr to Int32
2023-02-27 09:13:36 -08:00
Daniel Smith
8100efc7b3 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
2022-12-14 18:43:33 +00:00
Wojciech Tyczyński
f673c262bd Clean shutdown of client integration tests 2022-07-19 10:03:51 +02:00
Abu Kashem
6acbe7e645
client-go: chain the error returned by rate limiter 2022-03-23 08:29:28 -04:00
Kubernetes Prow Robot
19935de5a9
Merge pull request #107410 from margocrawf/master
Ensure static certs in kubeconfig override exec plugin
2022-03-08 11:34:21 -08:00
Margo Crawford
f015fd66ce Check whether static cert is already configured in UpdateTransportConfig
- Also update test-cmd.sh to pass a signing ca to the kube controller
  manager, so CSRs work properly in integration tests.

Signed-off-by: Margo Crawford <margaretc@vmware.com>
2022-03-07 13:54:32 -08:00
Wojciech Tyczyński
41ee6a3e44 Remove selflink integration tests 2022-02-14 11:11:56 +01:00
ahrtr
fe95aa614c io/ioutil has already been deprecated in golang 1.16, so replace all ioutil with io and os 2022-02-03 05:32:12 +08:00
Jiahui Feng
c56bbda368 fix containers order after applying
to be appending instead of prepending.
2022-01-14 11:15:54 -08:00
Jordan Liggitt
88ab0d03b7 Revert "update expected ordering"
This reverts commit fbc8ac9c96.
2021-11-24 11:19:27 -05:00
Jiahui Feng
fbc8ac9c96 update expected ordering
in apply test.
2021-11-02 10:00:00 -07:00
h4ghhh
0734820279
'New' Event namespace validate failed (#100125) 2021-09-16 04:29:45 -07:00
Kevin Delgado
7bfc420351 simplify test to only test the new logic of extractUnstructured 2021-07-27 01:28:44 +00:00
Kevin Delgado
c9e97de46b Address PR feedback around gvk parser generation ergonomics 2021-07-27 01:28:43 +00:00
Kevin Delgado
604db6eb2a rename cache, add to integration test 2021-07-27 01:28:43 +00:00
Kevin Delgado
7b9757faa4 basic caching working 2021-07-27 01:28:42 +00:00
Kevin Delgado
9f4a4d812d Write TestUnstructuredExtract 2021-07-27 01:28:04 +00:00
Monis Khan
a6ac42082b
client-go exec: fix metrics related to plugin not found
These were missed because our tests did not pass in the correct test
data input (the command to execute).

Signed-off-by: Monis Khan <mok@vmware.com>
2021-07-14 14:02:23 -04:00
Andrew Keesler
20e1c4d754
exec credential provider: update tests+metadata for v1
Signed-off-by: Andrew Keesler <akeesler@vmware.com>
2021-07-06 09:48:35 -04:00
Andrew Keesler
cd83d89ac9
exec credential provider: InteractiveMode support
The value here is that the exec plugin author can use the kubeconfig to assert
how standard input is treated with respect to the exec plugin, e.g.,
- an exec plugin author can ensure that kubectl fails if it cannot provide
  standard input to an exec plugin that needs it (Always)
- an exec plugin author can ensure that an client-go process will still call an
  exec plugin that prefers standard input even if standard input is not
  available (IfAvailable)

Signed-off-by: Andrew Keesler <akeesler@vmware.com>
2021-06-15 09:01:17 -04:00
pacoxu
64946cd50d fix flake integration rotation via informer
Signed-off-by: pacoxu <paco.xu@daocloud.io>
2021-06-07 15:44:53 +08:00
Kubernetes Prow Robot
661b76f864
Merge pull request #102216 from enj/enj/t/exec_global_cache
Add integration test for exec plugin global cache
2021-05-21 16:41:37 -07:00
Monis Khan
a45ffd0771
Add integration test for exec plugin global cache
Signed-off-by: Monis Khan <mok@vmware.com>
2021-05-21 16:17:32 -04:00
Andrew Keesler
9dee2b95c2
exec credential provider: don't run exec plugin with basic auth
If a user specifies basic auth, then apply the same short circuit logic
that we do for bearer tokens (see comment).

Signed-off-by: Andrew Keesler <akeesler@vmware.com>
2021-05-21 13:51:03 -04:00
Andrew Keesler
584acb2cfe
test/integration/client: test exec calls metric
Signed-off-by: Andrew Keesler <akeesler@vmware.com>
2021-05-21 09:20:47 -04:00
Andrew Keesler
a14cd8e3de
test/integration/client: add TestExecPluginRotationViaInformer
Signed-off-by: Andrew Keesler <akeesler@vmware.com>
2021-05-17 17:22:09 -04:00
Joe Betz
d01788cd56 Enable extract test for status subresource 2021-04-22 15:32:45 -07:00
Antoine Pelisse
e477c31307 fieldmanager: Comment test broken by status being separated from main resource 2021-04-16 14:26:05 -07:00
Andrew Keesler
d00202bd3e
exec credential provider: informer happy path integration test
Signed-off-by: Andrew Keesler <akeesler@vmware.com>
2021-04-07 14:46:40 -04:00
Andrew Keesler
c984a1c834
test/integration/client: ditch unused code
Signed-off-by: Andrew Keesler <akeesler@vmware.com>
2021-04-06 09:40:57 -04:00
Joe Betz
987657a80f Add extract apply function generation 2021-03-10 06:13:51 -08:00
Joe Betz
0b42cae157 Add integration test 2021-03-06 20:50:52 -05:00
Andrew Keesler
8834aa133c
exec credential provider: first integration test (static auth interaction)
I also added some simple happy/sad path tests so we get some coverage at the
integration level.

Signed-off-by: Andrew Keesler <akeesler@vmware.com>
2021-03-01 14:33:48 -05:00
Benjamin Elder
56e092e382 hack/update-bazel.sh 2021-02-28 15:17:29 -08:00
wojtekt
2539912a22 Stop setting SelfLink in kube-apiserver. 2020-09-01 20:57:38 +02:00
Jordan Liggitt
b7c2faf26c client-go dynamic client: add context to callers 2020-03-06 10:56:23 -05:00
Jordan Liggitt
b19dc3a474 client-go dynamic client: update DeleteOptions callers 2020-03-06 10:21:23 -05:00
Jack Kleeman
929b1559a0 Add ReloadCertFromDisk flag to rest.Config and to kubeconfig which allows the provided client certificate files to be reloaded from disk (currently on every use)
Close outbound connections when using a cert callback and certificates rotate. This means that we won't get into a situation where we have open TLS connections using expires certs, which would get unauthorized errors at the apiserver

Attempt to retrieve a new certificate if open connections near expiry, to prevent the case where the cert expires but we haven't yet opened a new TLS connection and so GetClientCertificate hasn't been called.

Move certificate rotation logic to a separate function

Rely on generic transport approach to handle closing TLS client connections in exec plugin; no need to use a custom dialer as this is now the default behaviour of the transport when faced with a cert callback. As a result of handling this case, it is now safe to apply the transport approach even in cases where there is a custom Dialer (this will not affect kubelet connrotation behaviour, because that uses a custom transport, not just a dialer).

Check expiry of the full TLS certificate chain that will be presented, not only the leaf. Only do this check when the certificate actually rotates. Start the certificate as a zero value, not nil, so that we don't see a rotation when there is in fact no client certificate

Drain the timer when we first initialize it, to prevent immediate rotation. Additionally, calling Stop() on the timer isn't necessary.

Don't close connections on the first 'rotation'

Remove RotateCertFromDisk and RotateClientCertFromDisk flags.

Instead simply default to rotating certificates from disk whenever files are exclusively provided.

Add integration test for client certificate rotation

Simplify logic; rotate every 5 mins

Instead of trying to be clever and checking for rotation just before an
expiry, let's match the logic of the new apiserver cert rotation logic
as much as possible. We write a controller that checks for rotation
every 5 mins. We also check on every new connection.

Respond to review

Fix kubelet certificate rotation logic

The kubelet rotation logic seems to be broken because it expects its
cert files to end up as cert data whereas in fact they end up as a
callback. We should just call the tlsConfig GetCertificate callback
as this obtains a current cert even in cases where a static cert is
provided, and check that for validity.

Later on we can refactor all of the kubelet logic so that all it does is
write files to disk, and the cert rotation work does the rest.

Only read certificates once a second at most

Respond to review

1) Don't blat the cert file names
2) Make it more obvious where we have a neverstop
3) Naming
4) Verbosity

Avoid cache busting

Use filenames as cache keys when rotation is enabled, and add the
rotation later in the creation of the transport.

Caller should start the rotating dialer

Add continuous request rotation test

Rebase: use context in List/Watch

Swap goroutine around

Retry GETs on net.IsProbableEOF

Refactor certRotatingDialer

For simplicity, don't affect cert callbacks

To reduce change surface, lets not try to handle the case of a changing
GetCert callback in this PR. Reverting this commit should be sufficient
to handle that case in a later PR.

This PR will focus only on rotating certificate and key files.
Therefore, we don't need to modify the exec auth plugin.

Fix copyright year
2020-03-02 17:20:16 +00:00
Mike Danese
25651408ae generated: run refactor 2020-02-08 12:30:21 -05:00
Mike Danese
3aa59f7f30 generated: run refactor 2020-02-07 18:16:47 -08:00
Mike Danese
d55d6175f8 refactor 2020-01-29 08:50:45 -08:00
SataQiu
17b0b77026 fix staticcheck failures of test/integration/client test/integration/disruption 2020-01-03 17:23:35 +08:00
Jordan Liggitt
5d5b444c4d Remove use of testapi codecs, selflink, resourcepath functions 2019-12-13 11:56:29 -05:00
Han Kang
866ea74326 remove pkg/version and some of redundant copies of it
Change-Id: Ia58367c1b1274bfb49c8a4784051463abaf795de
2019-09-16 16:24:35 -07:00
Yassine TIJANI
bfa12a0992 add integration test for core/v1beta1 event compatibility
Signed-off-by: Yassine TIJANI <ytijani@vmware.com>
2019-05-30 15:01:15 +00:00
Bin Lu
5504d845ff Bug fix: failed to run integration test by using bazel
Signed-off-by: Bin Lu <bin.lu@arm.com>
2019-05-17 11:19:55 +08:00
xuzhonghu
b7f645a5ef replace framework.RunAMaster with kubeapiservertesting.StartTestServer 2018-07-28 10:33:39 +08:00
xuzhonghu
b4a73d50c0 add watch integration test for dynamic client 2018-07-26 16:17:38 +08:00
Jeff Grafton
23ceebac22 Run hack/update-bazel.sh 2018-06-22 16:22:57 -07:00
David Eads
d8924bc1c9 move old dynamic client to deprecated-client 2018-05-11 08:00:46 -04:00