The kind of edge between two EntityTypes
— runs_on, depends_on, placed_on_cluster. A RelationshipType declares the
directed from/to types, the cardinality, the valid relationship states, and
any per-edge properties. Every Relationship
is an instance of one RelationshipType. Phase: schema.
Relationships are how Terrantula orders your fleet: they drive the cascade (state
changes propagating along edges) and derived metrics (e.g. tenant-count =
active runs_on edges into a cluster).
| Field | Type | Required | Description |
|---|---|---|---|
kind | "RelationshipType" | yes | Discriminator. Always RelationshipType. |
name | string | yes | Unique type name within the project. Referenced by Relationships, Action operations, and cascade rules. |
displayName | string | no | Human label for the UI. Defaults to name. |
from | string | yes | Name of the from-end EntityType. Must reference an existing EntityType. |
to | string | yes | Name of the to-end EntityType. Must reference an existing EntityType. |
cardinality | "one-to-one" | "one-to-many" | "many-to-one" | "many-to-many" | no | Edge multiplicity. Default many-to-many. |
states | string[] | yes | All valid states for an edge of this type. |
properties | Property[] | no | Typed properties an edge carries. Default []. Same shape as EntityType properties. |
constraints | Constraint[] | no | Constraints enforced at create-relationship time. Default []. |
A property-sum constraint caps the sum of a relationship property across all
edges pointing at the same to-entity.
| Field | Type | Required | Description |
|---|---|---|---|
type | "property-sum" | yes | The only constraint type today. |
property | string | yes | The relationship property to sum across all edges to the target entity. |
leq | string | yes | Interpolation expression resolving to the ceiling value, e.g. {{ to.metrics.available-cpu }}. |
The runs_on type from the SaaS-tenants demo. Many tenants per
cluster, one cluster per tenant. The namespace property is the per-tenant
Kubernetes namespace allocated by the Terraform run.
from and tomust reference existing EntityTypes. Declare them earlier in the
same blueprint and the schema phase resolves the references in dependency order.
The first state in states is the default state for a new
Relationship when state is omitted.
Order statesdeliberately.
property-sum constraints are enforced at create-relationship time and are
bypassed by migrate-relationship operations (see the
Action migrate-relationshipoperation).
This is intentional: a rebalancing move should not be blocked by the ceiling it
is moving load away from.
from/to types and the property-sum ceiling source.