Skip to content

Commit

Permalink
chore: move MatchPattern to common types & add examples for
Browse files Browse the repository at this point in the history
annotations
  • Loading branch information
adityathebe authored and moshloop committed Jun 20, 2024
1 parent fbf2bd7 commit 0cac7f1
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 18 deletions.
1 change: 1 addition & 0 deletions common/src/components/Fields.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import clsx from 'clsx'

const schemes = {
"EnvVar": "[EnvVar](/reference/env-var)",
"MatchPattern": "[MatchPattern](/reference/types#match-pattern)",
"[]EnvVar": "[[]EnvVar](/reference/env-var)",
"CEL": "[CEL](/reference/scripting/cel)",
"Javascript": "[Javascript](/reference/scripting/javascript)",
Expand Down
69 changes: 55 additions & 14 deletions mission-control/docs/config-db/scrapers/kubernetes.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,18 +117,59 @@ There are 3 different ways to specify which value to use when finding related co

Kubernetes resources can be annotated with some special annotations that can direct the scraper to certain behaviors.

| Annotation | Description |
| ------------------------------------------------------------- | -------------------------------------------------------------------------- |
| `config-db.flanksource.com/tags: "key1:val1,key2:val2"` | Attach custom tags to the object. A config can have as many as `5` tags, so keep the custom tags limited. |
| `config-db.flanksource.com/ignore: true` | Exclude the object from being scraped along with all of its changes. |
| `config-db.flanksource.com/ignore-changes: <pattern>` | Exclude changes by type for the given object that matches the pattern. |
| `config-db.flanksource.com/ignore-change-severity: <pattern>` | Exclude changes by severity for the given object that matches the pattern. |

### Pattern matching

Pattern matching suports the following operations
<Fields
rows={[
{
field: 'config-db.flanksource.com/tags',
description: 'Attach custom tags to the object. A config can have as many as `5` tags, so keep the custom tags limited.',
scheme: '`key1:val1,key2:val2`'
},
{
field: 'config-db.flanksource.com/ignore',
description: 'Exclude the object from being scraped along with all of its changes.',
scheme: 'bool'
},
{
field: 'config-db.flanksource.com/ignore-changes',
description: 'Exclude changes by type for the given object that matches the pattern.',
scheme: 'MatchPattern'
},
{
field: 'config-db.flanksource.com/ignore-change-severity',
description: 'Exclude changes by severity for the given object that matches the pattern.',
scheme: 'MatchPattern'
}
]}
/>

### Examples

#### Exclude verbose changes from argo application

```yaml title="argo-application.yaml"
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: sock-shop
namespace: argo
annotations:
config-db.flanksource.com/ignore-changes: ReconciliationSucceeded
config-db.flanksource.com/ignore-change-severity: low
spec:
...
```

- Use `*` to exclude all.
- Prefix matching. Example: `Added*,Deleted*`
- Suffix matching. Example: `*Terminated`
- Negation will match everything but the pattern: Example: `!PodCrashLooping`
#### Excluding a particular secret from being scraped

```yaml title="secret.yaml"
apiVersion: v1
kind: Secret
metadata:
annotations:
config-db.flanksource.com/ignore: true
name: slack
namespace: default
type: Opaque
data:
token: ...
```
15 changes: 11 additions & 4 deletions mission-control/docs/reference/types.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ hide_title: true
title: Common Types
sidebar_position: 2
---

## Agent

An agent can be specified using:

- `local` - The primary mission control instance
- `uuid` of an agent
- `name` of and agent
- `all` match all/any agents
- `all` match all/any agents

## Cron

Expand All @@ -35,8 +36,6 @@ An agent can be specified using:
| `@daily` (or `@midnight`) | Run once a day at midnight | `0 0 * * *` |
| `@hourly` | Run once an hour at the beginning of the hour | `0 * * * *` |



## Duration

Valid time units are "s", "m", "h", "d", "w", "y". Eg:
Expand All @@ -52,7 +51,6 @@ Valid time units are "s", "m", "h", "d", "w", "y". Eg:

Sizes are string with a unit suffix e.g. `100` / `100b`, `10mb`, Valid size units are `kb`, `mb`, `gb`, `tb`


## Icon

One of the icons in the [flanksource-icons](https://github.com/flanksource/flanksource-icons/tree/main/svg) project
Expand All @@ -63,3 +61,12 @@ e.g.
- `Kubernetes::Pod`
- `argo`
- `aws-ebs-volume`

## Match Pattern

Pattern matching suports the following operations

- Use `*` to exclude all.
- Prefix matching. Example: `Added*,Deleted*`
- Suffix matching. Example: `*Terminated`
- Negation will match everything but the pattern: Example: `!PodCrashLooping`

0 comments on commit 0cac7f1

Please sign in to comment.