@@ -937,8 +937,8 @@ func FindOldMachineSets(deployment *v1alpha1.MachineDeployment, isList []*v1alph
937937}
938938
939939// WaitForMachineSetUpdated polls the machine set until it is updated.
940- func WaitForMachineSetUpdated (c v1alpha1listers.MachineSetLister , desiredGeneration int64 , namespace , name string ) error {
941- return wait .PollImmediate ( 1 * time .Second , 1 * time .Minute , func () (bool , error ) {
940+ func WaitForMachineSetUpdated (ctx context. Context , c v1alpha1listers.MachineSetLister , desiredGeneration int64 , namespace , name string ) error {
941+ return wait .PollUntilContextTimeout ( ctx , 1 * time .Second , 1 * time .Minute , true , func (ctx context. Context ) (bool , error ) {
942942 is , err := c .MachineSets (namespace ).Get (name )
943943 if err != nil {
944944 return false , err
@@ -948,8 +948,8 @@ func WaitForMachineSetUpdated(c v1alpha1listers.MachineSetLister, desiredGenerat
948948}
949949
950950// WaitForMachinesHashPopulated polls the machine set until updated and fully labeled.
951- func WaitForMachinesHashPopulated (c v1alpha1listers.MachineSetLister , desiredGeneration int64 , namespace , name string ) error {
952- return wait .PollImmediate ( 1 * time .Second , 1 * time .Minute , func () (bool , error ) {
951+ func WaitForMachinesHashPopulated (ctx context. Context , c v1alpha1listers.MachineSetLister , desiredGeneration int64 , namespace , name string ) error {
952+ return wait .PollUntilContextTimeout ( ctx , 1 * time .Second , 1 * time .Minute , true , func (ctx context. Context ) (bool , error ) {
953953 is , err := c .MachineSets (namespace ).Get (name )
954954 if err != nil {
955955 return false , err
@@ -1206,7 +1206,7 @@ func IsSaturated(deployment *v1alpha1.MachineDeployment, is *v1alpha1.MachineSet
12061206// Returns error if polling timesout.
12071207func WaitForObservedMachineDeployment (getDeploymentFunc func () (* v1alpha1.MachineDeployment , error ), desiredGeneration int64 , interval , timeout time.Duration ) error {
12081208 // TODO: This should take clientset.Interface when all code is updated to use clientset. Keeping it this way allows the function to be used by callers who have client.Interface.
1209- return wait .PollImmediate ( interval , timeout , func () (bool , error ) {
1209+ return wait .PollUntilContextTimeout ( context . Background (), interval , timeout , true , func (ctx context. Context ) (bool , error ) {
12101210 deployment , err := getDeploymentFunc ()
12111211 if err != nil {
12121212 return false , err
@@ -1219,7 +1219,7 @@ func WaitForObservedMachineDeployment(getDeploymentFunc func() (*v1alpha1.Machin
12191219// Returns error if polling timesout.
12201220// TODO: remove the duplicate
12211221func WaitForObservedDeploymentInternal (getDeploymentFunc func () (* v1alpha1.MachineDeployment , error ), desiredGeneration int64 , interval , timeout time.Duration ) error {
1222- return wait .Poll ( interval , timeout , func () (bool , error ) {
1222+ return wait .PollUntilContextTimeout ( context . Background (), interval , timeout , false , func (ctx context. Context ) (bool , error ) {
12231223 deployment , err := getDeploymentFunc ()
12241224 if err != nil {
12251225 return false , err
0 commit comments