278 Commits

Author SHA1 Message Date
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
Kubernetes Publisher
fff8c3d73e sync: initially remove files BUILD */BUILD BUILD.bazel */BUILD.bazel 2018-03-15 09:19:38 +00:00
Wang Guoliang
a8dc497f30 fix some syntax related errors
Kubernetes-commit: d065157dd74fa02eec87f5849528b079a3736c3d
2018-02-11 19:50:49 +08:00
Jordan Liggitt
dd61bd2530 Split self-signed cert and CA
Kubernetes-commit: 3d3cde45b73ec31c81fadbfd494387d141858a40
2018-02-15 23:30:17 -05:00
Clayton Coleman
b30485cc03 When using the bootstrap cert, update the store
Otherwise, the certificate store will return nil the first time a store
cert is accessed. When background rotation is being used, prevents the
client from being nil.

Kubernetes-commit: b81f4745546340f08abd3f877c585aac9581d0f0
2018-02-04 01:24:56 -05:00
Jeff Grafton
fca8bb2928 Autogenerated: hack/update-bazel.sh
Kubernetes-commit: ef56a8d6bb3800ab7803713eafc4191e8202ad6e
2018-02-16 13:43:01 -08:00
Di Xu
d39d12f4b0 fix all the typos across the project
Kubernetes-commit: 48388fec7eaad4ac8d84fbe20673ffacf41964a1
2018-02-09 14:53:53 +08:00
Jordan Liggitt
acc52496ce Switch from juju/ratelimit to golang.org/x/time/rate
Kubernetes-commit: 4b9f00988b9401f6c774d3d5e1bce45a8e8f81c8
2018-01-19 02:08:51 -05:00
Jordan Liggitt
7392f7f78f Remove Saturation() from rate limiter interface
Kubernetes-commit: a9ed90f227f07fab2da75541d57a5366ddb38f66
2018-01-19 01:59:33 -05:00
halfcrazy
b6a34c5a00 fix typo in client-go
Kubernetes-commit: 86801dee64215e76080fe8df83ffd1fb7df9e093
2018-02-01 02:33:45 +08:00
Clayton Coleman
3f65b38279 Only rotate certificates in the background
The certificate manager originally had a "block on startup" rotation
behavior to ensure at least one rotation happened on startup. However,
since rotation may not succeed within the first time window the code was
changed to simply print the error rather than return it. This meant that
the blocking rotation has no purpose - it cannot cause the kubelet to
fail, and it *does* block the kubelet from starting static pods before
the api server becomes available.

The current block behavior causes a bootstrapped kubelet that is also
set to run static pods to wait several minutes before actually launching
the static pods, which means self-hosted masters using static pods have
a pointless delay on startup.

Since blocking rotation has no benefit and can't actually fail startup,
this commit removes the blocking behavior and simplifies the code at the
same time. The goroutine for rotation now completely owns the deadline,
the shouldRotate() method is removed, and the method that sets
rotationDeadline now returns it. We also explicitly guard against a
negative sleep interval and omit the message.

Should have no impact on bootstrapping except the removal of a long
delay on startup before static pods start.

Also add a guard condition where if the current cert in the store is
expired, we fall back to the bootstrap cert initially (we use the
bootstrap cert to communicate with the server). This is consistent with
when we don't have a cert yet.

Kubernetes-commit: 44493de195d89ec43cc7246af921e626e0002c16
2018-01-28 14:28:28 -05:00
Jeff Grafton
fe985a55a2 Autogenerate BUILD files
Kubernetes-commit: efee0704c60a2ee3049268a41535aaee7f661f6c
2017-12-23 13:06:26 -08:00
Sergey Lanzman
302b3649ef Move regexp.MustCompile to global variable
Kubernetes-commit: 34747474659b26456c3615d9f79d014deacf505a
2017-09-04 22:56:06 +03:00
Cao Shufeng
66ea4a9362 remove duplicated import
Kubernetes-commit: 86968e44d09e713b8cd5adca5705bba7e511c033
2017-11-14 11:36:32 +08:00
Eric Chiang
134dba2dab certificate manager: reduce max backoff from 128s to 32s
Kubernetes-commit: cba8939504e303a3e8ab7f8b69be29ef78fa48cc
2017-11-08 16:24:01 -08:00
Clayton Coleman
cb1d458c41 When cert dir is relative, cert rotation builds incorrect symlinks
Symlinks relative to a working directory were being constructed to the
wrong location, leading to failure to refresh client certs.

Kubernetes-commit: 3ec453d0d000a9bd3244d9d455f715bfe64d2e6b
2017-11-02 00:34:34 -04:00
Marcin Owsiany
c80a7b8142 Fix lint warnings for useless err checks.
This check was recently added to golint.

Kubernetes-commit: 49553d4a7a5179f0cfabbdcb7d3551c21cbcb646
2017-10-17 12:52:54 +02:00
Clayton Coleman
1372839f29 Move pkg/kubelet/util/csr into client-go
Everything else it depends on was already there, and now we have a
somewhat consistent code chain.

Kubernetes-commit: 5649f9a578f4f130f61579d77d5609fbdaf82a1f
2017-10-10 20:15:03 -04:00
Clayton Coleman
f7a735a8c2 Have the certificate manager decide if the server is healthy
Prevent a Kubelet from shutting down when the server isn't responding to
us but we cannot get a new certificate. This allows a cluster to coast
if the master is unresponsive or a node is partitioned and their client
cert expires.

Kubernetes-commit: b3a11aa635022761637090f4fc8d5cb57f3f0010
2017-10-05 18:57:53 -04:00
Clayton Coleman
bb96050dfb Collapse duplicate code into pkg/util/csr
There is no reason to duplicate this code into two places.

Kubernetes-commit: c3bea24ab6242b084e7d09073c8906c778611243
2017-10-01 16:10:51 -04:00
Jeff Grafton
c92755ea3b update BUILD files
Kubernetes-commit: aee5f457dbfd70c2d15c33e392dce6a3ca710116
2017-10-12 13:52:10 -07:00
Jacob Simpson
1bb4ecc0ae Move certificate manager to client.
Kubernetes-commit: 415c4d2c3af1fadb839bf4b73c6ea16db6b8c59f
2017-03-09 16:34:55 -08:00