Skip to content

Commit

Permalink
Taint masters with PreferNoSchedule
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Lipovetsky committed Feb 11, 2019
1 parent 7e682d5 commit b3201e9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cmd/machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,15 @@ func newProvisionedMachineAndMachine(name string, role clustercommon.MachineRole
Status: clusterv1.MachineStatus{},
}

if role == clustercommon.MasterRole {
newMachine.Spec.Taints = []corev1.Taint{
{
Key: common.LabelNodeRoleMaster,
Effect: corev1.TaintEffectPreferNoSchedule,
},
}
}

machineProviderSpec := spv1.MachineSpec{
TypeMeta: metav1.TypeMeta{
APIVersion: "sshprovider.platform9.com/v1alpha1",
Expand Down
2 changes: 2 additions & 0 deletions common/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,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 (
Expand Down

0 comments on commit b3201e9

Please sign in to comment.