Commit Graph

164 Commits

Author SHA1 Message Date
Tim Hockin
bcf88f084d Update golang.org/x/time/rate (#104014)
* Add failing test case

* Update golang.org/x/time/rate

* Call update-internal-modules from update-vendor

Kubernetes-commit: 09dc055984e9532f29f37acae7aea7a979ded764
2021-07-30 02:27:36 +00:00
Monis Khan
30cd4e9a49 csr: add expirationSeconds field to control cert lifetime
This change updates the CSR API to add a new, optional field called
expirationSeconds.  This field is a request to the signer for the
maximum duration the client wishes the cert to have.  The signer is
free to ignore this request based on its own internal policy.  The
signers built-in to KCM will honor this field if it is not set to a
value greater than --cluster-signing-duration.  The minimum allowed
value for this field is 600 seconds (ten minutes).

This change will help enforce safer durations for certificates in
the Kube ecosystem and will help related projects such as
cert-manager with their migration to the Kube CSR API.

Future enhancements may update the Kubelet to take advantage of this
field when it is configured in a way that can tolerate shorter
certificate lifespans with regular rotation.

Signed-off-by: Monis Khan <mok@vmware.com>

Kubernetes-commit: cd91e59f7c351fce47c064a5162c2cb79075159c
2021-06-25 22:08:10 -04:00
Robin Černín
b6d16d4e18 [jsonpath] fix wrong output when using jsonpath
Fix range loop when using jsonpath

Without patch:

kubectl get -n openshift-oauth-apiserver po -o jsonpath='{range .items[?(.status.phase=="Running")]}{.metadata.name}{" is Running\n"}'
apiserver-7d9cc97649-79c2x is Running
apiserver-7d9cc97649-lgks6 is Running
apiserver-7d9cc97649-qgkxn is Running
 is Running

With patch:

kubectl get -n openshift-oauth-apiserver po -o jsonpath='{range .items[?(.status.phase=="Running")]}{.metadata.name}{" is Running\n"}'
apiserver-7d9cc97649-79c2x is Running
apiserver-7d9cc97649-lgks6 is Running
apiserver-7d9cc97649-qgkxn is Running

Kubernetes-commit: 39cfe232325d66bcdbc935af7aaf7022562e7010
2021-01-14 19:53:59 +10:00
Yusuke Tsutsumi
db078d2f1b client-go: NewSelfSignedCACert makes Go 1.15+ compatible cert (#100324)
* NewSelfSignedCACert makes Go 1.15+ compatible cert

As of Go 1.15, X.509 certificates without a SAN no longer
fall back to the CommonName of the certificate.

https://golang.org/doc/go1.15#commonname

Updating NewSelfSignedCACert to produce certificates that
work with this change.

* add missing license

Kubernetes-commit: a41a3ed4ae77a7902577bdb50b35fc5f42ed7c60
2021-05-18 10:29:21 +00:00
Clayton Coleman
3faf506116 Add type logging to certificate manager
Kubelet cert rotation involves two certificate manager instances
(one for client and one for server certs) and the log lines are
identical and confusing. Since certificate manager is a utility
library it is also inappropriate to simply assume klog output is
sufficient.

certificate.Manager now accepts a Name and Logf function on its
config struct to identify the purpose of the manager and to
provide a way to redirect where output should go. If Name is
absent, the name is defaulted from the SignerName, and if that
is not found then the name is set to "client auth" if that is
a provided key usage, or "certificate" otherwise. If Logf is
not provided it defaults to klog.V(2). as today. The name is printed
in "foo: bar" form on every line, but can be converted to structured
logging in the future. The log level is not customizable and it
is up to the caller to decide whether that is an issue.

Some log messages are slightly cleaned up to more clearly indicate
their intent. One log message is removed in a utility function that
was already at v(4) and less likely to be needed.

The default behavior of the certificate manager is as before and
the kubelet now identifies the server and client signerName as
separate entities:

I0414 19:07:33.590419    1539 certificate_manager.go:263] kubernetes.io/kube-apiserver-client-kubelet: Rotating certificates
E0414 19:07:33.594154    1539 certificate_manager.go:464] kubernetes.io/kube-apiserver-client-kubelet: Failed while requesting a signed certificate from the master: cannot create certificate signing request: Post "https://...

Kubernetes-commit: 64c669bd0ac8fda39ba97f48ef887ac1f77fb014
2021-04-14 13:30:46 -04:00
卢振兴10069964
b1c481c6d5 code cleanup:remove repeated package import in client-go
Kubernetes-commit: 243dab458753002dae5741042840b21f9b831fbc
2021-04-16 08:40:30 +08:00
Daniel Smith
5985bbb560 Fix unbounded connection creation & 50s of delay
Kubernetes-commit: 80c3ec4c6a62486b0993b2e2f51c3e6f9bd6413a
2021-01-27 16:47:04 -08:00
Jordan Liggitt
0c5bab64fe Track opened connections with a single tracker per authenticator
Kubernetes-commit: ecbff22ca134bd802127aab2be165d2770a9262a
2021-01-08 12:13:19 -05:00
Dan Ramich
f39ca994bd Don't start goroutine for noMetrics
Problem:
When calling newQueue metrics can be of type noMetrics when just calling
New. When doing this a new goroutine is created to update the metrics
but in this case there are no metrics so it's just creating goroutines
that don't do anything but consume resources.

Solution:
If the incoming metrics is of type noMetrics, don't start the goroutine

Kubernetes-commit: de021396f81ff438899297a6f464c70113b58475
2020-09-15 16:21:48 -06:00
Marek Siarkowicz
e93788d387 Add datapolicy tags to staging/src/k8s.io/client-go/
Kubernetes-commit: e29c568c4a9cd45d15665345aa015e21bcff52dd
2020-10-29 18:15:52 +01:00
brianpursley
135cef183c Fix bug in JSON path parser where an error occurs when a range is empty
Kubernetes-commit: 10634c6093c84acc78181a26c93d8785e12802e4
2020-11-01 10:41:19 -05:00
knight42
f2963a02f6 test(workqueue): deflake TestMetrics
Signed-off-by: knight42 <anonymousknight96@gmail.com>

Kubernetes-commit: b70e1d836c2d438af6b01fd297677b900b364a33
2020-09-05 18:50:45 +08:00
Joel Smith
2221ace373 jsonpath: disallow multiple immediate recursive descent (e.g. ....Foo)
Kubernetes-commit: 8c702254938c40a48b2e3db78fcc944ca50fdc65
2020-07-30 10:53:12 -06:00
Jordan Liggitt
3ab7d09ea9 Switch cert manager to v1 CSR API by default, falling back to v1beta1
Kubernetes-commit: a298c14f18d4973a9ceaf21f1e0dc4e39b4c5bfb
2020-06-03 22:40:02 -04:00
Jordan Liggitt
198e8f5ee4 Switch issued check to inspect certificate length
Kubernetes-commit: 94fd1d76ca0e8992b000fbb6b1562c11c37df7cb
2020-05-28 10:48:49 -04:00
Jordan Liggitt
e72c3d3ce2 Stop waiting for failed CSRs
Kubernetes-commit: 184b3f81adcf73fe063579eeef41f5bc9c6ae19a
2020-04-16 01:06:10 -04:00
Davanum Srinivas
75fea27a27 switch over k/k to use klog v2
Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: 442a69c3bdf6fe8e525b05887e57d89db1e2f3a5
2020-04-17 15:25:06 -04:00
Phil Ferrell
bd76c10336 client-go: change jsonpath output of non-primitive types from Go-syntax to JSON
kubectl: add --output jsonpath-as-json to print a json array of results
kubeadm: fix test case using jsonpath result of non-primitive type

Kubernetes-commit: ba386aba4fe02906089ca3e96ee07925bced5d4d
2020-04-15 14:45:44 -07:00
Knic Knic
d3d74fb975 fix cert path generation in windows
Kubernetes-commit: a381e1b04ec070a63d76d51663b7b0cbf4ce5403
2020-04-25 15:49:02 -07:00
tangcong
403aae0467 fix client-go util staticcheck error
Kubernetes-commit: 16c3ef2df8c12fcc4bc2596788fb6ee565b8eed8
2020-04-20 10:30:28 +08:00
Brian Pursley
1ade84933e Fixed bug where jsonpath expression with a nested range does not process subsequent nodes
Kubernetes-commit: 852e661f3dd0f7be9b9b1469316d9947c4b5a5c0
2020-02-27 11:03:27 -05:00
fatedier
1ded602dc0 Export new constructor for DelayingQueue
Kubernetes-commit: b5d989a6fc78fd8d1743eb2b80b9be4cb6e3c6ac
2020-03-23 12:15:29 +08:00
Aldo Culquicondor
7ee24064f0 Use sqrt(n) chunk size in pod affinity and core scheduler
Kubernetes-commit: e902e70d0d9bca1a1c823ce9d04d8fd68e8f3396
2020-03-16 14:12:11 -04:00
Aldo Culquicondor
326ffd9341 Add chunk size option to ParallelizeUntil
Signed-off-by: Aldo Culquicondor <acondor@google.com>

Kubernetes-commit: 36efa035e292480d4b0ccc7a4ffbf9aa579fbf30
2020-03-11 17:13:55 -04:00
Maciej Borsz
8fbf5159e5 Revert "Implement ItemBucketRateLimiter"
Kubernetes-commit: 01c62f672611024445a846e3cdf60e5e99fb8a1e
2020-03-05 14:35:19 +01:00
James Munnelly
0c19a3c0da Extend client-go csr package to invalidate CSRs based on signerName
Kubernetes-commit: c2367bd5da68112ad3031dd33933859dacf8db58
2020-03-03 13:14:04 +00:00
Jack Kleeman
29bb8bf344 Support intermediate certificate in certificate store
Kubernetes-commit: 83a223f5ee3790b7ed54197986d4317e75da1652
2020-03-02 19:48:38 +00:00
James Munnelly
e8be24fd4c certificates: update controllers to understand signerName field
Signed-off-by: James Munnelly <james.munnelly@jetstack.io>

Kubernetes-commit: d5dae048983cd299cdce9d2703f564bf4bd246ee
2020-02-17 23:06:02 +00:00
Jiahui Feng
9d42b5ecf1 add logging for csr being approved and issued.
Kubernetes-commit: fdd7424d191b43bc9b1c4364ddf9c88547883072
2020-02-12 11:09:56 -08:00
Maciej Borsz
94f6bd1785 Implement ItemBucketRateLimiter
Kubernetes-commit: 6846a0a6b62725a5888d66e2789f2af4fb172045
2020-02-18 11:24:20 +01:00
Jordan Liggitt
03953c1a93 Set up connection onClose prior to adding to connection map
Kubernetes-commit: aa4113d777dd6c699233e0b6d903e9734e182686
2020-02-12 11:14:22 -05:00
Mike Danese
a9af074362 manual fixes
Kubernetes-commit: bfc75d9a5c1673092be1030137319684edd17aa3
2020-02-04 18:02:08 -08:00
Mike Danese
6659ae5216 generated: run refactor
Kubernetes-commit: 25651408aeadf38c3df7ea8c760e7519fd37d625
2020-02-08 12:30:21 -05:00
Mike Danese
6b3a79f9fc some manual fixes
Kubernetes-commit: 26377722982a8489d2a974db88e7478e54e4eaf0
2019-12-17 00:01:53 -08:00
Mike Danese
60a0346672 generated: run refactor
Kubernetes-commit: 3aa59f7f3077642592dc8a864fcef8ba98699894
2020-02-07 18:16:47 -08:00
Tim Allclair
8462896174 Ensure testing credentials are labeled as such
Kubernetes-commit: 9d3670f3586c98c02cdca93b7c98dd91fc0b87bd
2020-02-04 10:36:05 -08:00
danielqsj
51f3d77844 clean SinceInMicroseconds, convert to SinceInSeconds
Kubernetes-commit: ab182552b485ceed96c3b05d284ae9480377daf8
2019-04-15 16:18:01 +08:00
Samuel Davidson
41735bf478 Changed Kubelet client and serving cert TTL/Expiry certs to use gaugefunc for calculating time remaining.
Kubernetes-commit: aba0b315269dab469694af7fca879438a7f87e41
2019-12-03 16:01:56 -08:00
Ryan Phillips
52589237eb kubelet: add certificate rotation error metric
Kubernetes-commit: 8e50c55e6bf715d9067376a9e7f136ffacb0a3ee
2019-11-05 16:51:40 -06:00
Ted Yu
a4893d5271 Check error return from closing connection
Kubernetes-commit: 7bafa7d8f54326b69d41c92793eaa641d3a5b31b
2019-11-14 07:36:30 -08:00
David Eads
7a5b91a7ca dynamic reload cluster authentication info for aggregated API servers
Kubernetes-commit: 3aede35b3b042e8a626e8fb9e1e181e73cd29d0a
2019-11-04 13:46:28 -05:00
David Eads
4bda71482c create utilities inspecting server TLS certs
Kubernetes-commit: e44352f31a8d506d77d2757dbb354fd539826c92
2019-11-12 10:10:26 -05:00
David Eads
5aa4fef661 publish cluster authentication trust via controller
Kubernetes-commit: 7351c8686031b320f61c70fe065d3c039dda0a99
2019-09-09 10:17:00 -04:00
Samuel Davidson
7bd7ed8621 Added rotation metric to certificate manager
Kubernetes-commit: 7adb18120079016ed8aea1bd40e5cde161827a1d
2019-10-28 14:09:40 -07:00
Jacek Kaniuk
d81654af9d pkg/util/workqueue/delaying_queue: export contructor with custom clock
Kubernetes-commit: 638c02f6cdb4e269f46b60fe1f91e553cfc59749
2019-10-23 16:07:38 +02:00
Michael Morello
8a1fbdc8bb Fix memory and timer leak in work queue
Kubernetes-commit: f9c3d246d32cd440a8ea5ea40f02b6a9bfe4b485
2019-10-15 10:06:06 +02:00
David Eads
a7d8568b02 add ability to authenticators for dynamic update of certs
Kubernetes-commit: 51195dd86012c4c4b17a1707ef50a46fa046f74f
2019-09-05 09:59:59 -04:00
Dan Winship
9781541482 Clarify retry.RetryOnConflict docs
Kubernetes-commit: 23b391e1dd56e84708ac8c95bf6293fe86879c1c
2019-09-03 12:26:17 -04:00
Dan Winship
0e80a77286 Restore retry.RetryOnConflict docs, fix up retry.OnError docs/naming
Kubernetes-commit: b098e013242be8b480340d30063388b0020ae32e
2019-09-06 06:33:34 -04:00
RainbowMango
532b6f676e Cleanup staticcheck issues for package in client-go.
Kubernetes-commit: c8c055b3163dd2661b3f9dd1b0ffb718a61aba24
2019-08-26 20:55:32 +08:00