Skip to main content

Topology

The Topology CRD allows you to define and organize relationships and dependencies between components in your infrastructure, enabling you to model complex system architectures.

Definition

apiVersion: canaries.flanksource.com/v1
kind: Topology
metadata:
name: example-topology
spec:
# Source component selector
source:
selector:
matchLabels:
app: frontend

# Target component selector
target:
selector:
matchLabels:
app: backend

# Relationship type
relationship: dependsOn

# Additional properties
properties:
protocol: http
port: 8080

Schema

The Topology resource supports the following fields:

FieldDescription
spec.sourceSource component specification
spec.source.selectorKubernetes label selector for source components
spec.source.idSpecific component ID as source
spec.source.externalReference to an external component as source
spec.targetTarget component specification
spec.target.selectorKubernetes label selector for target components
spec.target.idSpecific component ID as target
spec.target.externalReference to an external component as target
spec.relationshipType of relationship between source and target
spec.propertiesAdditional properties for the relationship
spec.iconIcon to represent the relationship
spec.labelsLabels to categorize the relationship

Relationship Types

Common relationship types include:

RelationshipDescription
dependsOnSource depends on target
containsSource contains target
isPartOfSource is part of target
connectsSource connects to target
callsSource calls target
managesSource manages target
consumesSource consumes target
providesSource provides for target

Examples

Simple Dependency

apiVersion: canaries.flanksource.com/v1
kind: Topology
metadata:
name: frontend-depends-on-backend
spec:
source:
selector:
matchLabels:
app: frontend
target:
selector:
matchLabels:
app: backend
relationship: dependsOn

Specific Component Relationship

apiVersion: canaries.flanksource.com/v1
kind: Topology
metadata:
name: payment-to-database
spec:
source:
id: payment-service
target:
id: payment-database
relationship: connects
properties:
protocol: postgres
port: 5432
encrypted: true

Complex Relationship with External Systems

apiVersion: canaries.flanksource.com/v1
kind: Topology
metadata:
name: app-to-external-api
spec:
source:
selector:
matchLabels:
app: shopping-cart
target:
external:
name: Payment Gateway
type: external-service
icon: payment
relationship: calls
properties:
protocol: https
authentication: oauth2
criticality: high

Hierarchical Relationship

apiVersion: canaries.flanksource.com/v1
kind: Topology
metadata:
name: platform-contains-services
spec:
source:
id: e-commerce-platform
target:
selector:
matchLabels:
type: microservice
platform: e-commerce
relationship: contains

See Also