Skip to content

Instantly share code, notes, and snippets.

@fabriziopandini
Created December 11, 2018 08:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fabriziopandini/e544842b8c38c90974b215167a77d934 to your computer and use it in GitHub Desktop.
Save fabriziopandini/e544842b8c38c90974b215167a77d934 to your computer and use it in GitHub Desktop.
Task ordering
func (t ExecutionPlan) Less(i, j int) bool {
return false ||
// Then PlannedTask are grouped by machines, respecting the kubeadm node
// ProvisioningOrder: first complete provisioning on bootstrap control
// plane, then complete provisioning of secondary control planes, and
// finally provision worker nodes.
t[i].Node.ProvisioningOrder() < t[j].Node.ProvisioningOrder() ||
// Node name is considered in order to get a predictable/repeatable ordering
// in case of many nodes with the same ProvisioningOrder
(t[i].Node.ProvisioningOrder() == t[j].Node.ProvisioningOrder() &&
t[i].Node.Name < t[j].Node.Name) ||
// Then, when planning task for one node, the given order of actions will
// be respected
(t[i].Node.ProvisioningOrder() == t[j].Node.ProvisioningOrder() &&
t[i].Node.Name == t[j].Node.Name &&
t[i].actionIndex < t[j].actionIndex) ||
// and finally, for each action, the predefined order of tasks will be used
(t[i].Node.ProvisioningOrder() == t[j].Node.ProvisioningOrder() &&
t[i].Node.Name == t[j].Node.Name &&
t[i].actionIndex == t[j].actionIndex &&
t[i].taskIndex < t[j].taskIndex)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment