Implement Exoscale onboarding API endpoint #199
No reviewers
Labels
No labels
API
Billing
UI/UX
dependencies
bug
change
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: servala/servala-portal#199
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "37-exoscale-onboarding"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Implementation notes:
This PR adds a couple of config options, which I added to the
.env.examplefile. Currently, Servala will create the Exoscale origin on the fly if it does not exist – we could also create it in a database migration to make sure it always exists – functionally, there is no real difference between the two, with on-the-fly creation being a bit more stable in case of accidental deletion (and allowing us to more easily compact migrations in the future).I spent some time fixing the existing test setup, and the new API endpoint is 100% covered by tests – this should both help guarantee that we do not break the integration in the future, and make it easier to set up additional API tests later on.
As the API endpoint is on the very simple side, I have chosen not to add Django RestFramework to the project for now, as it is a rather big and clunky tool, more suitable to developing full REST APIs than one-off endpoints.
0f6d58912eto63a769e13a63a769e13ato2778ab2457Tested with:
Content of
tmp/osb-instance-create.json:When setting the field
service_idto a string:According to the spec, the field
idis a string. I think we should have a separate, unique field in the following models to store OSB specific IDs and match against them: Service and Plan.When I create another service (different
service_idandplan_idwith the same organization, it returns"Service already enabled". I don't think this is correct? But I guess this will be improved in #38Let's implement the custom invitation flow in #19. I moved that to the selected stage in the development planning board.
For now, this is enough. On Exoscale we will only have one plan: "Enable this Service".
PS: I see that the tests are failing in CI.
We currently do not use the
Planmodel yet at all apart from in this PR, fwiw. If I understand this correctly, you'd like anosb_idof typestring/CharFieldon both theServiceand thePlanmodel and match against those in the API PUT request?I do see that the current behaviour present in this PR cannot be correct. I'm confused as to what this response code should do. How do we track if a service is "enabled" for an exoscale user/organisation/what does "enabled" mean?
Should I do this before moving forward with this PR or after it was merged?
Forgot to commit the updated dependencies, tests are passing now.
Actually, you're right. The Plan model isn't used yet. The OSB plan would fit much better to the Service Offering model. Let's add an
osb_plan_idfield to theServiceOfferingfield and use that one for matching in the OSB API PUT. I also suggest we get rid of the unused Plan model - I see no use right now and also currently not in the future.Also, in the same way, let's use an
osb_service_idin theServicemodel.A clarification: We don't really make use of the plan information. You can see in the Exoscale marketplace screenshot at https://docs.servala.com/exoscale-osb.html#_exoscale_organizations that there is just a single "Enable" button. This is the only "plan" available. Please note that the suspension feature is also done via a specific OSB plan. Once we implement the suspension feature, we will have to catch this special plan without a lookup in the database.
See also https://community.exoscale.com/vendor/marketplace-managed-svc-prov/#plan-setup - In our case we only offer exactly one plan.
We will track if a service is enabled in #38 "Service availability". I guess once we implement #38, we will have a correct behavior. IMHO for now, it's OK to leave it as it is and correct it later.
I'd do it afterward. I like small steps, one after the other, instead of a big bang =) This is the same reason why I'm OK to not have the fully correct behavior right now. Once we finished all steps, it should be "perfect".
@ -0,0 +6,4 @@urlpatterns = [path("v2/service_instances/<str:instance_id>",Let's move this to
api/osb/v2/service_instances/<str:instance_id>49e553b1aftoe459047622