Skip to content

Commit

Permalink
Replacement has incorrect status messages (#2810)
Browse files Browse the repository at this point in the history
<!--Thanks for your contribution. See [CONTRIBUTING](CONTRIBUTING.md)
    for Pulumi's contribution guidelines.

    Help us merge your changes more quickly by adding more details such
    as labels, milestones, and reviewers.-->

### Proposed changes

This PR clears the resource status after the awaiter completes, to
ensure that the status pertaining to a replacement resource (which would
have the same URN) isn't stale.

### Related issues (optional)

<!--Refer to related PRs or issues: #1234, or 'Fixes #1234' or 'Closes
#1234'.
Or link to full URLs to issues or pull requests in other GitHub
repositories. -->
Closes #2761
  • Loading branch information
EronWright authored Feb 2, 2024
1 parent 4a5bfcc commit ef6b07b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## Unreleased

- Fix DiffConfig issue when when provider's kubeconfig is set to file path (https://github.com/pulumi/pulumi-kubernetes/pull/2771)
- Fix for replacement having incorrect status messages (https://github.com/pulumi/pulumi-kubernetes/pull/2810)

## 4.7.1 (January 17, 2024)

Expand Down
15 changes: 11 additions & 4 deletions provider/pkg/await/await.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ func Creation(c CreateConfig) (*unstructured.Unstructured, error) {
if waitErr != nil {
return nil, waitErr
}
_ = clearStatus(c.Context, c.Host, c.URN)
}
}
} else {
Expand Down Expand Up @@ -333,13 +334,14 @@ func Read(c ReadConfig) (*unstructured.Unstructured, error) {
if waitErr != nil {
return nil, waitErr
}
_ = clearStatus(c.Context, c.Host, c.URN)
}
}
} else {
logger.V(1).Infof(
"No read logic found for object of type %q; falling back to retrieving object", id)
}

logger.V(1).Infof(
"No read logic found for object of type %q; falling back to retrieving object", id)

// If the client fails to get the live object for some reason, DO NOT return the error. This
// will leak the fact that the object was successfully created. Instead, fall back to the
// last-seen live object.
Expand Down Expand Up @@ -415,6 +417,7 @@ func Update(c UpdateConfig) (*unstructured.Unstructured, error) {
if waitErr != nil {
return nil, waitErr
}
_ = clearStatus(c.Context, c.Host, c.URN)
}
}
} else {
Expand Down Expand Up @@ -773,6 +776,10 @@ func Deletion(c DeleteConfig) error {
},
clientForResource: client,
})
if waitErr != nil {
return waitErr
}
_ = clearStatus(c.Context, c.Host, c.URN)
}
} else {
for {
Expand Down Expand Up @@ -824,7 +831,7 @@ func Deletion(c DeleteConfig) error {
}
}

return waitErr
return nil
}

// deleteResource deletes the specified resource using foreground cascading delete.
Expand Down

0 comments on commit ef6b07b

Please sign in to comment.