Skip to content

Commit

Permalink
Uses patch instead of update to mark nodes (un)schedulable
Browse files Browse the repository at this point in the history
  • Loading branch information
fabianofranz committed Jan 13, 2017
1 parent 398ca1a commit 7ab32ff
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/cmd/admin/node/schedulable.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package node

import (
"fmt"

"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/kubectl"
kerrors "k8s.io/kubernetes/pkg/util/errors"
)
Expand All @@ -22,8 +25,8 @@ func (s *SchedulableOptions) Run() error {
unschedulable := !s.Schedulable
for _, node := range nodes {
if node.Spec.Unschedulable != unschedulable {
node.Spec.Unschedulable = unschedulable
node, err = s.Options.KubeClient.Core().Nodes().Update(node)
patch := fmt.Sprintf(`{"spec":{"unschedulable":%t}}`, unschedulable)
node, err = s.Options.KubeClient.Core().Nodes().Patch(node.Name, api.MergePatchType, []byte(patch))
if err != nil {
errList = append(errList, err)
continue
Expand Down

0 comments on commit 7ab32ff

Please sign in to comment.