mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-23 07:21:14 +02:00
app-admin/kubelet: force NodeReady condition to be last on existing nodes
This commit is contained in:
parent
3b836bc05d
commit
abc79bc5eb
@ -1,7 +1,7 @@
|
||||
From 0180f019c7575a5cfe8344ecab14e9c3da883ac7 Mon Sep 17 00:00:00 2001
|
||||
From 6195a477686ce589f0568d9f0e6e44e7a9e146e3 Mon Sep 17 00:00:00 2001
|
||||
From: Aaron Levy <aaron.levy@coreos.com>
|
||||
Date: Tue, 17 Nov 2015 13:05:53 -0800
|
||||
Subject: [PATCH 1/3] kubelet: report NodeReady last in status list
|
||||
Subject: [PATCH 1/4] kubelet: report NodeReady last in status list
|
||||
|
||||
Addresses a version skew issue where the last condition status is always
|
||||
evaluated as the NodeReady status. As a workaround force the NodeReady
|
||||
|
@ -1,7 +1,7 @@
|
||||
From 1fdd876287ed3454df939d15602d6f8037ff3156 Mon Sep 17 00:00:00 2001
|
||||
From 48d7f5314be4903c6ffc2fb4be542d61b7241b8b Mon Sep 17 00:00:00 2001
|
||||
From: Aaron Levy <aaron.levy@coreos.com>
|
||||
Date: Thu, 19 Nov 2015 19:06:39 -0800
|
||||
Subject: [PATCH 2/3] explicitly check "Ready" condition in validate-cluster
|
||||
Subject: [PATCH 2/4] explicitly check "Ready" condition in validate-cluster
|
||||
|
||||
---
|
||||
cluster/validate-cluster.sh | 2 +-
|
||||
|
@ -1,7 +1,7 @@
|
||||
From 26728c3a424fcd6ac3a3c23963bab3beac388ae6 Mon Sep 17 00:00:00 2001
|
||||
From 2b2afd9fe6501150e2da0341fc8725260a42c74f Mon Sep 17 00:00:00 2001
|
||||
From: Aaron Levy <aaron.levy@coreos.com>
|
||||
Date: Mon, 30 Nov 2015 19:02:12 -0800
|
||||
Subject: [PATCH 3/3] kubelet: check node condition by type rather than by
|
||||
Subject: [PATCH 3/4] kubelet: check node condition by type rather than by
|
||||
index
|
||||
|
||||
---
|
||||
|
@ -0,0 +1,75 @@
|
||||
From aaa856a8d73fc36f9b458498fdbde8445f99dd7b Mon Sep 17 00:00:00 2001
|
||||
From: Aaron Levy <aaron.levy@coreos.com>
|
||||
Date: Tue, 8 Dec 2015 14:36:49 -0800
|
||||
Subject: [PATCH 4/4] pkg/kubelet: force NodeReady condition to be last on
|
||||
existing nodes
|
||||
|
||||
---
|
||||
pkg/kubelet/kubelet.go | 14 +++++++++++---
|
||||
pkg/kubelet/kubelet_test.go | 12 ++++++------
|
||||
2 files changed, 17 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/pkg/kubelet/kubelet.go b/pkg/kubelet/kubelet.go
|
||||
index df83ce4..6928563 100644
|
||||
--- a/pkg/kubelet/kubelet.go
|
||||
+++ b/pkg/kubelet/kubelet.go
|
||||
@@ -2495,9 +2495,6 @@ func (kl *Kubelet) setNodeStatus(node *api.Node) error {
|
||||
node.Status.Conditions = append(node.Status.Conditions, *nodeOODCondition)
|
||||
}
|
||||
|
||||
- // NOTE(aaronlevy): NodeReady condition needs to be the last in the list of node conditions.
|
||||
- // This is due to an issue with version skewed kubelet and master components.
|
||||
- // ref: https://github.com/kubernetes/kubernetes/issues/16961
|
||||
var newNodeReadyCondition api.NodeCondition
|
||||
var oldNodeReadyConditionStatus api.ConditionStatus
|
||||
if containerRuntimeUp && networkConfigured && containerRuntimeVersionRequirementMet {
|
||||
@@ -2562,6 +2559,17 @@ func (kl *Kubelet) setNodeStatus(node *api.Node) error {
|
||||
}
|
||||
oldNodeUnschedulable = node.Spec.Unschedulable
|
||||
}
|
||||
+
|
||||
+ // NOTE(aaronlevy): NodeReady condition needs to be the last in the list of node conditions.
|
||||
+ // This is due to an issue with version skewed kubelet and master components.
|
||||
+ // ref: https://github.com/kubernetes/kubernetes/issues/16961
|
||||
+ lastIndex := len(node.Status.Conditions) - 1
|
||||
+ for i := range node.Status.Conditions {
|
||||
+ if node.Status.Conditions[i].Type == api.NodeReady && i < lastIndex {
|
||||
+ node.Status.Conditions[i], node.Status.Conditions[lastIndex] = node.Status.Conditions[lastIndex], node.Status.Conditions[i]
|
||||
+ break
|
||||
+ }
|
||||
+ }
|
||||
return nil
|
||||
}
|
||||
|
||||
diff --git a/pkg/kubelet/kubelet_test.go b/pkg/kubelet/kubelet_test.go
|
||||
index 7777814..30081a7 100644
|
||||
--- a/pkg/kubelet/kubelet_test.go
|
||||
+++ b/pkg/kubelet/kubelet_test.go
|
||||
@@ -2789,18 +2789,18 @@ func TestUpdateExistingNodeStatus(t *testing.T) {
|
||||
Status: api.NodeStatus{
|
||||
Conditions: []api.NodeCondition{
|
||||
{
|
||||
- Type: api.NodeOutOfDisk,
|
||||
+ Type: api.NodeReady,
|
||||
Status: api.ConditionTrue,
|
||||
- Reason: "KubeletOutOfDisk",
|
||||
- Message: "out of disk space",
|
||||
+ Reason: "KubeletReady",
|
||||
+ Message: fmt.Sprintf("kubelet is posting ready status"),
|
||||
LastHeartbeatTime: unversioned.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||
LastTransitionTime: unversioned.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||
},
|
||||
{
|
||||
- Type: api.NodeReady,
|
||||
+ Type: api.NodeOutOfDisk,
|
||||
Status: api.ConditionTrue,
|
||||
- Reason: "KubeletReady",
|
||||
- Message: fmt.Sprintf("kubelet is posting ready status"),
|
||||
+ Reason: "KubeletOutOfDisk",
|
||||
+ Message: "out of disk space",
|
||||
LastHeartbeatTime: unversioned.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||
LastTransitionTime: unversioned.Date(2012, 1, 1, 0, 0, 0, 0, time.UTC),
|
||||
},
|
||||
--
|
||||
2.3.8 (Apple Git-58)
|
||||
|
@ -25,6 +25,7 @@ src_prepare() {
|
||||
epatch "${FILESDIR}/0001-kubelet-report-NodeReady-last-in-status-list.patch"
|
||||
epatch "${FILESDIR}/0002-explicitly-check-Ready-condition-in-validate-cluster.patch"
|
||||
epatch "${FILESDIR}/0003-kubelet-check-node-condition-by-type-rather-than-by-.patch"
|
||||
epatch "${FILESDIR}/0004-pkg-kubelet-force-NodeReady-condition-to-be-last-on-.patch"
|
||||
|
||||
if gcc-specs-pie; then
|
||||
append-ldflags -nopie
|
Loading…
x
Reference in New Issue
Block a user