Skip to content

Commit

Permalink
fetched the deployment before updating to prevent a Operation cannot …
Browse files Browse the repository at this point in the history
…be fulfilled error occuring
  • Loading branch information
drew-viles authored Jan 9, 2024
1 parent d8e8e24 commit 70d4724
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions pkg/testsuite/autoscaling.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,16 @@ func (c *ScalingTest) Run() error {
log.Printf("Running Test: %s\n", c.Test.Name)
log.Printf("Node count before Scale %v\n", c.StartingNodes)

// Increase the replicas
c.Deployment.Deployment.Spec.Replicas = helpers.IntPtr(c.TargetReplicas)

re := retry.RetryOnConflict(retry.DefaultRetry, func() error {
d, err := c.Deployment.Update(context.Background(), c.Deployment.Deployment, metav1.UpdateOptions{})
deploy, err := c.Deployment.Get()
if err != nil {
return err
}

// Increase the replicas
deploy.Spec.Replicas = helpers.IntPtr(c.TargetReplicas)

d, err := c.Deployment.Update(context.Background(), deploy, metav1.UpdateOptions{})
if err != nil {
return err
}
Expand Down

0 comments on commit 70d4724

Please sign in to comment.