From ccd11bf3594f30dec66ad0a60aa0661ff9f9198f Mon Sep 17 00:00:00 2001 From: Yash Mehrotra Date: Wed, 14 Feb 2024 11:11:32 +0530 Subject: [PATCH] chore: update resource selector documentation --- .../docs/topology/references/components.md | 47 +++++++++++++++++-- 1 file changed, 42 insertions(+), 5 deletions(-) diff --git a/mission-control/docs/topology/references/components.md b/mission-control/docs/topology/references/components.md index 87ec4bc1..87a795eb 100644 --- a/mission-control/docs/topology/references/components.md +++ b/mission-control/docs/topology/references/components.md @@ -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