Closed AvitalTamir closed 3 weeks ago
Allows defining custom relationships between Kubernetes resources in a ~/.cyphernetes/relationships.yaml file. This is useful when working with custom resources or when you want to define relationships that aren't built into Cyphernetes.
~/.cyphernetes/relationships.yaml
Example relationships.yaml:
relationships: - kindA: applications.argoproj.io kindB: services relationship: ARGOAPP_SYNC_SERVICE matchCriteria: - fieldA: "$.spec.source.targetRevision" fieldB: "$.metadata.labels.targetRevision" comparisonType: ExactMatch - fieldA: "$.spec.project" fieldB: "$.metadata.labels.project" comparisonType: ExactMatch - kindA: pods kindB: deployments relationship: DEPLOYMENT_OWN_POD matchCriteria: - fieldA: "$.metadata.name" fieldB: "$.metadata.name" comparisonType: StringContains
The relationships.yaml file supports the following fields:
kindA
kindB
relationship
matchCriteria
fieldA
fieldB
comparisonType
ExactMatch
ContainsAll
StringContains
defaultProps
default
Custom relationships are loaded on startup and can be used just like built-in relationships in queries:
MATCH (d:Deployment)->(p:Pod) RETURN d.metadata.name, p.metadata.name
Allows defining custom relationships between Kubernetes resources in a
~/.cyphernetes/relationships.yaml
file. This is useful when working with custom resources or when you want to define relationships that aren't built into Cyphernetes.Example relationships.yaml:
The relationships.yaml file supports the following fields:
kindA
,kindB
: The Kubernetes resource kinds to relate (use plural form, e.g. "deployments" not "Deployment")relationship
: A unique identifier for this relationship type (conventionally UPPERCASE)matchCriteria
: List of criteria that must all match for the relationship to existfieldA
: JSONPath to field in kindA resourcefieldB
: JSONPath to field in kindB resourcecomparisonType
: One of:ExactMatch
: Values must match exactlyContainsAll
: All key-value pairs in fieldB must exist in fieldAStringContains
: The value in fieldA contains the value in fieldB as a substringdefaultProps
: Optional default values to use when creating resourcesfieldA
: JSONPath to field in kindAfieldB
: JSONPath to field in kindBdefault
: Default value if field is not specifiedCustom relationships are loaded on startup and can be used just like built-in relationships in queries: