Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #149 from elmiko/DeleteNodes-mutex
Bug 1823667: UPSTREAM: <carry>: Add mutex to DeleteNodes
  • Loading branch information
openshift-merge-robot committed May 21, 2020
2 parents 8e5c58a + 9e22789 commit 9ac8ed2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Expand Up @@ -21,6 +21,7 @@ import (
"fmt"
"os"
"strings"
"sync"

corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -62,6 +63,7 @@ type machineController struct {
machineSetResource *schema.GroupVersionResource
machineResource *schema.GroupVersionResource
machineDeploymentResource *schema.GroupVersionResource
accessLock sync.Mutex
}

type machineSetFilterFunc func(machineSet *MachineSet) error
Expand Down
Expand Up @@ -101,6 +101,9 @@ func (ng *nodegroup) IncreaseSize(delta int) error {
// group. This function should wait until node group size is updated.
// Implementation required.
func (ng *nodegroup) DeleteNodes(nodes []*corev1.Node) error {
ng.machineController.accessLock.Lock()
defer ng.machineController.accessLock.Unlock()

replicas, err := ng.scalableResource.Replicas()
if err != nil {
return err
Expand Down

0 comments on commit 9ac8ed2

Please sign in to comment.