-
Notifications
You must be signed in to change notification settings - Fork 43
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
Fix remove integration with multiple consumers #309
Conversation
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.
Thank you for your PR, it's greatly appreciated.
Please update the commit message with why the change is being made.
It'd be helpful to have an AC test as well for this scenario.
52ae498
to
88b9328
Compare
@hmlanigan Updated the commit message, implemented the suggestions. Also added AC test. |
@hemanthnakkina I'm not sure about checking for other resources, and if it's possible. What do you need that data for? To use an offer, it must be created in the other model. So RemoveRemoteOffer is removing it from the consuming side, not the creation. I don't see a need to check current terraform resources. |
Running |
95e5ac3
to
5e052b5
Compare
@hmlanigan I thought i will add an explicit check if integration is removed or not here [1] but that may not be required. |
I'd approve, but there is an error found during the test runs
|
5e052b5
to
ab12b1f
Compare
Currently removing an integration with an offer removes the remote offer. This does not take into consideration of any other consumers integrated with the offer. This leads to other consumers getting relation-broken which is not expected. Remove the integration using DestroyIntegration irrespective of whether the endpoint is an offer or not. The acceptance tests that involves postgres deployment takes around 5 minutes and the new test added also requires deploying postgres which increases the total time required for integration tests to run. So increase integration tests timeout to 40m from 30m. Fixes: juju#308
ab12b1f
to
7f6d944
Compare
@hmlanigan I have tested the acceptance tests on juju 3.1/stable and juju 2.9/stable using the below command and the tests are successful. Not sure why they are failing here. The terraform version used in my local tests are v1.5.7. I have tested manually as well with terraform plan and its working on my local. On another note, I increased the integration tests timeout value to 40 min as this new test requires 5 minutes to execute. |
Usually these failures are a timing issue. I haven't been able to reproduce locally either, but we need clean test runs to merge. Doing a bit of investigation. |
@hmlanigan I have added commit to handle error message Also at some point of time, we need to look at using some other app in integration tests instead of PostgreSQL as it is taking 5 minutes to destroy due to errors in the charm. |
c640d8e
to
7ffc81d
Compare
@hemanthnakkina Well that's annoying, apparently the juju error types aren't working for the AlreadyExists in the API. Let's put it back and please add a TODO to understand why the jujuerrors.AlreadyExists error isn't coming thru. Thank you for your patience with this. There might be a translation bug in the juju api layers. |
Creation of multiple resource integrations to same offer may lead to error for one of the integration as both the integrations tries to add remote offer to the model. One of them errors out with message saas application already exists. Check for the error message while consuming the remote offer. If the error message says saas application is already created, proceed with the integration instead of erroring out.
7ffc81d
to
5c62144
Compare
@hmlanigan Changed back to using errors, thanks! Ready for CI check and review. |
For an offer with multiple consumers, if the integration for one consumer is removed, the offer is removed on consumer/remote side. This leads to removal of integrations for rest of the consumers.
Use DestroyIntegration even for relations with offers as endpoint instead of deletion of remoteoffer.
Fixes: #308
Description
If integration having endpoint of type offer is removed, the remote-consumer offer is removed. This resulted in break of other applications that are consuming the offer.
Fixes: #308
Type of change
Environment
Juju controller version: 3.1.5
Terraform version: v1.5.7
QA steps
Manual QA steps should be done to test this PR.
Steps are mentioned in #308
Additional notes