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 Jan 29, 2019
1 parent 72fd7f4 commit 24b8d0c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 10 additions & 2 deletions cmd/machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,12 +323,20 @@ func newProvisionedMachineAndMachine(name string, role clustercommon.MachineRole
CreationTimestamp: metav1.Now(),
},
Spec: clusterv1.MachineSpec{
Roles: []clustercommon.MachineRole{role},
Taints: []corev1.Taint{},
Roles: []clustercommon.MachineRole{role},
},
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 @@ -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 (
Expand Down

0 comments on commit 24b8d0c

Please sign in to comment.