From a742c33f58cfb20533915c31232d913b4f49bede Mon Sep 17 00:00:00 2001 From: Daniel Lipovetsky Date: Wed, 23 Jan 2019 17:33:53 -0800 Subject: [PATCH] Taint masters with PreferNoSchedule Workaround for https://github.com/platform9/ssh-provider/issues/63 --- cmd/machine.go | 9 +++++++-- common/constants.go | 2 ++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/cmd/machine.go b/cmd/machine.go index 92b5d46..a6f21b4 100644 --- a/cmd/machine.go +++ b/cmd/machine.go @@ -300,8 +300,13 @@ func newProvisionedMachineAndMachine(name string, role clustercommon.MachineRole CreationTimestamp: metav1.Now(), }, Spec: clusterv1.MachineSpec{ - Roles: []clustercommon.MachineRole{role}, - Taints: []corev1.Taint{}, + Roles: []clustercommon.MachineRole{role}, + Taints: []corev1.Taint{ + { + Key: common.LabelNodeRoleMaster, + Effect: corev1.TaintEffectPreferNoSchedule, + }, + }, }, Status: clusterv1.MachineStatus{}, } diff --git a/common/constants.go b/common/constants.go index 454330a..82238b2 100644 --- a/common/constants.go +++ b/common/constants.go @@ -66,6 +66,8 @@ Machine IP Creation Timestamp Role {{ range $machine := .}}{{ $machine.ObjectMeta.Name }} {{ $machine.ObjectMeta.CreationTimestamp }} {{ $machine.Spec.Roles }} {{ end }} ` + // LabelNodeRoleMaster specifies that a node is a master + LabelNodeRoleMaster = "node-role.kubernetes.io/master" ) var (