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

Conversation

EronWright
Copy link
Contributor

@EronWright EronWright commented Feb 2, 2024

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.

In this example, the status message is obsolete once the flow hits "created replacement". Before:

 ++ kubernetes:core/v1:Pod autonaming-test creating replacement (0s) [diff: ~metadata]
 ++ kubernetes:core/v1:Pod autonaming-test creating replacement (0s) [diff: ~metadata];
 ++ kubernetes:core/v1:Pod autonaming-test creating replacement (0s) [diff: ~metadata]; Waiting for Pod "test-namespace-4d5e71b3/autonaming-test" to be scheduled
 ++ kubernetes:core/v1:Pod autonaming-test creating replacement (0s) [diff: ~metadata]; Waiting for Pod "test-namespace-4d5e71b3/autonaming-test" to be initialized
 ++ kubernetes:core/v1:Pod autonaming-test creating replacement (0s) [diff: ~metadata]; Waiting for Pod "test-namespace-4d5e71b3/autonaming-test" to be ready
@ updating....
 ++ kubernetes:core/v1:Pod autonaming-test created replacement (1s) [diff: ~metadata]; Waiting for Pod "test-namespace-4d5e71b3/autonaming-test" to be ready
 +- kubernetes:core/v1:Pod autonaming-test replacing (0s) [diff: ~metadata]; Waiting for Pod "test-namespace-4d5e71b3/autonaming-test" to be ready
 +- kubernetes:core/v1:Pod autonaming-test replaced (0.00s) [diff: ~metadata]; Waiting for Pod "test-namespace-4d5e71b3/autonaming-test" to be ready
 -- kubernetes:core/v1:Pod autonaming-test deleting original (0s) [diff: ~metadata]; Waiting for Pod "test-namespace-4d5e71b3/autonaming-test" to be ready
@ updating.....
 -- kubernetes:core/v1:Pod autonaming-test deleted original (1s) [diff: ~metadata]; Waiting for Pod "test-namespace-4d5e71b3/autonaming-test" to be ready

After:

 ++ kubernetes:core/v1:Pod autonaming-test creating replacement (0s) [diff: ~metadata]
 ++ kubernetes:core/v1:Pod autonaming-test creating replacement (0s) [diff: ~metadata];
 ++ kubernetes:core/v1:Pod autonaming-test creating replacement (0s) [diff: ~metadata]; Waiting for Pod "test-namespace-c74027dd/autonaming-test" to be scheduled
 ++ kubernetes:core/v1:Pod autonaming-test creating replacement (0s) [diff: ~metadata]; Waiting for Pod "test-namespace-c74027dd/autonaming-test" to be initialized
 ++ kubernetes:core/v1:Pod autonaming-test creating replacement (0s) [diff: ~metadata]; Waiting for Pod "test-namespace-c74027dd/autonaming-test" to be ready
@ updating....
 ++ kubernetes:core/v1:Pod autonaming-test creating replacement (1s) [diff: ~metadata];
 ++ kubernetes:core/v1:Pod autonaming-test created replacement (1s) [diff: ~metadata];
 +- kubernetes:core/v1:Pod autonaming-test replacing (0s) [diff: ~metadata];
 +- kubernetes:core/v1:Pod autonaming-test replaced (0.00s) [diff: ~metadata];
 -- kubernetes:core/v1:Pod autonaming-test deleting original (0s) [diff: ~metadata];
@ updating.....
 -- kubernetes:core/v1:Pod autonaming-test deleting original (1s) [diff: ~metadata];
 -- kubernetes:core/v1:Pod autonaming-test deleted original (1s) [diff: ~metadata];

Related issues (optional)

Closes #2761

@EronWright EronWright added this to the 0.100 milestone Feb 2, 2024
@EronWright EronWright changed the title Clear resource status after awaiter completes Replacement has incorrect status messages Feb 2, 2024
Copy link

github-actions bot commented Feb 2, 2024

Does the PR have any schema changes?

Looking good! No breaking changes found.
No new resources/functions.

Copy link

codecov bot commented Feb 2, 2024

Codecov Report

Attention: 10 lines in your changes are missing coverage. Please review.

Comparison is base (4a5bfcc) 24.72% compared to head (ca19c94) 24.72%.

Files Patch % Lines
provider/pkg/await/await.go 9.09% 10 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2810   +/-   ##
=======================================
  Coverage   24.72%   24.72%           
=======================================
  Files          48       48           
  Lines        9647     9651    +4     
=======================================
+ Hits         2385     2386    +1     
- Misses       7106     7109    +3     
  Partials      156      156           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@EronWright EronWright enabled auto-merge (squash) February 2, 2024 01:05
@EronWright EronWright requested a review from a team February 2, 2024 01:05
@EronWright EronWright self-assigned this Feb 2, 2024
@EronWright EronWright changed the title Replacement has incorrect status messages Resource undergoing replacement has incorrect status messages Feb 2, 2024
@@ -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)

@@ -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 :)

@EronWright EronWright merged commit ef6b07b into master Feb 2, 2024
20 checks passed
@EronWright EronWright deleted the eronwright/issue-2761 branch February 2, 2024 18:40
lumiere-bot bot referenced this pull request in coolguy1771/home-ops Feb 24, 2024
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [@pulumi/kubernetes](https://pulumi.com)
([source](https://togithub.com/pulumi/pulumi-kubernetes)) | dependencies
| minor | [`4.7.1` ->
`4.8.0`](https://renovatebot.com/diffs/npm/@pulumi%2fkubernetes/4.7.1/4.8.0)
|

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

<details>
<summary>pulumi/pulumi-kubernetes (@&#8203;pulumi/kubernetes)</summary>

###
[`v4.8.0`](https://togithub.com/pulumi/pulumi-kubernetes/blob/HEAD/CHANGELOG.md#480-February-22-2024)

[Compare
Source](https://togithub.com/pulumi/pulumi-kubernetes/compare/v4.7.1...v4.8.0)

- Fix DiffConfig issue when when provider's kubeconfig is set to file
path
([https://github.com/pulumi/pulumi-kubernetes/pull/2771](https://togithub.com/pulumi/pulumi-kubernetes/pull/2771))
- Fix for replacement having incorrect status messages
([https://github.com/pulumi/pulumi-kubernetes/pull/2810](https://togithub.com/pulumi/pulumi-kubernetes/pull/2810))
- Use output properties for await logic
([https://github.com/pulumi/pulumi-kubernetes/pull/2790](https://togithub.com/pulumi/pulumi-kubernetes/pull/2790))
- Support for metadata.generateName (CSA)
([https://github.com/pulumi/pulumi-kubernetes/pull/2808](https://togithub.com/pulumi/pulumi-kubernetes/pull/2808))
- Fix unmarshalling of Helm values yaml file
([https://github.com/pulumi/pulumi-kubernetes/issues/2815](https://togithub.com/pulumi/pulumi-kubernetes/issues/2815))
- Handle unknowns in Helm Release resource
([https://github.com/pulumi/pulumi-kubernetes/pull/2822](https://togithub.com/pulumi/pulumi-kubernetes/pull/2822))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Renovate
Bot](https://togithub.com/renovatebot/renovate).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4yMTAuMCIsInVwZGF0ZWRJblZlciI6IjM3LjIxMC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

Co-authored-by: lumiere-bot[bot] <98047013+lumiere-bot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replacement has incorrect status messages
2 participants