From 7d62300e2fd15a700e272309165e0b14b11aa208 Mon Sep 17 00:00:00 2001 From: paulfantom Date: Wed, 31 Oct 2018 15:03:53 +0100 Subject: [PATCH] run dep ensure to update test framework --- .../pkg/controller/machineset/controller.go | 37 ++----------------- 1 file changed, 3 insertions(+), 34 deletions(-) diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/controller/machineset/controller.go b/vendor/sigs.k8s.io/cluster-api/pkg/controller/machineset/controller.go index 773b6cbe1e..2bf2e165d1 100644 --- a/vendor/sigs.k8s.io/cluster-api/pkg/controller/machineset/controller.go +++ b/vendor/sigs.k8s.io/cluster-api/pkg/controller/machineset/controller.go @@ -19,7 +19,6 @@ package machineset import ( "context" "fmt" - "sort" "strings" "sync" "time" @@ -47,9 +46,6 @@ var stateConfirmationTimeout = 10 * time.Second // The polling is against a local memory cache. var stateConfirmationInterval = 100 * time.Millisecond -// machineDeleteAnnotationKey annotates machines to be delete among first ones -var machineDeleteAnnotationKey = "sigs.k8s.io/cluster-api-delete-machine" - // Add creates a new MachineSet Controller and adds it to the Manager with default RBAC. The Manager will set fields on the Controller // and Start it when the Manager is Started. func Add(mgr manager.Manager) error { @@ -162,8 +158,7 @@ func (r *ReconcileMachineSet) Reconcile(request reconcile.Request) (reconcile.Re } // Filter out irrelevant machines (deleting/mismatch labels) and claim orphaned machines. - var machineNames []string - machineSetMachines := make(map[string]*clusterv1alpha1.Machine) + var filteredMachines []*clusterv1alpha1.Machine for idx := range allMachines.Items { machine := &allMachines.Items[idx] if shouldExcludeMachine(machineSet, machine) { @@ -176,16 +171,7 @@ func (r *ReconcileMachineSet) Reconcile(request reconcile.Request) (reconcile.Re continue } } - machineNames = append(machineNames, machine.Name) - machineSetMachines[machine.Name] = machine - } - - // sort the filteredMachines from the oldest to the youngest - sort.Strings(machineNames) - - var filteredMachines []*clusterv1alpha1.Machine - for _, machineName := range machineNames { - filteredMachines = append(filteredMachines, machineSetMachines[machineName]) + filteredMachines = append(filteredMachines, machine) } syncErr := r.syncReplicas(machineSet, filteredMachines) @@ -341,24 +327,7 @@ func (c *ReconcileMachineSet) adoptOrphan(machineSet *clusterv1alpha1.MachineSet func getMachinesToDelete(filteredMachines []*clusterv1alpha1.Machine, diff int) []*clusterv1alpha1.Machine { // TODO: Define machines deletion policies. // see: https://github.com/kubernetes/kube-deploy/issues/625 - - // First delete all machines with sigs.k8s.io/cluster-api-delete-machine annotation - var machinesToDelete []*clusterv1alpha1.Machine - var remainingMachines []*clusterv1alpha1.Machine - for _, machine := range filteredMachines { - if _, delete := machine.Annotations[machineDeleteAnnotationKey]; delete { - machinesToDelete = append(machinesToDelete, machine) - } else { - remainingMachines = append(remainingMachines, machine) - } - } - - machinesToDeleteLen := len(machinesToDelete) - if machinesToDeleteLen >= diff { - return machinesToDelete[:diff] - } - - return append(machinesToDelete, remainingMachines[:(diff-machinesToDeleteLen)]...) + return filteredMachines[:diff] } func (c *ReconcileMachineSet) waitForMachineCreation(machineList []*clusterv1alpha1.Machine) error {