Service instance annotations for billing purposes #263
Labels
No labels
API
Billing
UI/UX
dependencies
bug
change
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: servala/servala-portal#263
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Stories
As a user, I want to have a well-organized invoice.
Implementation Notes
Corresponds to internal ticket APPCAT-1195 and follows #96.
Context
The control plane automatically creates a custom resource for each service instance, which contains meta information to send to the event-based billing in Odoo:
The most important fields:
spec.odoo.instanceID: Generated and tracked by the control plane (per instance)spec.odoo.itemDescription: Managed by Servala Portal (per instance)spec.odoo.itemGroupDescription: Managed by Servala Portal (per instance or per organization origin)spec.odoo.organization: Managed by Servala Portal Organization namespace annotationservala.com/organizationspec.odoo.productID: Managed by Servala Portal See in #264 (per service instance)spec.odoo.salesOrderID: Managed by Servala Portal Organization namespace annotationservala.com/sales_order(per instance or per organization origin)spec.odoo.size: Computed by the control plane (per instance)spec.odoo.unitID: Managed by Servala Portal See in #264 (per instance)Some of these fields are per organization, and some are per service instance.
Task
Part 1: Grouping per Organization Origin
Allow configuring the "grouping" behavior on the organization origin, called "Invoice Line Item Grouping":
Part 2: Annotations
Add the annotations per service instance (
metadata.annotations), depending on the "Invoice Line Item Grouping" setting, inherited from the organization origin:Case
By Service:servala.com/erp_item_group_description: "Servala Service: $Service.name"servala.com/erp_item_description: "$ServiceInstance.name on $ServiceInstance.$ControlPlaneCRD.$ControlPlane.$CloudProvider.name $ServiceInstance.$ControlPlaneCRD.$ControlPlane.name"Example:
servala.com/erp_item_group_description: Servala Service: Redisservala.com/erp_item_description: MyProdRedis on Exoscale Geneva (CH-GVA-2).Case
By Organization:servala.com/erp_item_group_description: Organization: $Organization.name ($Organization.osb_guid)servala.com/erp_item_description = $ServiceInstance.name on $ServiceInstance.$ControlPlaneCRD.$ControlPlane.name [Org: $Organization.osb_guid]Example:
servala.com/erp_item_group_description= Organization: ACME (01998651-dc86-7d43-9e49-cdb790fcc4f0)servala.com/erp_item_description= MyProdRedis on Geneva (CH-GVA-2) [Org: 01998651-dc86-7d43-9e49-cdb790fcc4f0]Only set
osb_guidwhen the field is not empty.Part 3: Admin Command
Create a Django admin command that can be used to sync all labels and annotations to all organization namespaces on all or selected control planes.
Organization namespace annotations for billing purposesto Service instance annotations for billing purposes