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

[UI] Binding to app within service creation fails for some services #289

Closed
thehejik opened this issue Jul 26, 2023 · 10 comments · Fixed by #336
Closed

[UI] Binding to app within service creation fails for some services #289

thehejik opened this issue Jul 26, 2023 · 10 comments · Fixed by #336
Assignees
Labels
blocked-backend kind/bug Something isn't working
Milestone

Comments

@thehejik
Copy link
Contributor

thehejik commented Jul 26, 2023

Describe the bug
On Epinio v1.9.0 when trying to deploy a new service and binding it to an existing app (in one step) over UI the binding fails. The service itself is deployed.

image

Service instance was created but failed to reach a deployed state in a reasonable amount of time, no applications were bound

@mmartin24 found out that it depends on used service catalog as it works ok with postgres and mongo but doesn't with redis, mysql and rabbitmq. It seems that more resource hungry services are unable to bind. Also he was unable to reproduce this issue on Epinio v1.8.1.

I was unable to reproduce that over CLI when trying emulate the UI by:

epinio service create mysql-dev mysql-sample --wait && epinio service bind mysql-sample sample

To Reproduce

  1. Install Epinio v1.9.0
  2. Push an app over UI
  3. Create a mysql-dev service instance and bind it to the app in one step over UI (according to the screenshot)
  4. Click Create and see error

Expected behavior
The service is created and bound to the app

@enrichman
Copy link
Member

This looks like a timeout issue in the UI, because when the service takes too long then the UI will warn you with this error.

Possible fixes:

  • increase the timeout
  • since the binding of the app doesn't need the full creation of the service it can be done without waiting, maybe with just a small delay after the service creation (just to be sure that the service was "initialized/created"

@enrichman enrichman transferred this issue from epinio/epinio Aug 2, 2023
@enrichman enrichman changed the title Binding to app within service creation fails for some catalogs in UI [UI] Binding to app within service creation fails for some services Aug 2, 2023
@enrichman enrichman moved this to Icebox in Epinio planning Aug 2, 2023
@richard-cox richard-cox moved this from Backlog to Next Up in UI Aug 29, 2023
@richard-cox richard-cox added this to the v1.10.0 milestone Aug 29, 2023
@richard-cox
Copy link
Member

richard-cox commented Aug 29, 2023

At the moment we wait for a service state of deployed. Before this it's only not ready

There's a comment in ui code Service instance must be `deployed` before they can be bound to apps.

I tried not waiting at all, having a 2 second gap and also waiting for the resource to be returned via the API, and all give the same 404 response to /bind release 'x443639a38b5fbf3853fe23f3bf7d' does not exist.

@enrichman Can we add a new state to the service resource that indicates it's ready to be bound to?

Edit: In case someone else picks this up it's in dashboard/pkg/epinio/edit/bind-apps-mixin.js waitForServiceInstanceDeployed

@richard-cox richard-cox moved this from Next Up to In progress in UI Aug 29, 2023
@richard-cox richard-cox self-assigned this Aug 29, 2023
@enrichman enrichman moved this from Icebox to Scheduled in Epinio planning Aug 30, 2023
@mmartin24
Copy link
Contributor

mmartin24 commented Aug 30, 2023

As @richard-cox in CLI if no wait is placed in between svc creation and binding, indeed an error appears not finding the svc:

➜  epinio git:(main) epinio service create postgresql-dev postgres-sample && epinio service bind postgres-sample sample

🚢  Creating Service...
Catalog: postgresql-dev
Service: postgres-sample
Wait For Completion: false

🚢  Binding Service...

❌  error binding service: service bind failed: release 'x75ed1dbc13b646923fddfc26d983' does not exist

However, please note that in the UI this works for postgresql and mongo but not for the rest

Now, if we add just a couple of seconds in between this works:

➜  epinio git:(main) epinio service create postgresql-dev postgres-sample && sleep 2 && epinio service bind postgres-sample sample

🚢  Creating Service...
Catalog: postgresql-dev
Service: postgres-sample
Wait For Completion: false

🚢  Binding Service...

➜  epinio git:(main) epinio service list                                                                                          

🚢  Listing Services...
Namespace: workspace

✔️  Details:
|      NAME       |            CREATED             | CATALOG SERVICE | VERSION |  STATUS  | APPLICATIONS |
|-----------------|--------------------------------|-----------------|---------|----------|--------------|
| postgres-sample | 2023-08-30 11:52:11 +0200 CEST | postgresql-dev  | 15.1.0  | deployed | sample       |

@enrichman
Copy link
Member

@richard-cox that's strange because as @mmartin24 tested it should work with just a few seconds wait from the async creation. The service resource should be there and we should be able to bind it.

@richard-cox
Copy link
Member

@enrichman It seems a bit of a workaround to add a wait, which would be susceptible to cluster performance. Would there be a large impact to adding a created state? Would the not ready state be enough to indicate the resource was created?

@enrichman
Copy link
Member

It is a workaround. The service should be created as soon the create returns, and the not ready state should be the status you are looking for (the service is there, but not ready yet). Are you doing the binding in parallel or after the creation?

This should work:

service create -> OK -> service bind 

if not it's strange. You can avoid the wait with a get, to check for the service:

service create -> OK -> while(service get) -> OK -> service bind

otherwise the most appropriate way on doing this would be probably have a flag to do this in one API request. This would be an enhancement.

@richard-cox richard-cox moved this from In progress to Review in UI Sep 4, 2023
@richard-cox richard-cox moved this from Scheduled to In Progress in Epinio planning Sep 4, 2023
@richard-cox
Copy link
Member

richard-cox commented Sep 4, 2023

The current flow is synchronous

  • api request to create service
  • loop every 2 seconds
    • check if that service state is deployed
    • fetch service
  • when deployed make api request/s to bind app

I tested the above with just waiting for the fetch service to return something. Then also if that state is not-ready. Both still fail.

I've created a PR wait for not-ready....and also to then wait 2 seconds. This isn't great, but resolves the issue.

Edit - Might be worth noting i'm seeing really slow response times for service related network requests. Could be many things, but warrants some investigation

image

@github-project-automation github-project-automation bot moved this from Review to Done in UI Sep 5, 2023
@github-project-automation github-project-automation bot moved this from In Progress to Done in Epinio planning Sep 5, 2023
@richard-cox richard-cox reopened this Sep 5, 2023
@github-project-automation github-project-automation bot moved this from Done to Next Up in UI Sep 5, 2023
@richard-cox richard-cox moved this from Next Up to To Test in UI Sep 5, 2023
@thehejik
Copy link
Contributor Author

thehejik commented Sep 5, 2023

Now it behaves differently but still not OK.

The service creation with bind usually works fine when the app is freshly deployed but if you delete the service and try to create/bind another service to the same app the action does fail on configuration not found. I guess it might be some race condition as the configuration is in some transient state or not created yet. Also I can reproduce this issue on services that were ok before as postgres.

image

@richard-cox
Copy link
Member

@thehejik from what i can tell this might be an api issue (epinio/epinio#2551). Separately I spotted edit service is broken and will be fixed by #340

@richard-cox richard-cox moved this from To Test to Review in UI Sep 5, 2023
@richard-cox richard-cox moved this from Review to Next Up in UI Sep 6, 2023
@richard-cox richard-cox modified the milestones: v1.10.0, v1.11.0 Sep 18, 2023
@mmartin24
Copy link
Contributor

This looks ok to me.
I tested both issues commented on this ticket and they worked for me:

  • the original issue (unable to bind at times when doing so in 1 step on several services)
  • the secondary issue commented above not being able to bind after a binded service is deleted.

I checked them first here and rechecked again today with v1.10.0-rc1-10-g09a409e9 and latest epinio ui, by creating service and binding in 1 step, deleting binded service and repeating the service creation and binding again in 1 steps.

So looks ok in my opinion.

@thehejik , ok with closing this issue?

@github-project-automation github-project-automation bot moved this from Next Up to Done in UI Sep 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked-backend kind/bug Something isn't working
Projects
Archived in project
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants