better/compute
API

loadBalancers

Load balancers on a provider account (DigitalOcean regional and global first). Every call records what the tenant wants and returns at once; the `vps.provider-resources` reconciler converges the provider through `ProviderImpl.loadBalancers`. Reading takes `compute:load-balancers:read`, everything else `compute:load-balancers:manage`, on `provider-load-balancer/{id}`. A load balancer books one `loadBalancers` quota on the pool (no quota row grants none) and bills `vps.load-balancer.hours` from `ready` until deleted.

Load balancers on a provider account (DigitalOcean regional and global first). Every call records what the tenant wants and returns at once; the vps.provider-resources reconciler converges the provider through ProviderImpl.loadBalancers. Reading takes compute:load-balancers:read, everything else compute:load-balancers:manage, on provider-load-balancer/{id}. A load balancer books one loadBalancers quota on the pool (no quota row grants none) and bills vps.load-balancer.hours from ready until deleted.

What a load balancer reaches is computed from the tenant's own rows and sent to the provider as explicit machine ids, never a tag, so it never reaches another tenant's machine. A regional one targets the tenant's instances in its pool and region (targets: { pool: true }) or named instances of the tenant (targets: { instanceIds }); a global one targets the tenant's regional load balancers (targets: { loadBalancerIds }). A regional load balancer is in one VPC and the provider balances only to machines in it: it lives on one subnet of a tenant network (subnetId, or the subnet its named instances share) and reaches only instances on that subnet, or, without one, on the account's default network and reaches only instances on no tenant network. An instance counts once it has a machine and until it is being deleted. Deleting an instance updates its load balancers at once; one that gains a machine is added by the periodic pass, within five minutes.

All 5 methods are served by @better-compute/server 0.3.0.

MethodKindAuthorizationPhaseStatus
createmutationcompute:load-balancers:manage @ compute-provider-load-balancerv1.0registered
listreadcompute:load-balancers:read @ compute-tenant + itemsv1.0registered
getreadcompute:load-balancers:read @ compute-provider-load-balancerv1.0registered
updatemutationcompute:load-balancers:manage @ compute-provider-load-balancerv1.0registered
deletemutationcompute:load-balancers:manage @ compute-provider-load-balancerv1.0registered

create

POST /api/compute/loadBalancers/create

Makes a load balancer with its forwarding rules (1 to 15; an https or http2 entry names a certificateId of the tenant on the same account, or an https one passes TLS through with tlsPassthrough), an optional healthCheck, stickySessions, sourceRanges and redirectHttpToHttps, and (global only) the domains it serves. It returns pending, booking one loadBalancers; no room, or no quota row, is QUOTA_EXCEEDED. Another tenant's instance is ACCESS_DENIED, another region or account INVALID_INPUT, named instances on two subnets (or not on subnetId) INVALID_INPUT, another tenant's subnet NOT_FOUND, another tenant's certificate or load balancer NOT_FOUND. Named instances are also decided as compute:instances:update on each, with the caller's own credential. The provider is asked once the certificates it names are ready. Publishes providerLoadBalancer.created, then providerLoadBalancer.ready with its address, or providerLoadBalancer.error.

  • Kind: mutation
  • Authorization: compute:load-balancers:manage @ compute-provider-load-balancer
  • Module: vps
  • Phase: v1.0 (registered)

Input

FieldTypeRequiredConstraints
tenantIdstringyesat most 128 characters; matches ^[A-Za-z0-9._:-]{1,128}$
projectIdstringat most 56 characters; matches ^prj_[0-9a-hjkmnp-tv-z]{26,52}$
poolIdstringyesat most 57 characters; matches ^pool_[0-9a-hjkmnp-tv-z]{26,52}$
namestringyesat most 42 characters; matches ^[a-z]([-a-z0-9]{0,40}[a-z0-9])?$
descriptionstringat most 256 characters
scopeone of regional, globaldefault "regional"
regionstringat most 40 characters; matches ^[a-z][a-z0-9-]{0,38}[a-z0-9]$
subnetIdstringat most 57 characters; matches ^snet_[0-9a-hjkmnp-tv-z]{26,52}$
targetsobjectyes
targets.poolany
targets.instanceIdslist of string1-100 items
targets.loadBalancerIdslist of string1-100 items
forwardinglist of objectyes1-15 items
forwarding[].entryProtocolone of http, https, http2, tcp, udpyes
forwarding[].entryPortintegeryes1-65535
forwarding[].targetProtocolone of http, https, http2, tcp, udpyes
forwarding[].targetPortintegeryes1-65535
forwarding[].certificateIdstringat most 58 characters; matches ^pcert_[0-9a-hjkmnp-tv-z]{26,52}$
forwarding[].tlsPassthroughboolean
healthCheckobject
healthCheck.protocolone of http, https, tcpyes
healthCheck.portintegeryes1-65535
healthCheck.pathstringat most 255 characters
healthCheck.intervalSecondsinteger3-300
healthCheck.timeoutSecondsinteger3-300
healthCheck.healthyThresholdinteger2-10
healthCheck.unhealthyThresholdinteger2-10
stickySessionsobject
stickySessions.cookieNamestringyesat most 40 characters; matches ^[A-Za-z0-9_-]{1,40}$
stickySessions.ttlSecondsintegeryes1-604800
sourceRangesobject
sourceRanges.allowlist of string0-50 items
sourceRanges.denylist of string0-50 items
redirectHttpToHttpsboolean
domainslist of object0-20 items
domains[].namestringyesat most 253 characters
domains[].certificateIdstringat most 58 characters; matches ^pcert_[0-9a-hjkmnp-tv-z]{26,52}$
idempotencyKeystringyesat most 128 characters; matches ^[A-Za-z0-9._:-]{1,128}$

list

POST /api/compute/loadBalancers/list

Returns the tenant's load balancers in the order they were made (at most 1000), optionally of one pool or project. Deleted ones only with includeDeleted.

  • Kind: read
  • Authorization: compute:load-balancers:read @ compute-tenant + items
  • Module: vps
  • Phase: v1.0 (registered)

Input

FieldTypeRequiredConstraints
tenantIdstringyesat most 128 characters; matches ^[A-Za-z0-9._:-]{1,128}$
poolIdstringat most 57 characters; matches ^pool_[0-9a-hjkmnp-tv-z]{26,52}$
projectIdstringat most 56 characters; matches ^prj_[0-9a-hjkmnp-tv-z]{26,52}$
includeDeletedbooleandefault false

get

POST /api/compute/loadBalancers/get

Returns one load balancer: its settings, targets, address (and addressV6) once assigned, and its state.

  • Kind: read
  • Authorization: compute:load-balancers:read @ compute-provider-load-balancer
  • Module: vps
  • Phase: v1.0 (registered)

Input

FieldTypeRequiredConstraints
tenantIdstringyesat most 128 characters; matches ^[A-Za-z0-9._:-]{1,128}$
loadBalancerIdstringyesat most 56 characters; matches ^plb_[0-9a-hjkmnp-tv-z]{26,52}$

update

POST /api/compute/loadBalancers/update

Replaces each part given (forwarding, healthCheck, targets, stickySessions, sourceRanges, redirectHttpToHttps, domains) in place and returns it updating until the provider has applied it; publishes providerLoadBalancer.updated with what changed. The scope, region, pool and subnet never change: make another load balancer. Named instances must be on its subnet (or, without one, on no tenant network), else INVALID_INPUT.

  • Kind: mutation
  • Authorization: compute:load-balancers:manage @ compute-provider-load-balancer
  • Module: vps
  • Phase: v1.0 (registered)

Input

FieldTypeRequiredConstraints
tenantIdstringyesat most 128 characters; matches ^[A-Za-z0-9._:-]{1,128}$
loadBalancerIdstringyesat most 56 characters; matches ^plb_[0-9a-hjkmnp-tv-z]{26,52}$
targetsobject
targets.poolany
targets.instanceIdslist of string1-100 items
targets.loadBalancerIdslist of string1-100 items
forwardinglist of object1-15 items
forwarding[].entryProtocolone of http, https, http2, tcp, udpyes
forwarding[].entryPortintegeryes1-65535
forwarding[].targetProtocolone of http, https, http2, tcp, udpyes
forwarding[].targetPortintegeryes1-65535
forwarding[].certificateIdstringat most 58 characters; matches ^pcert_[0-9a-hjkmnp-tv-z]{26,52}$
forwarding[].tlsPassthroughboolean
healthCheckobject
healthCheck.protocolone of http, https, tcpyes
healthCheck.portintegeryes1-65535
healthCheck.pathstringat most 255 characters
healthCheck.intervalSecondsinteger3-300
healthCheck.timeoutSecondsinteger3-300
healthCheck.healthyThresholdinteger2-10
healthCheck.unhealthyThresholdinteger2-10
stickySessionsobject
stickySessions.cookieNamestringyesat most 40 characters; matches ^[A-Za-z0-9_-]{1,40}$
stickySessions.ttlSecondsintegeryes1-604800
sourceRangesobject
sourceRanges.allowlist of string0-50 items
sourceRanges.denylist of string0-50 items
redirectHttpToHttpsboolean
domainslist of object0-20 items
domains[].namestringyesat most 253 characters
domains[].certificateIdstringat most 58 characters; matches ^pcert_[0-9a-hjkmnp-tv-z]{26,52}$

delete

POST /api/compute/loadBalancers/delete

Marks the load balancer for deletion and returns it deleting; the reconciler deletes it at the provider, refunds its quota and publishes providerLoadBalancer.deleted. A regional load balancer a global one of the tenant targets is INVALID_STATE (reason inUse).

  • Kind: mutation
  • Authorization: compute:load-balancers:manage @ compute-provider-load-balancer
  • Module: vps
  • Phase: v1.0 (registered)

Input

FieldTypeRequiredConstraints
tenantIdstringyesat most 128 characters; matches ^[A-Za-z0-9._:-]{1,128}$
loadBalancerIdstringyesat most 56 characters; matches ^plb_[0-9a-hjkmnp-tv-z]{26,52}$

Was this page helpful?

Better Compute is created by Sean Filimon

Last updated

On this page