-
Notifications
You must be signed in to change notification settings - Fork 45
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
Replace application already exists #329
Merged
hmlanigan
merged 7 commits into
juju:main
from
hmlanigan:replace-application-already-exists
Oct 26, 2023
Merged
Replace application already exists #329
hmlanigan
merged 7 commits into
juju:main
from
hmlanigan:replace-application-already-exists
Oct 26, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hmlanigan
changed the title
Replace application already exists
WIP: Replace application already exists
Oct 24, 2023
hmlanigan
force-pushed
the
replace-application-already-exists
branch
3 times, most recently
from
October 24, 2023 19:44
f82a5d1
to
e7c7666
Compare
hmlanigan
changed the title
WIP: Replace application already exists
Replace application already exists
Oct 25, 2023
cderici
suggested changes
Oct 25, 2023
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.
Code looks good, previous errors I was hitting was because of mis-QA.
cderici
approved these changes
Oct 25, 2023
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.
LGTM 👍
Import of an application resource sometimes fails with placement changing from "" to ",". The code should validate the size of the values before doing the join to avoid this.
Errors are much easier to handle as typed value. This is imprecise as it involves sniffing the error string.
In the case where RequiresReplace is used in the resource schema, terraform calls Destroy then Create. When Destroy is not complete before Create starts, it can cause problems with Create. Retry the various pieces of create until they succeed or timeout. Removed skip from test cases skipped due to this bug.
While testing update of an application resource with integrations where RequiresReplace is hit, found an issue with integrations. Removal of an application, also removes any integrations used by the application. This causes state confusion for terraform. Adding the replaced_triggered_by lifecycle info, allows for the integration to also be replaced if the related application resources are. List specific schema attributes so that no any change to the application will trigger the integration as well.
There is no need to test juju error messages in this provider.
Keep skip for state changing too quickly.
We were not failing quickly on deployment errors such as trying to deploy a subordinate with a unit.
hmlanigan
force-pushed
the
replace-application-already-exists
branch
from
October 25, 2023 21:11
9ac9853
to
1c4a657
Compare
Rebased to resole conflicts |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
CreateApplication in the juju package must be resilient to different
already exists
andnot found
errors. The method can be called when a new application resource is created, or when a RequiresReplace is triggered for the resource. In the case of RequiresReplace, DestroyApplication is called first. However we do not wait for the application removal to be done. Therefore we can get conflict errors when Creating an application with the same charm and or application name. Add retry functionality to account for this.Side notes:
Fixes: #272
Type of change
QA steps
Run
terraform init && terraform plan && terraform apply
with the following plan. Once it's active, update the plan by swapping the application names of "two" and "three", then runterraform plan && terraform apply
.Additional notes
JUJU-4529