Commit Graph

99 Commits

Author SHA1 Message Date
Andrew Lytvynov
d000da197a Extract new keyutil package from client-go/util/cert
This package contains public/private key utilities copied directly from
client-go/util/cert. All imports were updated.

Future PRs will actually refactor the libraries.

Updates #71004

Kubernetes-commit: 18458392ca24c85c688e655aace1afd04f864cbd
2018-12-09 16:24:38 -08:00
Justin SB
931e6a04ad Remove executable file permission from OWNERS files
Kubernetes-commit: dd19b923b7c26420af39fcf4eedfa213b236c8d3
2019-01-03 12:18:20 -05:00
Roy Lenferink
94093d2527 Updated OWNERS files to include link to docs
Kubernetes-commit: b43c04452f3b563473b5c2a765d4ac18cc0ff58f
2019-01-30 20:05:00 +01:00
Tomas Nozicka
0dbe75c417 Switch WaitForCertificate to informers to avoid broken watches
Kubernetes-commit: a7588723f7e9b88c2e8b9d601a2391e0f6b19a17
2019-01-17 18:32:36 +01:00
mourya007
0c54a1af24 Re-Organize the pkutil library
Kubernetes-commit: 7c37e91a6ddc8610444bb8106541a19bfb24f46a
2019-01-23 12:01:32 +05:30
Andrew Kim
3fa0933a1e replace client-go/util/buffer with k8s.io/utils/buffer
Kubernetes-commit: 2358e75da3379720d2cc1d86384d4830a1557b88
2019-01-24 11:37:48 -05:00
Andrew Kim
610d917325 replace client-go/util/integer with k8s.io/utils/integer
Kubernetes-commit: 0bc5508aca9a945e92ef2a83492a70bbfcc12d13
2019-01-24 11:34:33 -05:00
Ted Yu
29e468d1ac Correct message for step value check
Kubernetes-commit: 6a819f75364db04638aabd97ae7a19b0b1e97b22
2019-01-22 09:41:13 -08:00
Jordan Liggitt
6b7e2becf2 Fix jsonpath slice step handling
Kubernetes-commit: 233d7e4962f61e9e8b4a4695f0cdab688ffc4368
2019-01-21 16:58:52 -05:00
WanLinghao
4b473f5dc7 fix a client-go bug which could casue kubectl panic (#72952)
* When user try execute command like `kubectl get pod test -o custom-columns=CONTAINER:.spec.containers[-1].name`
It will throw a panic about slice index out of bounds. This patch fix it.

* add test case

Kubernetes-commit: 1e245fad87584a28809f8f5d380b766edfa984ec
2019-01-19 08:14:20 +08:00
danielqsj
6658e1f4a3 Using histogram metrics instead of summary
Kubernetes-commit: 42214c5ac423289a6c87e0f3c1014f652d58bf62
2018-12-12 16:50:32 +08:00
danielqsj
c270b352df Use prometheus conventions for workqueue metrics
Kubernetes-commit: b828bc1a50dfa29ab85248e5af6da5acb27189c1
2018-11-21 11:43:47 +08:00
Lv Jiawei
2059e953fc Comment error in ItemExponentialFailureRateLimiter
The backoff value is baseDelay*2^<num-failures> in ItemExponentialFailureRateLimiter.When . But the comment is baseDelay*10^<num-failures>.

Kubernetes-commit: c1fa760b75970fbd0c142971f1142754cb4ea3fc
2018-11-08 12:13:23 +08:00
danielqsj
d25d9a3c52 Fix typos like limitting
Kubernetes-commit: 3c055aa4b47232bf7d6b5d5a0901dae239e33c59
2018-12-04 11:01:40 +08:00
Clayton Coleman
96e95840d4 Restore "Make bootstrap client cert loading part of rotation""
This reverts the revert of commit 34642222676640b3c1dd255cc453000f2743ccde.

Kubernetes-commit: 486577df17570b321a91b223901d7e4fdbb63519
2018-11-17 13:44:58 -05:00
Clayton Coleman
57b75fe80b Revert "Make bootstrap client cert loading part of rotation"
This reverts commit 0af19875add7deb562b2cf7bf6b1d273c44bab1b.

Revert "Ensure the bootstrap rotation code is tested by forcing rotation"

This reverts commit de293b2d7ddb687850258370f2a7f30f224f0ec1.

Kubernetes-commit: 34642222676640b3c1dd255cc453000f2743ccde
2018-11-17 10:24:23 -05:00
Clayton Coleman
cbb80ab872 Ensure the bootstrap rotation code is tested by forcing rotation
Expose both a Stop() method (for cleanup) and a method to force
cert rotation, but only expose Stop() on the interface.

Verify that we choose the correct client.

Kubernetes-commit: de293b2d7ddb687850258370f2a7f30f224f0ec1
2018-11-15 17:21:02 -05:00
Clayton Coleman
39159c379b Make bootstrap client cert loading part of rotation
Ensure that bootstrap+clientcert-rotation in the Kubelet can:

1. happen in the background so that static pods aren't blocked by bootstrap
2. collapse down to a single call path for requesting a CSR
3. reorganize the code to allow future flexibility in retrieving bootstrap creds

Fetching the first certificate and later certificates when the kubelet
is using client rotation and bootstrapping should share the same code
path. We also want to start the Kubelet static pod loop before
bootstrapping completes. Finally, we want to take an incremental step
towards improving how the bootstrap credentials are loaded from disk
(potentially allowing for a CLI call to get credentials, or a remote
plugin that better integrates with cloud providers or KSMs).

Reorganize how the kubelet client config is determined. If rotation is
off, simplify the code path. If rotation is on, load the config
from disk, and then pass that into the cert manager. The cert manager
creates a client each time it tries to request a new cert.

Preserve existing behavior where:

1. bootstrap kubeconfig is used if the current kubeconfig is invalid/expired
2. we create the kubeconfig file based on the bootstrap kubeconfig, pointing to
   the location that new client certs will be placed
3. the newest client cert is used once it has been loaded

Kubernetes-commit: 0af19875add7deb562b2cf7bf6b1d273c44bab1b
2018-10-16 12:52:47 -04:00
Andrew Lytvynov
ef24efb2a3 Remove k8s.io/client-go/util/cert/triple
The package is unused.

Kubernetes-commit: 09db5bc951e08ff355edb4be9e3944af61b5ce74
2018-11-12 16:08:56 -08:00
Andrew Lytvynov
5dc6658914 Move csr.RequestNodeCertificate into kubelet bootstrap package
This func is only used by the kubelet and there's no need to pollute
client-go API with it.

Kubernetes-commit: 5c073abfe16fc0b9f62310b8276fc3b0c7043e60
2018-11-12 16:53:53 -08:00
Andrew Lytvynov
8986d6b66c Remove unused funcs in certutil
Kubernetes-commit: 162b3642921ef18a2f5d5489f034409936c42e27
2018-11-13 10:26:43 -08:00
Daniel Smith
f0e9de6741 fixup! add longest_running_processor_microseconds metric
fix data race

Kubernetes-commit: 680ddd49d8d23a88744f9de720f266022effd409
2018-11-12 12:57:42 -08:00
Daniel Smith
952b05be23 add longest_running_processor_microseconds metric
Kubernetes-commit: fd77aa5a41bbce7490dd4538c0d5743cb59b2be4
2018-11-12 10:52:18 -08:00
Daniel Smith
cc2731ad7e fixup! Test workqueue metrics
change units to seconds

Kubernetes-commit: 578962d934df19cb2cb7ec0536dcb76f53951e68
2018-11-10 18:46:43 -08:00
Daniel Smith
e403f1715c fixup! Test workqueue metrics
Kubernetes-commit: 44a87baf09aec4f2e8e159de4c409d27aebbb1da
2018-11-10 18:24:59 -08:00
Daniel Smith
26f9385b8e Test workqueue metrics
Kubernetes-commit: 5a8444ceec9e28e8a7dbf36bfd7cb55554c5b865
2018-11-09 16:12:11 -08:00
Daniel Smith
75d4dad922 add a metric that can be used to notice stuck worker threads
Kubernetes-commit: 6195d1005d81eaa5dd49da744f5beab178340f5a
2018-11-09 10:43:44 -08:00
Andrew Lytvynov
28931a70f2 Unexport csr.ParseCSR
This func is only used internally and was copied from
k8s.io/kubernetes/pkg/apis/certificates.

Kubernetes-commit: 41334cfdd3eefc352536943518ffd9eaf570e27c
2018-11-12 17:15:09 -08:00
Davanum Srinivas
74cd8bbeee Move from glog to klog
- Move from the old github.com/golang/glog to k8s.io/klog
- klog as explicit InitFlags() so we add them as necessary
- we update the other repositories that we vendor that made a similar
change from glog to klog
  * github.com/kubernetes/repo-infra
  * k8s.io/gengo/
  * k8s.io/kube-openapi/
  * github.com/google/cadvisor
- Entirely remove all references to glog
- Fix some tests by explicit InitFlags in their init() methods

Change-Id: I92db545ff36fcec83afe98f550c9e630098b3135

Kubernetes-commit: 954996e231074dc7429f7be1256a579bedd8344c
2018-11-09 13:49:10 -05:00
Jordan Liggitt
f73b61fce1 certificates subproject approvers/reviewers
Kubernetes-commit: 4ebe084376610b88b0ac446b59ef537adcee51e3
2018-11-02 14:11:01 -04:00
Andrew Gunnerson
b9b3f6d2e7 certificate_manager: Check that template differs from current cert before rotation
With the current behavior, when kubelet starts, a `templateChanged`
event is always fired off because it only checks if `getLastRequest`
matches `getTemplate`. The last request only exists in memory and thus
is initially `nil` and can't ever match the current template during
startup.

This causes kubelet to request the signing of a new CSR every time it's
restarted. This commit changes the behavior so that `templateChanged` is
only fired off if the currently template doesn't match both the current
certificate and the last template.

Fixes #69471

Signed-off-by: Andrew Gunnerson <andrew.gunnerson@us.ibm.com>

Kubernetes-commit: b9ab65d689cc48353ca5dae9f210ff408726a0d2
2018-10-08 12:08:32 -04:00
tanshanshan
f3c7bb05b0 fix test log info
Kubernetes-commit: b0696b173b2cff3e561a7417b7adf48b93b5f44a
2018-08-15 10:19:03 +08:00
Andrew Lytvynov
40fb7ab6be Allow inverted key/cert order in combined PEM file
certificate.FileStore only handles (cert, key) combined PEM files. This
PR allows (key, cert), which is what "openssl req -out foo.pem -keyout
foo.pem" generates.

Kubernetes-commit: 4b6a6a1cd5c8df83b3c51a03ecab975b82057489
2018-10-08 11:37:36 -07:00
Guoliang Wang
b5eba4c261 Replace Parallelize with function ParallelizeUntil and formally deprecate the Parallelize
Kubernetes-commit: c2622dd9d800280bcaeea9473340a4efb94946d2
2018-09-07 17:17:27 +08:00
Christoph Blecker
7f1c01699a Update gofmt for go1.11
Kubernetes-commit: 97b2992dc191a357e2167eff5035ce26237a4799
2018-10-05 12:59:38 -07:00
mrIncompetent
30575d7a9f use signer interface for certificate creation
Kubernetes-commit: ef04b17ad8097db22755af05e2889b4d73eaf99f
2018-10-02 14:49:45 +02:00
tanshanshan
0fa5515631 fix syntax error:'its'
Kubernetes-commit: 7dfe0dae64aa2f6cd579f9c88bdf84cccad94504
2018-09-20 09:45:46 +08:00
Guoliang Wang
35223a0681 Not split nodes when searching for nodes but doing it all at once
Kubernetes-commit: 6c63dcfffebb9a8bcc5e1cee748ad16d7ed7e293
2018-08-18 09:05:58 +08:00
liz
22e1ddcc48 Actually renew certificates (using on-disk CAs)
Kubernetes-commit: 76be5ca581818227062f7d0638cb772bb862bdb9
2018-08-29 17:57:02 -04:00
Tomas Nozicka
6dac86f710 Deprecate ListWatchUntil, fix it and call places
Kubernetes-commit: e434f3189e81e473aa89e3589ca81545d1341cf8
2018-08-03 16:08:28 +02:00
Dr. Stefan Schimanski
ad896870c5 apiserver: use fixtures for self-signed certs in test server
Kubernetes-commit: 7deccb5b7a7c5224d3d90e1391dd22b2d1f1b9b9
2018-07-06 12:04:38 +02:00
Jordan Liggitt
9936c2e1aa Derive kubelet serving certificate CSR template from node status addresses
Kubernetes-commit: db9d3c2d1057f97a4763987baee00b82718feaa0
2018-06-28 14:44:25 -04:00
Qi Jiang
35bd65deaa fix typos for TestBackoffHighWaterMark
Kubernetes-commit: 1ffe8a377dbbd1cf21693577878ff14cec98988b
2018-06-28 11:22:13 +08:00
Cong Ding
d589639e75 cleanup: remove deadcode
Kubernetes-commit: 3bacb04a5f9805bb83e016e341a49d0f13a43598
2018-06-22 16:39:13 -07:00
Guoliang Wang
5037893508 replace fmt.Sprintf(%s, i.Type()) with i.Type().String()
Kubernetes-commit: 17ad3eaa26b4ecf2759eadb01ab91af6ae292a3c
2018-05-30 18:18:58 +08:00
Andrew Lytvynov
321986595f Re-use private key after failed CSR
If we create a new key on each CSR, if CSR fails the next attempt will
create a new one instead of reusing previous CSR.

If approver/signer don't handle CSRs as quickly as new nodes come up,
they can pile up and approver would keep handling old abandoned CSRs and
Nodes would keep timing out on startup.

Kubernetes-commit: 2c0f043957d25da162fe4e1026c50e2587529ff9
2018-06-13 11:27:25 -07:00
Andrew Lytvynov
6c082e8151 Extract connection rotating dialer into a package
This will be re-used for exec auth plugin to rotate connections on
credential change.

Kubernetes-commit: 85a61ff3aa7df8d83af304ebffab780fabd028a8
2018-05-16 10:30:53 -07:00
Mikhail Mazurskiy
9446f4ef9d Stop() for Ticker to enable leak-free code
Kubernetes-commit: 1f393cdef96fe6e4ddcbf93825d65a9980463406
2018-03-31 19:41:43 +11:00
Clayton Coleman
caf2e70aa1 When bootstrapping a client cert, store it with other client certs
The kubelet uses two different locations to store certificates on
initial bootstrap and then on subsequent rotation:

* bootstrap: certDir/kubelet-client.(crt|key)
* rotation:  certDir/kubelet-client-(DATE|current).pem

Bootstrap also creates an initial node.kubeconfig that points to the
certs. Unfortunately, with short rotation the node.kubeconfig then
becomes out of date because it points to the initial cert/key, not the
rotated cert key.

Alter the bootstrap code to store client certs exactly as if they would
be rotated (using the same cert Store code), and reference the PEM file
containing cert/key from node.kubeconfig, which is supported by kubectl
and other Go tooling. This ensures that the node.kubeconfig continues to
be valid past the first expiration.

Kubernetes-commit: 368959346af6e06085c63a4cc7c37839f262f636
2018-04-04 21:56:15 -04:00
Cao Shufeng
a52532be7b fix assert.Equal argument order
Reference:
https://godoc.org/github.com/stretchr/testify/assert#Equal

Kubernetes-commit: f95bc9289d684d311c54ff66adc2dd50a4af8143
2018-02-04 15:14:55 +08:00