Skip to content
This repository has been archived by the owner on Sep 18, 2020. It is now read-only.

Commit

Permalink
pkg/agent: Omit log statement if annotation does not exist. Only set …
Browse files Browse the repository at this point in the history
…annotation if agent made node schedulable.
  • Loading branch information
hankjacobs committed Jun 13, 2018
1 parent 620da75 commit f1c65d4
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions pkg/agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,9 @@ func (k *Klocksmith) process(stop <-chan struct{}) error {
}

// Only make a node schedulable if a reboot was in progress. This prevents a node from being made schedulable
// if it was made unschedulable by something other thin the agent
makeSchedulable := node.Annotations[constants.AnnotationAgentMadeUnschedulable] == constants.True
// if it was made unschedulable by something other than the agent
madeUnschedulableAnnotation, madeUnschedulableAnnotationExists := node.Annotations[constants.AnnotationAgentMadeUnschedulable]
makeSchedulable := madeUnschedulableAnnotation == constants.True

// set coreos.com/update1/reboot-in-progress=false and
// coreos.com/update1/reboot-needed=false
Expand Down Expand Up @@ -122,17 +123,17 @@ func (k *Klocksmith) process(stop <-chan struct{}) error {
if err := k8sutil.Unschedulable(k.nc, k.node, false); err != nil {
return err
}
} else {
glog.Info("Skipping marking node as schedulable -- node was marked unschedulable by an external source")
}

anno = map[string]string{
constants.AnnotationAgentMadeUnschedulable: constants.False,
}
anno = map[string]string{
constants.AnnotationAgentMadeUnschedulable: constants.False,
}

glog.Infof("Setting annotations %#v", anno)
if err := k8sutil.SetNodeAnnotations(k.nc, k.node, anno); err != nil {
return err
glog.Infof("Setting annotations %#v", anno)
if err := k8sutil.SetNodeAnnotations(k.nc, k.node, anno); err != nil {
return err
}
} else if madeUnschedulableAnnotationExists { // Annotation exists so node was marked unschedulable by external source
glog.Info("Skipping marking node as schedulable -- node was marked unschedulable by an external source")
}

// watch update engine for status updates
Expand Down

0 comments on commit f1c65d4

Please sign in to comment.