-
Notifications
You must be signed in to change notification settings - Fork 116
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
Add replaceUnready annotation for Jobs #1575
Conversation
Add the `pulumi.com/replaceUnready` annotation that allows the user to specify that a Job resource should be replaced during an update if it is not ready. This annotation could be extended to support other resource types as well, but currently only supports Jobs.
Based on feedback from #1563, I decided to add an annotation to force replacement of a resource if it is also unready. We may also want to add the Here's what this looks like in practice: |
Does the PR have any schema changes?Looking good! No breaking changes found. |
Does the PR have any schema changes?Looking good! No breaking changes found. |
Do we have a way to add a test for this? |
Does the PR have any schema changes?Looking good! No breaking changes found. |
Does the PR have any schema changes?Looking good! No breaking changes found. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought we were going to fix this by handling it as part of the existing support for updating resources that have initialization failures?
I’m a little more nervous about the implications of handling this in Diff. Is there precedent for that, and have we validated the experience this results in?
case "Job": | ||
jobChecker := states.NewJobChecker() | ||
job, err := clients.FromUnstructured(newInputs) | ||
if err == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it intentional that the error is swallowed here? Shouldn't it be returned?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this error would only occur from a malformed Job object and is unrelated to the diff, I thought it made sense to ignore. I can add a comment to that effect.
jobChecker := states.NewJobChecker() | ||
job, err := clients.FromUnstructured(newInputs) | ||
if err == nil { | ||
jobChecker.Update(job) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it okay to do this wait operation from Diff? Do we normally do that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not actually running the full await logic; this is a point in time check based on the current status of the Job.
I'm not sure if there's precedent for that, but it shouldn't have a noticeable effect on performance, and Diff is the only place where we can indicate a replacement is required.
Proposed changes
Add the
pulumi.com/replaceUnready
annotation that allowsthe user to specify that a Job resource should be replaced
during an update if it is not ready. This annotation could be
extended to support other resource types as well, but currently
only supports Jobs.
Related issues (optional)
Fix #856