Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resource undergoing replacement has incorrect status messages #2810

Merged
merged 2 commits into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: what I've seen at Pulumi before for intentionally ignoring errors is:

err := clearStatus(...)
contract.IgnoreError(err)

}
}
} 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 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is one bit here (and associated return) where it's not immediately obvious to a tired reader that control flow is not changing, and this is just a logging change, however I think that's still the case, it's not changing, localizing error handling to make the code better.. Appreciate eyes on this :)

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
Loading