Skip to content

Commit

Permalink
chore: update resource selector documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
yashmehrotra committed Feb 14, 2024
1 parent b8abaca commit ccd11bf
Showing 1 changed file with 42 additions and 5 deletions.
47 changes: 42 additions & 5 deletions mission-control/docs/topology/references/components.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,48 @@ Components are the building blocks of a Topology. The component specification pr

### ResourceSelector

| Field | Description | Scheme | Required |
| --------------- | --------------------------------------------------------------------------------- | -------- | -------- |
| `name` | Set name for selector | `string` | |
| `fieldSelector` | Select Kubernetes or Canary object based on the value of specified resource field | `string` | |
| `labelSelector` | Select Kubernetes or Canary object based on label. e.g. app, canary. | `string` | |
We use resource selectors to link components with each other

| Field | Description | Scheme | Required |
|---------------|----------------------------------------------------------------------------------------------------------------------------------------|----------|----------|
| id | ID of the component | string | |
| name | Name of the component | string | |
| namespace | Namespace of the component | string | |
| types | List of types of the component | []string | |
| statuses | List of statuses of the component | []string | |
| labelSelector | Labels to select the component in kubernetes format | string | |
| fieldSelector | Property fields of the component in kubernetes format (or database columns: owner, topology_id, parent_id) | string | |
| agent | ID or name of the agent (Default: local agent). Use 'all' to select all the agents | string | |
| cache | One of 'no-cache' (should not fetch from cache but can be cached), 'no-store' (should not cache) or 'max-age=X' (cache for X duration) | string | |


A resource selector fetches components that satisfy all the parameters, you can use multiple selectors to aggregate

## Example
```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 and team orders
# Using multiple selectors to aggregate
selectors:
- labelSelector: 'team=payments'
- labelSelector: 'team=orders'
```
### ForEach
Expand Down

0 comments on commit ccd11bf

Please sign in to comment.