Commit Graph

73 Commits

Author SHA1 Message Date
Dan Winship
7605163620 Split up PreferNodeIP into legacy and non-legacy versions
Though not obvious as currently written, PreferNodeIP() has different
semantics with legacy and external cloud providers, since one kind of
node IP value never gets passed in the external cloud provider case.
Split it into two functions to make this clearer (and to prepare for
adding new external-cloud-only semantics, and to make it clearer that
some of the code can be deleted when legacy cloud providers go away).
2023-03-15 14:50:17 -04:00
TommyStarK
a00221ee50 kubelet/nodestatus: Improving test coverage
Signed-off-by: TommyStarK <thomasmilox@gmail.com>
2022-12-18 23:19:47 +01:00
David Ashpole
64af1adace
Second attempt: Plumb context to Kubelet CRI calls (#113591)
* plumb context from CRI calls through kubelet

* clean up extra timeouts

* try fixing incorrectly cancelled context
2022-11-05 06:02:13 -07:00
Antonio Ojea
9c2b333925 Revert "plumb context from CRI calls through kubelet"
This reverts commit f43b4f1b95.
2022-11-02 13:37:23 +00:00
David Ashpole
f43b4f1b95
plumb context from CRI calls through kubelet 2022-10-28 02:55:28 +00:00
Dan Winship
e23f1a68af Delete the cloud node IP annotation if it is stale
If you run "kubelet --cloud-provider X --node-ip Y", kubelet will set
an annotation on the node, but previously, if you then ran just
"kubelet --cloud-provider X" (or just "kubelet --node-ip Y"), it
wouldn't delete the stale annotation. Fix that.
2022-09-01 16:43:18 -04:00
jinxu
0064010cdd Promote Local storage capacity isolation feature to GA
This change is to promote local storage capacity isolation feature to GA

At the same time, to allow rootless system disable this feature due to
unable to get root fs, this change introduced a new kubelet config
"localStorageCapacityIsolation". By default it is set to true. For
rootless systems, they can set this configuration to false to disable
the feature. Once it is set, user cannot set ephemeral-storage
request/limit because capacity and allocatable will not be set.

Change-Id: I48a52e737c6a09e9131454db6ad31247b56c000a
2022-08-02 23:45:48 -07:00
Kubernetes Prow Robot
21149f1b68
Merge pull request #109794 from shiftstack/always_annotate_nodeip
Make kubelet set alpha.kubernetes.io/provided-node-ip unconditionally
2022-07-14 14:36:40 -07:00
Matthew Booth
0f41aaf138
Make kubelet set alpha.kubernetes.io/provided-node-ip unconditionally 2022-06-21 10:37:34 +01:00
Davanum Srinivas
50bea1dad8
Move from k8s.gcr.io to registry.k8s.io
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2022-05-31 10:16:53 -04:00
Matthew Booth
928a5db93b
cloud-provider handles kubelet's --node-ip
When using a legacy cloud provider, if kubelet is passed a node address
in --node-ip it will use this address in preference out the the
addresses by the cloud provider.

When using an external cloud provider, kubelet will annotate the Node
with the first --node-ip for use by the cloud provider. The cloud
provider validates this annotation but does not otherwise use it,
meaning that --node-ip has no effect.

This change moves the node address filtering code from kubelet to
component-helpers and updates both kubelet and cloud-provider to use it.
There is no functional change to kubelet, but cloud-provider now honours
kubelet's --node-ip.
2022-03-22 16:58:37 +00:00
Jyoti Mahapatra
0e0abd602f
parse ipv6 address before comparison (#107736)
* parse ipv6 address before comparison

Signed-off-by: Jyoti Mahapatra <jyotima@amazon.com>

* use parse sloppy

Signed-off-by: Jyoti Mahapatra <jyotima@amazon.com>

* use parse sloppy

Signed-off-by: Jyoti Mahapatra <jyotima@amazon.com>

* use node address from cloudprovider as is

Signed-off-by: Jyoti Mahapatra <jyotima@amazon.com>
2022-01-26 18:38:49 -08:00
Antonio Ojea
0cd75e8fec run hack/update-netparse-cve.sh 2021-08-20 10:42:09 +02:00
elbehery
848ae095c8 fix_change_error_to_info 2021-04-21 10:35:23 +02:00
JUN YANG
90bfd38b83 Structured Logging migration: modify node and pod part logs of kubelet.
Signed-off-by: JunYang <yang.jun22@zte.com.cn>
2021-03-13 12:31:09 +08:00
Benjamin Elder
56e092e382 hack/update-bazel.sh 2021-02-28 15:17:29 -08:00
Qi Wang
e84af0ac13 Migrate pkg/kubelet/nodestatus to structured logging
Migrate pkg/kubelet/nodestatus to structured logging

Signed-off-by: Qi Wang <qiwan@redhat.com>
2021-02-12 13:15:45 -05:00
Seth Jennings
ee60ee26e0 kubelet: remove periodic messages from log-level 2 2020-11-30 11:34:00 -06:00
David Porter
16f71c6d47 Implement shutdown manager in kubelet
Implements KEP 2000, Graceful Node Shutdown:
https://github.com/kubernetes/enhancements/tree/master/keps/sig-node/2000-graceful-node-shutdown

* Add new FeatureGate `GracefulNodeShutdown` to control
enabling/disabling the feature
* Add two new KubeletConfiguration options
  * `ShutdownGracePeriod` and `ShutdownGracePeriodCriticalPods`
* Add new package, `nodeshutdown` that implements the Node shutdown
manager
  * The node shutdown manager uses the systemd inhibit package, to
  create an system inhibitor, monitor for node shutdown events, and
  gracefully terminate pods upon a node shutdown.
2020-11-12 21:47:55 +00:00
Dan Winship
75242fce7a kubelet: allow specifying dual-stack node IPs on bare metal
Discussion is ongoing about how to best handle dual-stack with clouds
and autodetected IPs, but there is at least agreement that people on
bare metal ought to be able to specify two explicit IPs on dual-stack
hosts, so allow that.
2020-10-07 17:25:54 -04:00
Dan Winship
2680095414 kubelet: Remove unnecessary sorting in NodeAddress tests
Several of the tests in TestNodeAddress() were no-ops because the test
code was only testing that NodeAddresses() returned all of the
expected addresses, but not testing that it was returning them in the
correct order.

The order that NodeAddresses() returns addresses in is very important,
so fix the tests to actually test it.

One existing test ("NodeIP is external") had its expectedAddresses in
the wrong order, but it seems clear from the name of the test that
this isn't actually what it expected.

Also, previously testKubeletHostname was "127.0.0.1" which ended up
interacting weirdly with the IPv4-vs-IPv6 sorting code in a way that
made some of the test results confusing if you didn't realize that
testKubeletHostname was an IPv4 address. Fix that by making it an
actual hostname instead, which then preserves the expected sorting.
2020-10-07 17:25:25 -04:00
Kubernetes Prow Robot
cdbd07f64e
Merge pull request #90282 from gaurav1086/kubelet_nodestatus_remove_check
[kubelet] nodestatus: remove map nil check
2020-05-21 22:42:38 -07:00
Davanum Srinivas
07d88617e5
Run hack/update-vendor.sh
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2020-05-16 07:54:33 -04:00
Davanum Srinivas
442a69c3bd
switch over k/k to use klog v2
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2020-05-16 07:54:27 -04:00
Gaurav Singh
5ed70c66e8 [kubelet] nodestatus: remove slice nil check 2020-04-19 11:16:21 -04:00
Andrew Sy Kim
e2bc3a755f
move well-known kubelet cloud provider annotations to k8s.io/cloud-provider (#88631)
* move well-known kubelet cloud provider annotations to k8s.io/cloud-provider

Signed-off-by: andrewsykim <kim.andrewsy@gmail.com>

* cloud provider: rename AnnotationProvidedIPAddr to AnnotationAlphaProvidedIPAddr to indicate alpha status

Signed-off-by: Andrew Sy Kim <kim.andrewsy@gmail.com>
2020-03-31 23:01:27 -07:00
Haowei Cai
462b75388f let image cache do sort on write instead of on read to avoid data
race and improve efficienty
2020-03-10 15:33:34 -07:00
Dan Winship
ce68edf700 Allow "kubelet --node-ip ::" to mean prefer IPv6 2020-01-07 07:53:21 -05:00
Kubernetes Prow Robot
0599ca2bcf
Merge pull request #81594 from jfbai/remove-duplicated-log
Remove duplicated log.
2019-10-11 19:38:38 -07: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
David Zhu
f15cc60957 Update golang scientific notation using hack/update-gofmt.sh 2019-09-12 18:05:49 -07:00
Jianfei Bai
aa173c834f Remove duplicated log. 2019-08-23 10:09:24 +08:00
Kubernetes Prow Robot
a3488b4cee
Merge pull request #81206 from tallclair/staticcheck-kubelet-push
Cleanup Kubelet static analysis issues
2019-08-22 15:09:43 -07:00
Kubernetes Prow Robot
6b47754740
Merge pull request #81627 from tallclair/copy
Delete duplicate resource.Quantity.Copy()
2019-08-22 11:13:13 -07:00
Kubernetes Prow Robot
ebf15029da
Merge pull request #80003 from wongma7/cloudprovider-authoritative-hostname
Fix cloud reported hostname being overridden if nodeIP set
2019-08-21 20:50:32 -07:00
Matthew Wong
fc28045220 Fix cloud reported hostname being overridden if nodeIP set 2019-08-21 19:07:12 -07:00
Tim Allclair
8a495cb5e4 Clean up error messages (ST1005) 2019-08-21 10:40:21 -07:00
Tim Allclair
49f50484b8 Delete duplicate resource.Quantity.Copy() 2019-08-19 17:23:14 -07:00
Kubernetes Prow Robot
e8559f7565
Merge pull request #75229 from andrewsykim/kubelet-node-address-external
kubelet: lookup node address for external provider if none is set
2019-08-01 08:16:16 -07:00
Pingan2017
e94d7b3802 clean up redundant conditiontype OutOfDisk 2019-07-03 14:34:52 +08:00
Andrew Sy Kim
0d8861114d kubelet: lookup node address for external provider if none is set
Signed-off-by: Andrew Sy Kim <kiman@vmware.com>
2019-05-17 11:06:38 -04:00
Mike Crute
7d62316f8f Migrate fake cloud provider to staging 2019-05-14 13:32:18 -07:00
David Zhu
34d9ee5b9b Add CSINode initialization for CSIMigration on node startup before pod ready 2019-03-07 14:47:38 -08:00
Kubernetes Prow Robot
cb09d4d317
Merge pull request #72507 from dixudx/remove_stale_OutOfDisk
remove stale OutOfDisk condition from kubelet side
2019-01-18 19:14:04 -08:00
Kubernetes Prow Robot
56e88f5b47
Merge pull request #70805 from danwinship/cloud-node-ip
Fix a CloudProvider-vs-nodeIP edge case
2019-01-16 09:04:54 -08:00
Kubernetes Prow Robot
68909b5683
Merge pull request #70784 from gaorong/typo-fix
fix some typos
2019-01-10 17:08:43 -08:00
Kubernetes Prow Robot
a1e46a9d43
Merge pull request #71560 from appvia/hostname-change-noop
Don't log a warning to override hostname if there's no change.
2019-01-08 13:41:42 -08:00
gaorong
545aca3d18 fix some typos 2019-01-08 12:46:05 +08:00
Di Xu
e1a854b839 remove stale OutOfDisk condition from kubelet side 2019-01-06 21:37:52 +08:00
k8s-ci-robot
af6bf1e436
Merge pull request #70645 from changyaowei/node_ephemeral-storage
Fix bug: when kubelet restart, the ephemeral-storage in node status upgrade to 0
2018-11-29 21:44:53 -08:00