Resource Selectors
Resource Selectors are used in multiple places including:
- Attaching components to a topology
- Creating relationships between configs and configs/components
- Finding resources to run health checks or playbooks on
Field | Description | Scheme | Required |
---|---|---|---|
id | ID of the component | string | No |
name | Name of the component/config | string | No |
namespace | Select resources in this namespace only, if empty find resources in all namespaces | string | No |
types | Match any of the types specified | []string | No |
statuses | Match any of the statuses specified | []string | No |
labelSelector | Kubernetes Style Label Selector | LabelSelector | No |
fieldSelector | Kubernetes Style Field Selector Property fields of the component in kubernetes format (or database columns: owner, topology_id, parent_id) | FieldSelector | No |
agent | Select resources created on this agent, Defaults to local | uuid , {name} , local or all | No |
cache | Cache settings to use for the results, expensive selectors or selectors that are used often should be cached for longer periods. Defaults to max-age=10m | no-cache , no-store or max-age={duration} | No |
search | Search for resources via key value pairs using parsing expression grammar | Search | No |
Search
The query syntax is field1=value1 field2>value2 field3=value3* field4=*value4
. *
is for prefix and suffix matching.
Supported operators:
Operator | Syntax | Types |
---|---|---|
= | field=value | string int json |
!= | field!=value | string int json |
* | field=*value or field=value* | string int |
> < | field>value or field<value | datetime int |
Date Queries
- Absolute dates:
2025-01-15
- Relative dates:
now-24h
,now-7d
,now+1w
- Supported units: s (seconds), m (minutes), h (hours), d (days), w (weeks), y (years)
Supported fields for:
Field | Type |
---|---|
name | string |
source | string |
namespace | string |
type | string |
status | string |
labels | json |
tags | json |
config | json |
health | string |
agent | string |
created_at | datetime |
updated_at | datetime |
deleted_at | datetime |
Field | Type |
---|---|
id | string |
config_id | string |
name | string |
type | string |
created_at | datetime |
severity | string |
change_type | string |
summary | string |
count | int |
first_observed | datetime |
agent_id | string |
tags | json |
details | json |
Example Queries
# Find all Kubernetes namespaces starting with "kube"
type=Kubernetes::Namespace name=kube*
# Find unhealthy AWS EC2 instances
type=AWS::EC2::Instance health=unhealthy
# Find critical severity changes for AWS resources
type=AWS::* severity=critical
# Find configs created in the last 24 hours
created_at>now-24h
# Find nginx pods with prod cluster tag
type=Kubernetes::Pod label.app=nginx tags.cluster=prod
# Complex query with date range
updated_at>2025-01-01 updated_at<2025-01-31 type=Kubernetes::Deployment
Components
Field | Description | Scheme |
---|---|---|
agent |
| |
created_at | datetime | |
deleted_at | datetime | |
health |
| |
labels | json | |
name |
| |
namespace |
| |
status |
| |
topology_id |
| |
type |
| |
updated_at | datetime |
Field | Description | Scheme |
---|---|---|
agent |
| |
canary_id |
| |
created_at | datetime | |
deleted_at | datetime | |
health |
| |
labels | json | |
name |
| |
namespace |
| |
status |
| |
type |
| |
updated_at | datetime |
Examples
Selecting Components in a Topology
topology-component-selectors.yamlkind: Topology
metadata:
name: Example
spec:
components:
- name: Components with healthy status in kube-system namespace of all agents
selectors:
- statuses: ['healthy']
namespace: kube-system
agent: all
- name: Components with Node type with spot instance property labeled with gpu tag
selectors:
- types: ['Kubernetes::Node']
fieldSelector: 'instance-type=spot'
labelSelector: 'sku-type=gpu'
- name: Components with labels of team payments or team orders
# Using multiple selectors to aggregate
selectors:
- labelSelector: 'team=payments'
- labelSelector: 'team=orders'
- name: Kubernetes components which start with kafka created in last 24h
# Suffix and Prefix matches are supported using *
selectors:
- search: name=kafka* type=Kubernetes* created_at>now-24h
- name: All components updated between a specific interval
selectors:
- search: updated_at>2024-10-10 updated_at<2024-10-17
- name: Component with name httpbin-service
# Not giving any key will do a name lookup (ie name=httpbin-service)
selectors:
- search: httpbin-service
- name: Components with label cluster
# JSON lookups are also supported
selectors:
- search: labels.cluster=prod
- name: Link configs which have logistics-api image
configs:
- search: config.spec.template.spec.containers[0].name=docker.io/example/logistics-api:latest