From 0cac7f1cc8af010f9a21ca4de0911c6553eb40a9 Mon Sep 17 00:00:00 2001 From: Aditya Thebe Date: Thu, 20 Jun 2024 21:31:21 +0545 Subject: [PATCH] chore: move MatchPattern to common types & add examples for annotations --- common/src/components/Fields.jsx | 1 + .../docs/config-db/scrapers/kubernetes.md | 69 +++++++++++++++---- mission-control/docs/reference/types.md | 15 ++-- 3 files changed, 67 insertions(+), 18 deletions(-) diff --git a/common/src/components/Fields.jsx b/common/src/components/Fields.jsx index e8b5c7b6..44263574 100644 --- a/common/src/components/Fields.jsx +++ b/common/src/components/Fields.jsx @@ -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)", diff --git a/mission-control/docs/config-db/scrapers/kubernetes.md b/mission-control/docs/config-db/scrapers/kubernetes.md index 766d49ce..a2ef4058 100644 --- a/mission-control/docs/config-db/scrapers/kubernetes.md +++ b/mission-control/docs/config-db/scrapers/kubernetes.md @@ -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: ` | Exclude changes by type for the given object that matches the pattern. | -| `config-db.flanksource.com/ignore-change-severity: ` | Exclude changes by severity for the given object that matches the pattern. | - -### Pattern matching - -Pattern matching suports the following operations + + +### 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: ... +``` \ No newline at end of file diff --git a/mission-control/docs/reference/types.md b/mission-control/docs/reference/types.md index 82f55fc9..8ffaf9db 100644 --- a/mission-control/docs/reference/types.md +++ b/mission-control/docs/reference/types.md @@ -3,6 +3,7 @@ hide_title: true title: Common Types sidebar_position: 2 --- + ## Agent An agent can be specified using: @@ -10,7 +11,7 @@ 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 @@ -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: @@ -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 @@ -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`