Skip to content

Commit

Permalink
Fix timeouts for StatefulSet, Deployment, and DaemonSet (#1902)
Browse files Browse the repository at this point in the history
* Fix timeouts for StatefulSet, Deployment, and DaemonSet
  • Loading branch information
arybolovlev authored Nov 18, 2022
1 parent 2f50988 commit ae57b1b
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .changelog/1902.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
Fix an issue with timeouts for `StatefulSet`, `Deployment`, and `DaemonSet` resources when in some cases changes of `Update` or `Create` timeout doesn't affect related actions.
```
2 changes: 1 addition & 1 deletion kubernetes/resource_kubernetes_daemonset.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ func resourceKubernetesDaemonSetCreate(ctx context.Context, d *schema.ResourceDa
}

if d.Get("wait_for_rollout").(bool) {
err = resource.RetryContext(ctx, d.Timeout(schema.TimeoutUpdate),
err = resource.RetryContext(ctx, d.Timeout(schema.TimeoutCreate),
waitForDaemonSetReplicasFunc(ctx, conn, metadata.Namespace, metadata.Name))
if err != nil {
return diag.FromErr(err)
Expand Down
2 changes: 1 addition & 1 deletion kubernetes/resource_kubernetes_deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ func resourceKubernetesDeploymentUpdate(ctx context.Context, d *schema.ResourceD

if d.Get("wait_for_rollout").(bool) {
log.Printf("[INFO] Waiting for deployment %s/%s to rollout", out.ObjectMeta.Namespace, out.ObjectMeta.Name)
err := resource.RetryContext(ctx, d.Timeout(schema.TimeoutCreate),
err := resource.RetryContext(ctx, d.Timeout(schema.TimeoutUpdate),
waitForDeploymentReplicasFunc(ctx, conn, out.GetNamespace(), out.GetName()))
if err != nil {
return diag.FromErr(err)
Expand Down
2 changes: 1 addition & 1 deletion kubernetes/resource_kubernetes_stateful_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ func resourceKubernetesStatefulSetUpdate(ctx context.Context, d *schema.Resource

if d.Get("wait_for_rollout").(bool) {
log.Printf("[INFO] Waiting for StatefulSet %s to rollout", d.Id())
err = resource.RetryContext(ctx, d.Timeout(schema.TimeoutCreate),
err = resource.RetryContext(ctx, d.Timeout(schema.TimeoutUpdate),
retryUntilStatefulSetRolloutComplete(ctx, conn, namespace, name))
if err != nil {
return diag.FromErr(err)
Expand Down

0 comments on commit ae57b1b

Please sign in to comment.