Skip to main content

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
FieldDescriptionSchemeRequired
idID of the componentstring
nameName of the component/configstring
namespaceSelect resources in this namespace only, if empty find resources in all namespacesstring
typesMatch any of the types specified[]string
statusesMatch any of the statuses specified[]string
labelSelectorKubernetes Style Label SelectorLabelSelector
fieldSelectorKubernetes Style Field Selector Property fields of the component in kubernetes format (or database columns: owner, topology_id, parent_id)FieldSelector
agentSelect resources created on this agent, Defaults to localuuid, {name}, local or all
cacheCache settings to use for the results, expensive selectors or selectors that are are use very often should be cached for longer periods. Defaults to max-age=10mno-cache, no-store or max-age={duration}

Selecting components in a topology

topology-component-selectors.yaml
kind: 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 labelled 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'