Resources / Invariant

Invariant

A property of the platform stated as a read-only openCypher query over the graph of API objects: the query returns the violating objects, and zero rows means the invariant holds (spec 0047 section 6.5). The platform evaluates it when a kind it reads changes and every 30 minutes, within a row and work budget.

Overview

APIplatform.etorm.com/v1alpha1
Resourceinvariants (cluster-scoped inside its cluster)
Short namesinv
Available inthe platform and project clusters
Statuswritten by a controller through /status

Minimal example

apiVersion: platform.etorm.com/v1alpha1
kind: Invariant
metadata:
  name: example
spec:
  query: "<query>"
  reads:
  - kind: "<kind>"
    group: "<group>"
    plural: "<plural>"

Spec

FieldTypeRequiredDefaultAllowedDescription
querystringyeslength 1 to 4096Read-only openCypher. It returns one row per violating object with the columns cluster, kind and name, and optionally reason. The parameter $now (Unix seconds) is always available.
readslist of objectyesup to 16 itemsThe kinds the query reads: every node label in the query must be listed. A change to one of them evaluates the invariant, and a violating row names its kind through this list.
reads[].kindstringyesThe kind, as the label in the query: PublicEndpoint.
reads[].groupstringyesIts API group: edge.etorm.com.
reads[].pluralstringyesIts plural resource name: publicendpoints.
parametersobject (free-form)Further query parameters (values only).
severitystring (one of)"warning"info, warning, criticalHow urgent a violation is: the severity of the incident.
rowBudgetinteger1001 to 1000The most rows the query may return.
workBudgetinteger1000001000 to 1000000The most store reads the query may make (the engine has no clock, so reads measure time).
incidentbooleantrueOpen one Incident while the invariant is violated.

Status

FieldTypeRequiredDefaultAllowedDescription
violationCountintegerHow many rows the last evaluation returned.
violationslist of objectup to 20 itemsThe first twenty violating objects, sorted: names only.
violations[].clusterstringIts cluster.
violations[].kindstringIts kind.
violations[].groupstringIts API group.
violations[].pluralstringIts plural resource name.
violations[].namestringIts name.
violations[].reasonstringup to 200 charactersWhy, when the query says.
observedGenerationintegerThe generation of the spec last evaluated.
conditionslist of objectHolds (no violation) and Ready (the query is valid and within budget).
conditions[].typestringCondition type.
conditions[].statusstringTrue, False or Unknown.
conditions[].reasonstringMachine-readable reason.
conditions[].messagestringHuman-readable detail.

Columns in listings

ColumnFrom
Severity.spec.severity
Violations.status.violationCount
Holds.status.conditions[?(@.type=="Holds")].status
Detail.status.conditions[0].message

All resources