Skip to content

Commit d7d9ee6

Browse files
committed
doc updates
1 parent b5a9c74 commit d7d9ee6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+855
-843
lines changed

canary-checker/docs/reference/1-gcs-database-backup.mdx renamed to canary-checker/docs/reference/3-gcs-database-backup.mdx

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
title: GCS Database Backup
3+
sidebar_class_name: beta
34
---
45

56
# <Icon name="database2" /> Google Cloud SQL Backups
@@ -42,10 +43,10 @@ Durations are strings with an optional fraction and unit e.g. `300ms`, `1.5h` or
4243

4344
| Field | Description | Scheme | Required |
4445
| -------------- | ----------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------ | -------- |
45-
| `project` | GCP project\ name | _string_ | Yes |
46+
| `project` | GCP project name | _string_ | Yes |
4647
| `instance` | Google CloudSQL instance name | _string_ | Yes |
4748
| **Connection** | | | |
48-
| `connection` | Path of an existing connection e.g. `connection://aws/instance`/. Mutually exclusive with `credentials` <br /> <Commercial /> | <CommonLink to="connection">_Connections_</CommonLink> | |
49+
| `connection` | Path of an existing connection e.g. `connection://gcp`/. Mutually exclusive with `credentials` <br /> <Commercial /> | <CommonLink to="connection">_Connections_</CommonLink> | |
4950
| `credentials` | GCP Access Token File. <SkipOSS>Mutually exclusive with `connection`</SkipOSS> | <CommonLink to="authentication">_EnvVar_</CommonLink> | Yes |
5051

5152
### Connecting to GCP
@@ -72,7 +73,7 @@ spec:
7273

7374
3. `accessKey` and `secretKey` <CommonLink to="authentication">_EnvVar_</CommonLink> with the credentials stored in a secret.
7475

75-
```yaml title="aws.yaml"
76+
```yaml title="gcs-database-backup.yaml"
7677
apiVersion: canaries.flanksource.com/v1
7778
kind: Canary
7879
metadata:

canary-checker/docs/scripting/gotemplate.md

+3-6
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ To send `{{ .secret }}` as it is do this
3131
{{`{{ .secret }}`}}
3232
```
3333

34-
## Encoding
34+
## base64
3535

3636
### Encode
3737

@@ -46,8 +46,6 @@ Encode data as a Base64 string. Specifically, this uses the standard Base64 enco
4646

4747
Decode a Base64 string. This supports both standard ([RFC4648 &sect;4](https://tools.ietf.org/html/rfc4648#section-4)) and URL-safe ([RFC4648 &sect;5](https://tools.ietf.org/html/rfc4648#section-5)) encodings.
4848

49-
This function outputs the data as a string, so it may not be appropriate for decoding binary data. Use [`base64.DecodeBytes`](#base64.DecodeBytes)
50-
for binary data.
5149

5250
```go
5351
{{ base64.Decode "aGVsbG8gd29ybGQ=" }} // hello world
@@ -56,7 +54,6 @@ for binary data.
5654

5755

5856
:::note
59-
6057
For the functions that return an array, a Go `[]interface{}` is returned, regardless of whether or not the input was a different type.
6158
:::
6259

@@ -417,7 +414,7 @@ The value in decimal is {{ $val }}
417414

418415
### ParseFloat
419416

420-
_**Note:**_ See [`conv.ToFloat`](#tofloat) instead for a simpler and more flexible variant of this function.
417+
_**Note:**_ See [`conv.ToFloat`](#tofloat64) instead for a simpler and more flexible variant of this function.
421418

422419
Parses a string as an float64 for later use. Equivalent to [strconv.ParseFloat](https://golang.org/pkg/strconv/#ParseFloat)
423420

@@ -1803,7 +1800,7 @@ Parses a timestamp defined by the given layout. This wraps [`time.Parse`](https:
18031800
A number of pre-defined layouts are provided as constants, defined
18041801
[here](https://golang.org/pkg/time/#pkg-constants).
18051802

1806-
Just like [`time.Now`](#time-now), this is usually used in conjunction with other functions.
1803+
Just like [`time.Now`](#now), this is usually used in conjunction with other functions.
18071804

18081805
_Note: In the absence of a time zone indicator, `time.Parse` returns a time in UTC._
18091806

common/src/components/Fields.jsx

+49-11
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,22 @@ const schemes = {
99
"EnvVar": "[EnvVar](/reference/env-var)",
1010
"[]EnvVar": "[[]EnvVar](/reference/env-var)",
1111
"CEL": "[CEL](/reference/scripting/cel)",
12+
"Javascript": "[Javascript](/reference/scripting/javascript)",
13+
"Gotemplate": "[Go Template](/reference/scripting/gotemplate)",
1214
"Duration": "[Duration](/reference/types#duration)",
15+
"JSONPathOrString": "`string` or [JSONPath](https://jsonpath.com/)",
16+
"[]JSONPathOrString": "`[]string` or [[]JSONPath](https://jsonpath.com/)",
17+
"JSONPath": "[JSONPath](https://jsonpath.com/)",
1318
"Size": "[Size](/reference/types#size)",
1419
"Agent": "[Agent](/reference/types#agent)",
1520
"ResourceSelector": "[ResourceSelector](/reference/resource-selector)",
1621
"Connection": "[Connection](/reference/connections)",
1722
"string": "`string`",
1823
"Icon": "[Icon](/reference/types#icon)",
1924
"bool": "`boolean`",
20-
"NotificationURL": "[url](/reference/notifications/channels)",
21-
"NotificationConnection": "[Connection](/reference/connection)",
22-
"NotificationProperties": "[map[string]string](/reference/notifications/channels#properties)",
25+
"NotificationURL": "[Notification](/reference/notifications)",
26+
"NotificationConnection": "[Connection](/reference/connections)",
27+
"NotificationProperties": "[map[string]string](/reference/notifications#properties)",
2328
}
2429
export default function Fields({ common = [], rows = [], oneOf, anyOf, connection }) {
2530

@@ -52,7 +57,7 @@ export default function Fields({ common = [], rows = [], oneOf, anyOf, connectio
5257
rows = rows.concat([
5358
{
5459
field: oss ? null : "connection",
55-
description: "The connection to use, mutually exclusive with `username` and `password`",
60+
description: "The connection url to use, mutually exclusive with `username` and `password`",
5661
scheme: "Connection",
5762
},
5863
{
@@ -73,11 +78,38 @@ export default function Fields({ common = [], rows = [], oneOf, anyOf, connectio
7378
scheme: "EnvVar",
7479
}
7580
])
81+
}
82+
83+
if (connection == "sql") {
84+
rows = rows.concat([
85+
{
86+
field: oss ? null : "connection",
87+
description: "The connection url or name to use`",
88+
scheme: "Connection",
89+
},
90+
{
91+
field: !oss && rows.filter(i => i.field == "url").length == 0 ? "url" : null,
92+
description: "If `connection` is specified and it also includes a `url`, this field will take precedence",
93+
scheme: "string",
94+
},
95+
{
96+
field: oss && rows.filter(i => i.field == "url").length == 0 ? "url" : null,
97+
scheme: "string",
98+
},
99+
{
100+
field: "auth.username",
101+
scheme: "EnvVar",
102+
},
103+
{
104+
field: "auth.password",
105+
scheme: "EnvVar",
106+
}
107+
])
76108
} else if (connection == "git") {
77109
rows = rows.concat([
78110
{
79111
field: oss ? null : "connection",
80-
description: "The connection to use, mutually exclusive with `username` and `password`",
112+
description: "The connection url to use, mutually exclusive with `username` and `password`",
81113
scheme: "Connection",
82114
},
83115
{
@@ -106,7 +138,7 @@ export default function Fields({ common = [], rows = [], oneOf, anyOf, connectio
106138
rows = rows.concat([
107139
{
108140
field: oss ? null : "connection",
109-
description: "The connection to use, mutually exclusive with `accessKey` and `secretKey`",
141+
description: "The connection url to use, mutually exclusive with `accessKey` and `secretKey`",
110142
scheme: "Connection",
111143
},
112144
{
@@ -136,7 +168,7 @@ export default function Fields({ common = [], rows = [], oneOf, anyOf, connectio
136168
rows = rows.concat([
137169
{
138170
field: oss ? null : "connection",
139-
description: "The connection to use, mutually exclusive with `credentials`",
171+
description: "The connection url to use, mutually exclusive with `credentials`",
140172
scheme: "Connection",
141173
},
142174
{
@@ -149,7 +181,7 @@ export default function Fields({ common = [], rows = [], oneOf, anyOf, connectio
149181
rows = rows.concat([
150182
{
151183
field: oss ? null : "connection",
152-
description: "The connection to use, mutually exclusive with `host` and `port`",
184+
description: "The connection url to use, mutually exclusive with `host` and `port`",
153185
scheme: "Connection",
154186
},
155187
{
@@ -175,7 +207,7 @@ export default function Fields({ common = [], rows = [], oneOf, anyOf, connectio
175207
rows = rows.concat([
176208
{
177209
field: oss ? null : "connection",
178-
description: "The connection to use, mutually exclusive with `host`, `share`, and `credentials`",
210+
description: "The connection url to use, mutually exclusive with `host`, `share`, and `credentials`",
179211
scheme: "Connection",
180212
},
181213
{
@@ -212,7 +244,7 @@ export default function Fields({ common = [], rows = [], oneOf, anyOf, connectio
212244
rows = rows.concat([
213245
{
214246
field: oss ? null : "connection",
215-
description: "The connection to use, mutually exclusive with `tenantId`, `subscriptionId`, `clientId`, and `clientSecret`",
247+
description: "The connection url to use, mutually exclusive with `tenantId`, `subscriptionId`, `clientId`, and `clientSecret`",
216248
scheme: "Connection",
217249
},
218250
{
@@ -273,11 +305,17 @@ export default function Fields({ common = [], rows = [], oneOf, anyOf, connectio
273305
</blockquote>
274306
}
275307
{
276-
oneOf &&
308+
oneOf && oneOf.length == 2 &&
277309
<blockquote style={{ borderLeft: "2px solid var(--ifm-color-warning-light)" }}>
278310
<p>You must specify <code>{oneOf[0]}</code> or <code>{oneOf[1]}</code> but not both</p>
279311
</blockquote>
280312
}
313+
{
314+
oneOf && oneOf.length == 3 &&
315+
<blockquote style={{ borderLeft: "2px solid var(--ifm-color-warning-light)" }}>
316+
<p>You must specify one of <code>{oneOf[0]}</code>, <code>{oneOf[1]}</code> or <code>{oneOf[2]}</code></p>
317+
</blockquote>
318+
}
281319
</>
282320
)
283321
}

common/src/components/Scraper.jsx

+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
import React from 'react'
2+
import Admonition from '@theme/Admonition'
3+
import useDocusaurusContext from '@docusaurus/useDocusaurusContext'
4+
import Link from '@docusaurus/Link'
5+
import ReactMarkdown from 'react-markdown'
6+
import clsx from 'clsx'
7+
import Fields from './Fields'
8+
9+
const customScraperFields = [
10+
{
11+
"field": "id",
12+
"description": "A deterministic or natural id for the resource",
13+
"scheme": "JSONPathOrString",
14+
"required": true
15+
},
16+
{
17+
"field": "name",
18+
default: "`id`",
19+
"scheme": "JSONPathOrString"
20+
},
21+
{
22+
"field": "items",
23+
"description": "Extract multiple config items from this array",
24+
"scheme": "JSONPath"
25+
},
26+
{
27+
"field": "type",
28+
"description": "e.g. `File::Host`, `File::Tomcat`, `File::Pom`",
29+
"scheme": "JSONPathOrString",
30+
"required": "true"
31+
},
32+
{
33+
"field": "class",
34+
"scheme": "JSONPathOrString"
35+
},
36+
{
37+
"field": "format",
38+
"description": "Format of config item e.g. `xml`, `properties`",
39+
"default": "`JSON`",
40+
"scheme": "string"
41+
},
42+
{
43+
"field": "timestampFormat",
44+
"description": "Format to parse timestamps in `createFields` and `deletedFields`",
45+
"default": "RFC3339",
46+
"scheme": "Go time format"
47+
},
48+
{
49+
"field": "createFields",
50+
"description": "Identify the created time for a resource (if different to scrape time). If multiple fields are specified, the first non-empty value will be used",
51+
"scheme": "[]JSONPathOrString"
52+
},
53+
{
54+
"field": "deleteFields",
55+
"description": "Identify when a config item was deleted. If multiple fields are specified, the first non-empty value will be used",
56+
"scheme": "[]JSONPathOrString"
57+
},
58+
]
59+
60+
const commonsRows = [
61+
62+
{
63+
"field": "ignore",
64+
"description": "Fields to ignore and strip out of the config",
65+
"scheme": "[]JSONPath"
66+
},
67+
{
68+
"field": "properties",
69+
"description": "Custom templatable properties for the scraped config items.",
70+
"scheme": "[`[]ConfigProperty`](/reference/config-db/properties)"
71+
},
72+
{
73+
"field": "tags",
74+
"description": "Additional tags ",
75+
"scheme": "map[string]string"
76+
},
77+
]
78+
79+
export function Scraper({ name, edition, rows, ...props }) {
80+
81+
const { siteConfig } = useDocusaurusContext()
82+
83+
84+
return <Fields rows={rows} common={commonsRows} {...props} />
85+
86+
}
87+
88+
export function CustomScraper({ name, edition, rows, ...props }) {
89+
90+
const { siteConfig } = useDocusaurusContext()
91+
return <Fields rows={rows} common={commonsRows.concat(customScraperFields)} {...props} />
92+
93+
}

common/src/theme/MDXComponents/index.js

+7
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ import { FullImage } from '@site/src/components/Badges'
2929
import { CommonLink } from '@site/src/components/Link'
3030
import { ConfigTransform } from '@site/src/components/ConfigTransform'
3131
import { CustomField } from '@site/src/components/Badges'
32+
import Tabs from '@theme/Tabs';
33+
import TabItem from '@theme/TabItem';
34+
import { Scraper, CustomScraper } from '@site/src/components/Scraper'
3235

3336
const MDXComponents = {
3437
Icon: Icon,
@@ -48,6 +51,10 @@ const MDXComponents = {
4851
head: MDXHead,
4952
code: MDXCode,
5053
a: MDXA,
54+
Tabs: Tabs,
55+
Scraper: Scraper,
56+
CustomScraper: CustomScraper,
57+
TabItem: TabItem,
5158
pre: MDXPre,
5259
details: Details,
5360
Screenshot: Screenshot,

mission-control/docs/config-db/concepts/transform.md

+8-7
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Transform
33
---
44

5-
Transformations allows you to transform the scraped config items before they are saved, common use cases include:
5+
Transformations allows you to modify scraped config items before they are saved, common use cases include:
66

77
- Linking configuration items
88
- Removing extraneous or overly verbose fields
@@ -49,7 +49,8 @@ spec:
4949

5050
### Masking
5151

52-
Masking allows replacing sensitive fields with a hash or static string.
52+
Masking replaces sensitive fields with a hash or static string. A hash can be used to determine if a field changed without revealing original values.
53+
5354

5455
```yaml title="file-mask-scraper.yaml"
5556
apiVersion: configs.flanksource.com/v1
@@ -88,10 +89,10 @@ Masks are applied in the order they are specified in the configuration file.
8889
## Changes
8990

9091
### Exclusions
92+
Some configurations can change frequently and may not be relevant. For example, a `Kubernetes::Node` configuration changes often as pods launched and stopped. From the node's perspective, these image changes are irrelevant.
9193

92-
Some configs can have changes in high volume that may not be relevant. Example: A kubernetes Node config changes frequently as the pods in the cluster update their images. From the node's perspective the image changes are irrelevant.
94+
This is where exclusions become useful. Here's an example that ignores all image changes in a `Kubernetes::Node` configuration:
9395

94-
This is where exclusions can become handy. Here's an example that ignore all image changes in a kubernetes node config:
9596

9697
```yaml title="kubernetes-scraper.yaml"
9798
apiVersion: configs.flanksource.com/v1
@@ -111,7 +112,7 @@ spec:
111112

112113
### Mapping
113114

114-
When you encounter a diff change, unlike an event based change, it can sometimes appear cryptic. The summary of the change may not immediately indicate what the change is about. For example, the change 'status.images' might not be self-explanatory. To address this issue, we can assign types to these diff changes using mapping.
115+
When you encounter a diff change, unlike an event-based change, it can sometimes appear unclear. The summary of the change may not immediately indicate its purpose. For example, the change 'status.images' might not be self-explanatory. To clarify this, you can assign types to these diff changes using mapping.
115116

116117
```yaml title="kubernetes-scraper.yaml"
117118
apiVersion: configs.flanksource.com/v1
@@ -142,11 +143,11 @@ spec:
142143
| `filter` | Selects changes to apply the mapping | <CommonLink to="cel">CEL</CommonLink> with [Change Context](/reference/config-db/changes) |
143144
| `action` | What action to take on the change, if `delete` then the corresponding config item is marked as deleted | `delete` or `ignore` |
144145
| `type` | New change type | `string` |
145-
| `summary` | New summary of the change | [Go Template](/reference/scripting/template) |
146+
| `summary` | New summary of the change | <CommonLink to="gotemplate">Go Template</CommonLink> with [Change Context](/reference/config-db/changes) |
146147

147148
## Scripting
148149

149-
Scripting allows you to modify the scraped configuration using CEL before saving it to the database. This is useful for data normalization, default value population, sensitive field masking etc.
150+
Scripting modifies the scraped configuration using CEL before saving it to the database. This process is beneficial for data normalization, default value population, and sensitive field masking.
150151

151152
| Field | Description | Scheme | Context |
152153
| ------ | ----------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ |

mission-control/docs/config-db/index.mdx

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
slug: /config-db
33
hide_title: true
4+
title: Overview
45
hide_table_of_contents: true
56
pagination_next: playbooks/index
67
pagination_prev:
@@ -34,7 +35,7 @@ Under the hood the catalog is powered by [github.com/flanksource/config-db](http
3435
The catalog is comprised of:
3536

3637
* **Config Items** are individual resources e.g. `Pod`, `EBS`, `IAM Role`, `postgres.conf` scraped from external sources like [AWS](/config-db/scrapers/aws), [Kubernetes](/config-db/scrapers/kubernetes), [Azure](/config-db/scrapers/azure), [Azure Devops](/config-db/scrapers/azure-devops) , [Github](/config-db/scrapers/github)
37-
* **Changes** recorded against config items either through automatic change detection (diffs) or from sources like [Cloud Trail](/config-db/scrapers/aws#cloud-trail) or [Kubernetes Events](/config-db/scrapers/kubernetes#events)
38+
* **Changes** recorded against config items either through automatic change detection (diffs) or from sources like [Cloud Trail](/config-db/scrapers/aws#cloudtrail) or [Kubernetes Events](/config-db/scrapers/kubernetes#events)
3839
* **Insights** recorded against config items from external sources like [AWS Trusted Advisor](/config-db/scrapers/aws#trusted-advisor) or [Trivy](/config-db/scrapers/trivy)
3940
* **Relationships** between configuration items
4041

0 commit comments

Comments
 (0)