Skip to content

Commit

Permalink
address some feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
fabriziopandini committed Dec 11, 2018
1 parent 488ad6d commit be5009e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
19 changes: 10 additions & 9 deletions pkg/cluster/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ type Task struct {
// task should be executed
TargetNodes NodeSelector
// Run the func that implements the task action
Run func(ec *execContext, configNode *config.Node) error
Run func(*execContext, *config.Node) error
}

// NodeSelector defines a function returning a subset of nodes where tasks
Expand Down Expand Up @@ -151,12 +151,6 @@ func (t ExecutionPlan) Less(i, j int) bool {
return t[i].ExecutionOrder() < t[j].ExecutionOrder()
}

// Swap two elements of the ExecutionPlan.
// It is required for making ExecutionPlan sortable.
func (t ExecutionPlan) Swap(i, j int) {
t[i], t[j] = t[j], t[i]
}

// ExecutionOrder returns a string that can be used for sorting planned tasks
// into a predictable, "kubeadm friendly" and consistent order.
// NB. we are using a string to combine all the item considered into something
Expand All @@ -168,16 +162,23 @@ func (p *PlannedTask) ExecutionOrder() string {
// plane, then complete provisioning of secondary control planes, and
// finally provision worker nodes.
p.Node.ProvisioningOrder(),
// Node name is considered in order to get a predictable/repeatable ordering
// in case of many nodes with the same ProvisioningOrder
p.Node.Name,

// When planning task for one machine, the given order of actions will
// If both the two criteria above are equal, the given order of actions will
// be respected and, for each action, the predefined order of tasks
// will be used
p.actionIndex,
p.taskIndex,
)
}

// Swap two elements of the ExecutionPlan.
// It is required for making ExecutionPlan sortable.
func (t ExecutionPlan) Swap(i, j int) {
t[i], t[j] = t[j], t[i]
}

// SelectAllNodes is a NodeSelector that returns all the nodes defined in
// the `kind` Config
func SelectAllNodes(cfg *config.Config) config.NodeList {
Expand Down
2 changes: 1 addition & 1 deletion pkg/cluster/nodes/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func createNode(name, image, clusterLabel string, extraArgs ...string) (handle *
return handle, errors.Wrap(err, "docker run error")
}

// Deletes the machine-id embedded in the node imaga and regenerate a new one.
// Deletes the machine-id embedded in the node image and regenerate a new one.
// This is necessary because both kubelet and other components like weave net
// use machine-id internally to distinguish nodes.
if err := handle.Command("rm", "-f", "/etc/machine-id").Run(); err != nil {
Expand Down

0 comments on commit be5009e

Please sign in to comment.