Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
8dbbf3da
Commit
8dbbf3da
authored
Apr 22, 2015
by
Brian Grant
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7138 from pravisankar/unschedulable-event
Record an event on node schedulable changes
parents
ae3c83f8
f1d88f6d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
0 deletions
+23
-0
kubelet.go
pkg/kubelet/kubelet.go
+23
-0
No files found.
pkg/kubelet/kubelet.go
View file @
8dbbf3da
...
...
@@ -1769,6 +1769,21 @@ func (kl *Kubelet) recordNodeOnlineEvent() {
kl
.
recorder
.
Eventf
(
kl
.
nodeRef
,
"online"
,
"Node %s is now online"
,
kl
.
hostname
)
}
func
(
kl
*
Kubelet
)
recordNodeSchedulableEvent
()
{
// TODO: This requires a transaction, either both node status is updated
// and event is recorded or neither should happen, see issue #6055.
kl
.
recorder
.
Eventf
(
kl
.
nodeRef
,
"schedulable"
,
"Node %s is now schedulable"
,
kl
.
hostname
)
}
func
(
kl
*
Kubelet
)
recordNodeUnschedulableEvent
()
{
// TODO: This requires a transaction, either both node status is updated
// and event is recorded or neither should happen, see issue #6055.
kl
.
recorder
.
Eventf
(
kl
.
nodeRef
,
"unschedulable"
,
"Node %s is now unschedulable"
,
kl
.
hostname
)
}
// Maintains Node.Spec.Unschedulable value from previous run of tryUpdateNodeStatus()
var
oldNodeUnschedulable
bool
// tryUpdateNodeStatus tries to update node status to master.
func
(
kl
*
Kubelet
)
tryUpdateNodeStatus
()
error
{
node
,
err
:=
kl
.
kubeClient
.
Nodes
()
.
Get
(
kl
.
hostname
)
...
...
@@ -1835,6 +1850,14 @@ func (kl *Kubelet) tryUpdateNodeStatus() error {
kl
.
recordNodeOnlineEvent
()
}
if
oldNodeUnschedulable
!=
node
.
Spec
.
Unschedulable
{
if
node
.
Spec
.
Unschedulable
{
kl
.
recordNodeUnschedulableEvent
()
}
else
{
kl
.
recordNodeSchedulableEvent
()
}
oldNodeUnschedulable
=
node
.
Spec
.
Unschedulable
}
_
,
err
=
kl
.
kubeClient
.
Nodes
()
.
UpdateStatus
(
node
)
return
err
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment