Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: example for matchExpressions filtering #596

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions docs/source/analyze/node-resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,29 @@ Troubleshoot allows users to analyze nodes that match one or more labels. For ex
message: This cluster has a node with enough memory and cpu capacity running Mongo Operator.
```

> Filtering by labels with `matchExpressions` was introduced in Troubleshoot 0.113.0.

Alternatively, you can use `matchExpressions` to specify a list of selector label expressions that the node needs to match in its metadata.
```yaml
- nodeResources:
checkName: Must have Mongo running
filters:
allocatableMemory: 16Gi
cpuCapacity: "5"
selector:
matchExpressions:
- key: kubernetes.io/role
operator: In
values:
- database-primary-replica
outcomes:
- fail:
when: "count() < 1"
message: Must have 1 node with 16 GB (available) memory and 5 cores (on a single node) running Mongo Operator.
- pass:
message: This cluster has a node with enough memory and cpu capacity running Mongo Operator.
```

## Message Templating
To make the outcome message more informative, you can include certain values gathered by the NodeResources collector as templates. The templates are enclosed in double curly braces with a dot separator. The following templates are available:

Expand Down
Loading