diff --git a/.gitignore b/.gitignore index 8ecf6d10..80d87b3e 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,5 @@ site/ node_modules .vscode modules/ +.aider* +.venv/ diff --git a/.gitmodules b/.gitmodules index 2c0b72c3..23d75ec9 100644 --- a/.gitmodules +++ b/.gitmodules @@ -10,3 +10,6 @@ [submodule "docs-vale-package"] path = docs-vale-package url = https://github.com/flanksource/docs-vale-package +[submodule "modules/duty"] + path = modules/duty + url = https://github.com/flanksource/duty.git diff --git a/common/src/components/Fields.jsx b/common/src/components/Fields.jsx index ef83f267..2d9da03a 100644 --- a/common/src/components/Fields.jsx +++ b/common/src/components/Fields.jsx @@ -6,27 +6,27 @@ import ReactMarkdown from 'react-markdown' 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)", - "Gotemplate": "[Go Template](/reference/scripting/gotemplate)", - "Duration": "[Duration](/reference/types#duration)", - "JSONPathOrString": "`string` or [JSONPath](https://jsonpath.com/)", - "[]JSONPathOrString": "`[]string` or [[]JSONPath](https://jsonpath.com/)", - "JSONPath": "[JSONPath](https://jsonpath.com/)", - "Size": "[Size](/reference/types#size)", - "Agent": "[Agent](/reference/types#agent)", - "ResourceSelector": "[ResourceSelector](/reference/resource-selector)", - "Connection": "[Connection](/reference/connections)", + "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)", + "gotemplate": "[Go Template](/reference/scripting/gotemplate)", + "duration": "[Duration](/reference/types#duration)", + "jsonpathorstring": "`string` or [JSONPath](https://jsonpath.com/)", + "[]jsonpathorstring": "`[]string` or [[]JSONPath](https://jsonpath.com/)", + "jsonpath": "[JSONPath](https://jsonpath.com/)", + "size": "[Size](/reference/types#size)", + "agent": "[Agent](/reference/types#agent)", + "resourceselector": "[ResourceSelector](/reference/resource-selector)", + "connection": "[Connection](/reference/connections)", "string": "`string`", - "Icon": "[Icon](/reference/types#icon)", + "icon": "[Icon](/reference/types#icon)", "bool": "`boolean`", "int": "`integer`", - "NotificationURL": "[Notification](/reference/notifications)", - "NotificationConnection": "[Connection](/reference/connections)", - "NotificationProperties": "[map[string]string](/reference/notifications#properties)", + "notificationurl": "[Notification](/reference/notifications)", + "notificationconnection": "[Connection](/reference/connections)", + "notificationproperties": "[map[string]string](/reference/notifications#properties)", } export default function Fields({ common = [], rows = [], oneOf, anyOf, connection }) { @@ -311,10 +311,10 @@ export default function Fields({ common = [], rows = [], oneOf, anyOf, connectio {row.anyOf && {row.anyOf.join(' | ')} } - {!row.anyOf && + {!row.anyOf && row.scheme && { - schemes[row.scheme] || (row.scheme ? row.scheme : 'string') + schemes[row.scheme.toLowerCase()] || (row.scheme ? row.scheme : 'string') } } diff --git a/mission-control/docs/config-db/concepts/changes.md b/mission-control/docs/config-db/concepts/changes.md index 547ebab3..0da24217 100644 --- a/mission-control/docs/config-db/concepts/changes.md +++ b/mission-control/docs/config-db/concepts/changes.md @@ -2,25 +2,25 @@ title: Changes --- -When you save a config item to ConfigDB, it also tracks its changes. These changes may come from external sources like Kubernetes events or Azure activities. Alternatively, they can be automatically detected by comparing the old config with the newly changed one. +When you save a config item to Config DB, it tracks its changes. These changes come from external sources like Kubernetes events or Azure activities. Alternatively, Mission Control can automatically detect changes by comparing the old config with the new one. -Changes are of two types +Changes are of two types: - Diff change - Event based change ### Diff Change -These are changes generated by ConfigDB by simply comparing the old and new config values. The image below shows a change where the port value was modified from 8080 to 3000. +Config DB generates these changes by comparing the old and new config values. The image below shows a change where the port value was modified from 8080 to 3000. ![Kubernetes Deployment Replica change](/img/config-changes.png) ### Event based change -These are changes provided by an external source example: Kubernetes Events & AWS CLoudtrail. Event based changes have a type associated to it. +External sources like Kubernetes Events and AWS CloudTrail provide these changes. Event-based changes have an associated type. -![Event based config changes of a Kubernetes Pod](/img/event-based-config-changes.png) +![Event-based config changes of a Kubernetes Pod](/img/event-based-config-changes.png) -See [Transformation Changes](./transform#changes) +See [Transformation Changes](./transform#changes). diff --git a/mission-control/docs/notifications/channels.md b/mission-control/docs/notifications/channels.md deleted file mode 100644 index 96212a0a..00000000 --- a/mission-control/docs/notifications/channels.md +++ /dev/null @@ -1,28 +0,0 @@ ---- -title: Channels ---- - -Mission control uses [Shoutrrr](https://github.com/containrrr/shoutrrr/) under the hood to deliver notifications. Most of the services in the Shoutrrr are supported. Here's the complete list: - -| Services | URL Format | -| ----------- | ---------------------------------------------------------------------------------------- | -| Bark | `bark://devicekey@host` | -| Discord | `discord://token@id` | -| Email | `smtp://username:password@host:port/?from=fromAddress&to=recipient1[,recipient2,...]` | -| Gotify | `gotify://gotify-host/token` | -| Google Chat | `googlechat://chat.googleapis.com/v1/spaces/FOO/messages?key=bar&token=baz` | -| IFTTT | `ifttt://key/?events=event1[,event2,...]&value1=value1&value2=value2&value3=value3` | -| Join | `join://shoutrrr:api-key@join/?devices=device1[,device2, ...][&icon=icon][&title=title]` | -| Mattermost | `mattermost://[username@]mattermost-host/token[/channel]` | -| Matrix | `matrix://username:password@host:port/[?rooms=!roomID1[,roomAlias2]]` | -| Ntfy | `ntfy://username:password@ntfy.sh/topic` | -| OpsGenie | `opsgenie://host/token?responders=responder1[,responder2]` | -| Pushbullet | `pushbullet://api-token[/device/#channel/email]` | -| Pushover | `pushover://shoutrrr:apiToken@userKey/?devices=device1[,device2, ...]` | -| Rocketchat | `rocketchat://[username@]rocketchat-host/token[/channel\| @recipient]` | -| Slack | `slack://[botname@]token-a/token-b/token-c` | -| Teams | `teams://group@tenant/altId/groupOwner?host=organization.webhook.office.com` | -| Telegram | `telegram://token@telegram?chats=@channel-1[,chat-id-1,...]` | -| Zulip Chat | `zulip://bot-mail:bot-key@zulip-domain/?stream=name-or-id&topic=name` | - -For more details please visit: [https://containrrr.dev/shoutrrr/0.8/services/overview/](https://containrrr.dev/shoutrrr/0.8/services/overview/) diff --git a/mission-control/docs/notifications/channels/discord.mdx b/mission-control/docs/notifications/channels/discord.mdx new file mode 100644 index 00000000..1d721055 --- /dev/null +++ b/mission-control/docs/notifications/channels/discord.mdx @@ -0,0 +1,105 @@ +# Discord + +:::note URL Format + discord://__`token`__@__`webhookid`__ +::: + +import { FaGear } from "react-icons/fa6"; +import Fields from '@site/src/components/Fields'; + + + + +## Getting a + +1. Click on the next to your channel name +![Screenshot 1](discord/sc-1.png) + +2. Click on **Integrations** +![Screenshot 2](discord/sc-2.png) + +3. Click on **Create Webhook** +![Screenshot 3](discord/sc-3.png) + +4. Set the name, channel and icon and then click on **Copy Webhook URL** +![Screenshot 4](discord/sc-4.png) + +5. Click on **Save Changes** +![Screenshot 5](discord/sc-5.png) + +6. Copy the `webhookId` and `token` fields from the URL + ``` + https://discord.com/api/webhooks/693853386302554172/W3dE2OZz4C13_4z_uHfDOoC7BqTW288s-z1ykqI0iJnY_HjRqMGO8Sc7YDqvf_KVKjhJ + └────────────────┘ └──────────────────────────────────────────────────────────────────┘ + webhook id token + + discord://W3dE2OZz4C13_4z_uHfDOoC7BqTW288s-z1ykqI0iJnY_HjRqMGO8Sc7YDqvf_KVKjhJ@693853386302554172 + └──────────────────────────────────────────────────────────────────┘ └────────────────┘ + token webhook id + ``` diff --git a/mission-control/docs/notifications/channels/discord/sc-1.png b/mission-control/docs/notifications/channels/discord/sc-1.png new file mode 100644 index 00000000..d92a07ad Binary files /dev/null and b/mission-control/docs/notifications/channels/discord/sc-1.png differ diff --git a/mission-control/docs/notifications/channels/discord/sc-2.png b/mission-control/docs/notifications/channels/discord/sc-2.png new file mode 100644 index 00000000..4d89db5f Binary files /dev/null and b/mission-control/docs/notifications/channels/discord/sc-2.png differ diff --git a/mission-control/docs/notifications/channels/discord/sc-3.png b/mission-control/docs/notifications/channels/discord/sc-3.png new file mode 100644 index 00000000..b5dda4de Binary files /dev/null and b/mission-control/docs/notifications/channels/discord/sc-3.png differ diff --git a/mission-control/docs/notifications/channels/discord/sc-4.png b/mission-control/docs/notifications/channels/discord/sc-4.png new file mode 100644 index 00000000..14726607 Binary files /dev/null and b/mission-control/docs/notifications/channels/discord/sc-4.png differ diff --git a/mission-control/docs/notifications/channels/discord/sc-5.png b/mission-control/docs/notifications/channels/discord/sc-5.png new file mode 100644 index 00000000..e1f50b06 Binary files /dev/null and b/mission-control/docs/notifications/channels/discord/sc-5.png differ diff --git a/mission-control/docs/notifications/channels/email.mdx b/mission-control/docs/notifications/channels/email.mdx new file mode 100644 index 00000000..0210701d --- /dev/null +++ b/mission-control/docs/notifications/channels/email.mdx @@ -0,0 +1,104 @@ +# Email + + +:::note URL Format +smtp://`username`:`password`@`host`:`port`/?from=`fromAddress`&to=`recipient1`[,`recipient2`,...] +::: + + diff --git a/mission-control/docs/notifications/channels/generic.mdx b/mission-control/docs/notifications/channels/generic.mdx new file mode 100644 index 00000000..a5ab1c30 --- /dev/null +++ b/mission-control/docs/notifications/channels/generic.mdx @@ -0,0 +1,120 @@ +# Generic +The Generic service can be used for any target that is not explicitly supported by Mission Control, as long as it +supports receiving the message via a POST request. +Usually, this requires customization on the receiving end to interpret the payload that it receives, and might +not be a viable approach. + + +import Fields from '@site/src/components/Fields'; + +### URL Fields + + + + + +## Custom headers +You can add additional HTTP headers to your request by adding query variables prefixed with `@` (`@key=value`). + +Using +```url +generic://example.com?@acceptLanguage=tlh-Piqd +``` +would result in the additional header being added: + +```http +Accept-Language: tlh-Piqd +``` + +## JSON template +By using the built in `JSON` template (`template=json`) you can create a generic JSON payload. The keys used for `title` and `message` can be overriden +by supplying the params/query values `titleKey` and `messageKey`. + +!!! example + ```json + { + "title": "Oh no!", + "message": "The thing happened and now there is stuff all over the area!" + } + ``` + +### Custom data fields +When using the JSON template, you can add additional key/value pairs to the JSON object by adding query variables prefixed with `$` (`$key=value`). + + +Using `generic://example.com?$projection=retroazimuthal` would yield: + +```json +{ + "title": "Amazing opportunities!", + "message": "New map book available for purchase.", + "projection": "retroazimuthal" +} +``` + +## Shortcut URL +You can just add `generic+` as a prefix to your target URL to use it with the generic service, so +```url +https://example.com/api/v1/postStuff +``` +would become +```url +generic+https://example.com/api/v1/postStuff +``` + +:::note + Any query variables added to the URL will be escaped so that they can be forwarded to the remote server. That means that you cannot use `?template=json` with the `generic+https://`, just use `generic://` instead! +::: + + + diff --git a/mission-control/docs/notifications/channels/googlechat/hangouts-1.png b/mission-control/docs/notifications/channels/googlechat/hangouts-1.png new file mode 100644 index 00000000..4786cb31 Binary files /dev/null and b/mission-control/docs/notifications/channels/googlechat/hangouts-1.png differ diff --git a/mission-control/docs/notifications/channels/googlechat/hangouts-2.png b/mission-control/docs/notifications/channels/googlechat/hangouts-2.png new file mode 100644 index 00000000..552697cb Binary files /dev/null and b/mission-control/docs/notifications/channels/googlechat/hangouts-2.png differ diff --git a/mission-control/docs/notifications/channels/googlechat/hangouts-3.png b/mission-control/docs/notifications/channels/googlechat/hangouts-3.png new file mode 100644 index 00000000..55028f03 Binary files /dev/null and b/mission-control/docs/notifications/channels/googlechat/hangouts-3.png differ diff --git a/mission-control/docs/notifications/channels/googlechat/hangouts-4.png b/mission-control/docs/notifications/channels/googlechat/hangouts-4.png new file mode 100644 index 00000000..2b0dbadd Binary files /dev/null and b/mission-control/docs/notifications/channels/googlechat/hangouts-4.png differ diff --git a/mission-control/docs/notifications/channels/ifttt.mdx b/mission-control/docs/notifications/channels/ifttt.mdx new file mode 100644 index 00000000..03ae9b72 --- /dev/null +++ b/mission-control/docs/notifications/channels/ifttt.mdx @@ -0,0 +1,40 @@ +# IFTTT + + +:::info URL Format + ifttt://__`key`__/?events=__`event1`__[,__`event2`__,...]&value1=__`value1`__&value2=__`value2`__&value3=__`value3`__ +::: + +import Fields from '@site/src/components/Fields' + + + diff --git a/mission-control/docs/reference/notifications/channels/index.md b/mission-control/docs/notifications/channels/index.md similarity index 82% rename from mission-control/docs/reference/notifications/channels/index.md rename to mission-control/docs/notifications/channels/index.md index fb51d751..8e17a05f 100644 --- a/mission-control/docs/reference/notifications/channels/index.md +++ b/mission-control/docs/notifications/channels/index.md @@ -1,13 +1,25 @@ --- title: Channels +sidebar_position: 4 +collapsed: false --- +:::tip Shoutrr + Notifications in Mission Control are powered by [github.com/containrrr/shoutrrr](https://github.com/containrrr/shoutrrr) +::: + + +When creating a notification you can either specify a connection or a custom URL + + +## Custom URLs + + | Service | URL format | | --------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | | [Bark](./bark) | *bark://__`devicekey`__@__`host`__* | | [Discord](./discord) | *discord://__`token`__@__`id`__* | | [Email](./email) | *smtp://__`username`__:__`password`__@__`host`__:__`port`__/?from=__`fromAddress`__&to=__`recipient1`__[,__`recipient2`__,...]* | -| [Gotify](./gotify) | *gotify://__`gotify-host`__/__`token`__* | | [Google Chat](./googlechat) | *googlechat://chat.googleapis.com/v1/spaces/FOO/messages?key=bar&token=baz* | | [IFTTT](./ifttt) | *ifttt://__`key`__/?events=__`event1`__[,__`event2`__,...]&value1=__`value1`__&value2=__`value2`__&value3=__`value3`__* | | [Join](./join) | *join://shoutrrr:__`api-key`__@join/?devices=__`device1`__[,__`device2`__, ...][&icon=__`icon`__][&title=__`title`__]* | @@ -22,11 +34,5 @@ title: Channels | [Teams](./teams) | *teams://__`group`__@__`tenant`__/__`altId`__/__`groupOwner`__?host=__`organization`__.webhook.office.com* | | [Telegram](./telegram) | *telegram://__`token`__@telegram?chats=__`@channel-1`__[,__`chat-id-1`__,...]* | | [Zulip Chat](./zulip) | *zulip://__`bot-mail`__:__`bot-key`__@__`zulip-domain`__/?stream=__`name-or-id`__&topic=__`name`__* | - -## Specialized services - -| Service | Description | -| --------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | -| [Logger](./logger) | Writes notification to a configured go `log.Logger` | | [Generic Webhook](./generic) | Sends notifications directly to a webhook | diff --git a/mission-control/docs/notifications/channels/matrix.mdx b/mission-control/docs/notifications/channels/matrix.mdx new file mode 100644 index 00000000..3340cfc8 --- /dev/null +++ b/mission-control/docs/notifications/channels/matrix.mdx @@ -0,0 +1,44 @@ +# Matrix + +:::note Usage of the `title` parameter + Do note that Matrix will discard any information put in the `title` parameter as the service has no analogue to a + a title. Instead, use a custom message format to supply your wanted title as part of the message. +::: + +:::note URL Format + *matrix://__`user`__:__`password`__@__`host`__:__`port`__/[?rooms=__`!roomID1`__[,__`roomAlias2`__]][&disableTLS=yes]* +::: + + +## Authentication + +If no `user` is specified, the `password` is treated as the authentication token. This means that no matter what login +flow your server uses, if you can manually retrieve a token, then Shoutrrr can use it. + +### Password Login Flow + +If a `user` and `password` is supplied, the `m.login.password` login flow is attempted if the server supports it. + +## Rooms + +If `rooms` are *not* specified, the service will send the message to all the rooms that the user has currently joined. + +Otherwise, the service will only send the message to the specified rooms. If the user is *not* in any of those rooms, +but have been invited to it, it will automatically accept that invite. + +**Note**: The service will **not** join any rooms unless they are explicitly specified in `rooms`. If you need the user +to join those rooms, you can send a notification with `rooms` explicitly set once. + +### Room Lookup + +Rooms specified in `rooms` will be treated as room IDs if the start with a `!` and used directly to identify rooms. If +they have no such prefix (or use a *correctly escaped* `#`) they will instead be treated as aliases, and a directory +lookup will be used to resolve their corresponding IDs. + +**Note**: Don't use unescaped `#` for the channel aliases as that will be treated as the `fragment` part of the URL. +Either omit them or URL encode them, I.E. `rooms=%23alias:server` or `rooms=alias:server` + +### TLS + +If you do not have TLS enabled on the server you can disable it by providing `disableTLS=yes`. This will effectively +use `http` intead of `https` for the API calls. diff --git a/mission-control/docs/notifications/channels/mattermost.mdx b/mission-control/docs/notifications/channels/mattermost.mdx new file mode 100644 index 00000000..a84c5b4e --- /dev/null +++ b/mission-control/docs/notifications/channels/mattermost.mdx @@ -0,0 +1,34 @@ +# MatterMost + +:::info URL Format + mattermost://[__`username`__@]__`mattermost-host`__/__`token`__[/__`channel`__][?icon=__`smiley`__] +::: + + +## Creating a Webhook in MatterMost + +1. Open up the Integrations page by clicking on *Integrations* within the menu +![Screenshot 1](mattermost/1.PNG) + +2. Click *Incoming Webhooks* +![Screenshot 2](mattermost/2.PNG) + +3. Click *Add Incoming Webhook* +![Screenshot 3](mattermost/3.PNG) + +4. Fill in the information for the webhook and click *Save* +![Screenshot 4](mattermost/4.PNG) + +5. If you did everything correctly, MatterMost will give you the *URL* to your newly created webhook +![Screenshot 5](mattermost/5.PNG) + +6. Format the service URL + ``` + https://your-domain.com/hooks/bywsw8zt5jgpte3nm65qjiru6h + └────────────────────────┘ + token + mattermost://your-domain.com/bywsw8zt5jgpte3nm65qjiru6h + └────────────────────────┘ + token + ``` + diff --git a/mission-control/docs/notifications/channels/mattermost/1.PNG b/mission-control/docs/notifications/channels/mattermost/1.PNG new file mode 100644 index 00000000..6a385d91 Binary files /dev/null and b/mission-control/docs/notifications/channels/mattermost/1.PNG differ diff --git a/mission-control/docs/notifications/channels/mattermost/2.PNG b/mission-control/docs/notifications/channels/mattermost/2.PNG new file mode 100644 index 00000000..814f5662 Binary files /dev/null and b/mission-control/docs/notifications/channels/mattermost/2.PNG differ diff --git a/mission-control/docs/notifications/channels/mattermost/3.PNG b/mission-control/docs/notifications/channels/mattermost/3.PNG new file mode 100644 index 00000000..411a56f4 Binary files /dev/null and b/mission-control/docs/notifications/channels/mattermost/3.PNG differ diff --git a/mission-control/docs/notifications/channels/mattermost/4.PNG b/mission-control/docs/notifications/channels/mattermost/4.PNG new file mode 100644 index 00000000..e94535b3 Binary files /dev/null and b/mission-control/docs/notifications/channels/mattermost/4.PNG differ diff --git a/mission-control/docs/notifications/channels/mattermost/5.PNG b/mission-control/docs/notifications/channels/mattermost/5.PNG new file mode 100644 index 00000000..9afa2b05 Binary files /dev/null and b/mission-control/docs/notifications/channels/mattermost/5.PNG differ diff --git a/mission-control/docs/notifications/channels/ntfy.mdx b/mission-control/docs/notifications/channels/ntfy.mdx new file mode 100644 index 00000000..53312a43 --- /dev/null +++ b/mission-control/docs/notifications/channels/ntfy.mdx @@ -0,0 +1,102 @@ +# Ntfy + +Upstream docs: https://docs.ntfy.sh/publish/ + + +import Fields from '@site/src/components/Fields'; + + diff --git a/mission-control/docs/notifications/channels/opsgenie.mdx b/mission-control/docs/notifications/channels/opsgenie.mdx new file mode 100644 index 00000000..a31ac7f3 --- /dev/null +++ b/mission-control/docs/notifications/channels/opsgenie.mdx @@ -0,0 +1,106 @@ +# OpsGenie + +:::info URL Format + opsgenie://api.opsgenie.com/**`apiKey`** +::: + +: + +import Fields from '@site/src/components/Fields'; + + + + + +## Creating an API Key + +1. Navigate to **Settings** → **Integration List** + +2. Click **API** → **Add** + +3. Check *Create and Update Access* and *Enabled* + +3. Click **Save Integration** + +4. Copy the *API Key* + + diff --git a/mission-control/docs/notifications/channels/pushbullet.mdx b/mission-control/docs/notifications/channels/pushbullet.mdx new file mode 100644 index 00000000..1edff816 --- /dev/null +++ b/mission-control/docs/notifications/channels/pushbullet.mdx @@ -0,0 +1,25 @@ +# Pushbullet + +:::info URL Format + pushbullet://__`api-token`__[/__`device`__/#__`channel`__/__`email`__] +::: + + +import Fields from '@site/src/components/Fields'; + +### URL Fields + + diff --git a/mission-control/docs/notifications/channels/pushover.mdx b/mission-control/docs/notifications/channels/pushover.mdx new file mode 100644 index 00000000..f848413a --- /dev/null +++ b/mission-control/docs/notifications/channels/pushover.mdx @@ -0,0 +1,52 @@ +# Pushover + +:::info URL Format + pushover://shoutrrr:__`apiToken`__@__`userKey`__/?devices=__`device1`__[,__`device2`__, ...]&title=**Custom+Title**&priority=**1** +::: + + + + +## Getting the keys from Pushover + +1. Navigate to the [Pushover dashboard](https://pushover.net/) to get your __`userKey`__ in the top right. +![Screenshot 1](pushover/po-1.png) + +2. The `Name` column of the device list is what is used to refer to your devices (__`device1`__ etc.) +![Screenshot 4](pushover/po-4.png) + +3. Click on an application at the bottom of the page +![Screenshot 2](pushover/po-2.png) + +4. The __`apiToken`__ is displayed at the top of the application page. +![Screenshot 3](pushover/po-3.png) + + +See [Pushover API documentation](https://pushover.net/api#messages) for more information. diff --git a/mission-control/docs/notifications/channels/pushover/po-1.png b/mission-control/docs/notifications/channels/pushover/po-1.png new file mode 100644 index 00000000..1797b1e7 Binary files /dev/null and b/mission-control/docs/notifications/channels/pushover/po-1.png differ diff --git a/mission-control/docs/notifications/channels/pushover/po-2.png b/mission-control/docs/notifications/channels/pushover/po-2.png new file mode 100644 index 00000000..d6685009 Binary files /dev/null and b/mission-control/docs/notifications/channels/pushover/po-2.png differ diff --git a/mission-control/docs/notifications/channels/pushover/po-3.png b/mission-control/docs/notifications/channels/pushover/po-3.png new file mode 100644 index 00000000..90c333cf Binary files /dev/null and b/mission-control/docs/notifications/channels/pushover/po-3.png differ diff --git a/mission-control/docs/notifications/channels/pushover/po-4.png b/mission-control/docs/notifications/channels/pushover/po-4.png new file mode 100644 index 00000000..653e4315 Binary files /dev/null and b/mission-control/docs/notifications/channels/pushover/po-4.png differ diff --git a/mission-control/docs/notifications/channels/rocketchat.mdx b/mission-control/docs/notifications/channels/rocketchat.mdx new file mode 100644 index 00000000..b4b51cf1 --- /dev/null +++ b/mission-control/docs/notifications/channels/rocketchat.mdx @@ -0,0 +1,32 @@ +# Rocket.chat + +:::note URL Format + rocketchat://[__`username`__@]__`rocketchat-host`__/__`token`__[/__`channel`|`@recipient`__]* +::: + + + +## Creating a Webhook in Rocket.chat + +1. Open up the chat Administration by clicking on *Administration* menu +![Screenshot 1](rocketchat/1.png) + +2. Open *Integrations* and then click *New* +![Screenshot 2](rocketchat/2.png) + +3. Fill in the information for the webhook and click *Save*. Please don't forget to Enable your integration. +![Screenshot 3](rocketchat/3.png) + +5. If you did everything correctly, Rocket.chat will give you the *URL* and *Token* to your newly created webhook. +![Screenshot 4](rocketchat/4.png) + +6. Format the service URL + ``` + rocketchat://your-domain.com/8eGdRzc9r4YYNyvge/2XYQcX9NBwJBKfQnphpebPcnXZcPEi32Nt4NKJfrnbhsbRfX + └────────────────────────────────────────────────────────────────┘ + token + ``` + + + +See [official guide](https://docs.rocket.chat/guides/administrator-guides/integrations). diff --git a/mission-control/docs/notifications/channels/rocketchat/1.png b/mission-control/docs/notifications/channels/rocketchat/1.png new file mode 100644 index 00000000..fdf8fb50 Binary files /dev/null and b/mission-control/docs/notifications/channels/rocketchat/1.png differ diff --git a/mission-control/docs/notifications/channels/rocketchat/2.png b/mission-control/docs/notifications/channels/rocketchat/2.png new file mode 100644 index 00000000..7f985174 Binary files /dev/null and b/mission-control/docs/notifications/channels/rocketchat/2.png differ diff --git a/mission-control/docs/notifications/channels/rocketchat/3.png b/mission-control/docs/notifications/channels/rocketchat/3.png new file mode 100644 index 00000000..b961fb80 Binary files /dev/null and b/mission-control/docs/notifications/channels/rocketchat/3.png differ diff --git a/mission-control/docs/notifications/channels/rocketchat/4.png b/mission-control/docs/notifications/channels/rocketchat/4.png new file mode 100644 index 00000000..019fe9d8 Binary files /dev/null and b/mission-control/docs/notifications/channels/rocketchat/4.png differ diff --git a/mission-control/docs/notifications/channels/slack.mdx b/mission-control/docs/notifications/channels/slack.mdx new file mode 100644 index 00000000..190cfe04 --- /dev/null +++ b/mission-control/docs/notifications/channels/slack.mdx @@ -0,0 +1,133 @@ +# Slack + + +The Slack notification service uses either [Slack Webhooks](https://api.slack.com/messaging/webhooks) or the +[Bot API](https://api.slack.com/methods/chat.postMessage) to send messages. + + + + + + + +## Examples + +```uri title="Bot API" +slack://xoxb:123456789012-1234567890123-4mt0t4l1YL3g1T5L4cK70k3N@C001CH4NN3L?color=good&title=Great+News&icon=man-scientist&botname=Shoutrrrbot +``` + +```uri title="Hook with color" +slack://hook:WNA3PBYV6-F20DUQND3RQ-Webc4MAvoacrpPakR8phF0zi@webhook?color=%2300FF00&title=Great+News&icon=man-scientist&botname=Shoutrrrbot +``` + + +## Create a Slack bot + +1. Create a new app + + Visit https://api.slack.com/apps and create a new app. Use the "From an app manifest" option. + + ![App Creation](/img/slack-app-creation.png) + +2. Set up OAuth permission + + After creating the app, you should be navigated to the app's homepage. On the left panel menu, go to Features->OAuth & Permissions. Scroll down and you should see the **"Scopes"** section + + ![](/img/slack-app-oauth-scope.png) + + Set `chat:write` permission + +3. Install the Slack app + + While still on the same page, scroll up to the "OAuth Tokens for Your Workspace" section. Install the newly created app on your Slack workspace. + + ![](/img/slack-app-install-to-workspace.png) + + Once you install the app you should see the OAuth token + + ![](/img/slack-bot-user-oauth-token.png) + + +4. Create kubernetes secret + + You will need to create a new kubernetes secret using the OAuth token created above + + ```yaml title="slack-secret.yaml" + --- + apiVersion: v1 + kind: Secret + metadata: + name: slack + namespace: default + stringData: + token: xoxb-910094966996-6596865117477-n7iujSYWmHtnTLMmITdm8z06 + ``` +

+5. Create Connection + + Create a new slack connection using that kubernetes secret. The channel that should receive the notification should go into `spec.username` field. + + ```yaml title="slack-connection.yaml" + apiVersion: mission-control.flanksource.com/v1 + kind: Connection + metadata: + name: slack + namespace: default + spec: + type: slack + url: + value: slack://$(password)@$(username) + username: + value: mission-control-notifications # <-- slack channel name + password: + valueFrom: + secretKeyRef: + name: slack + key: token + ``` +

+6. Create the notification CRD + + ```yaml title="notification.yaml" + apiVersion: mission-control.flanksource.com/v1 + kind: Notification + metadata: + name: http-check-alerts + namespace: default + spec: + events: + - check.failed + to: + # use the slack connection as the recipient for this notification + connection: connection://default/slack + filter: check.type == 'http' + ``` +

+7. Apply the notification + ``` + kubectl apply -f notification.yaml` + ``` + diff --git a/mission-control/docs/notifications/channels/teams.mdx b/mission-control/docs/notifications/channels/teams.mdx new file mode 100644 index 00000000..cb0f750e --- /dev/null +++ b/mission-control/docs/notifications/channels/teams.mdx @@ -0,0 +1,60 @@ +# Teams + +:::info URL Format + teams://__`group`__@__`tenant`__/__`altId`__/__`groupOwner`__?host=__`organization`__.webhook.office.com +::: + +import Fields from '@site/src/components/Fields'; + +### Parameters + + + + +## Setting up a webhook + +To be able to use the Microsoft Teams notification service, you first need to set up a custom webhook. +Instructions on how to do this can be found in [this guide](https://docs.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/connectors-using#setting-up-a-custom-incoming-webhook) + +## Extracting the token + +The token is extracted from your webhook URL: + +

https://<organization>.webhook.office.com/webhookb2/<group>@<tenant>/IncomingWebhook/<altId>/<groupOwner>
diff --git a/mission-control/docs/notifications/channels/telegram.mdx b/mission-control/docs/notifications/channels/telegram.mdx new file mode 100644 index 00000000..dc250f85 --- /dev/null +++ b/mission-control/docs/notifications/channels/telegram.mdx @@ -0,0 +1,62 @@ +# Telegram + + +Telegram messages are sent with `parseMode=MarkdownV2` + + +:::info URL Format + telegram://__`token`__@telegram?chats=__`channel-1`__[,__`chat-id-1`__,...][¬ification=no[&preview=false][&parseMode=html] +::: + +import Fields from '@site/src/components/Fields'; + + + + +:::info + `preview` and `notification` are inverted in regards to their API counterparts (`disable_web_page_preview` and `disable_notification`) +::: + + +## Getting a token for Telegram + +1. Talk to [the botfather](https://core.telegram.org/bots#6-botfather). +2. See [getting a chat id](https://github.com/GabrielRF/telegram-id). + diff --git a/mission-control/docs/notifications/channels/zulip.mdx b/mission-control/docs/notifications/channels/zulip.mdx new file mode 100644 index 00000000..fe9fe56a --- /dev/null +++ b/mission-control/docs/notifications/channels/zulip.mdx @@ -0,0 +1,34 @@ +# Zulip Chat + +## + +The shoutrrr service URL should look like this: +:::info URL Format + zulip://__`botmail`__:__`botkey`__@__`host`__/?stream=__`stream`__&topic=__`topic`__ +::: + + +import Fields from '@site/src/components/Fields'; + + diff --git a/mission-control/docs/notifications/events/components.md b/mission-control/docs/notifications/events/components.md index d2db941a..ad952fc7 100644 --- a/mission-control/docs/notifications/events/components.md +++ b/mission-control/docs/notifications/events/components.md @@ -1,5 +1,6 @@ --- title: Components +description: Events that fire on topology/component changes --- Component status updates emit the following events diff --git a/mission-control/docs/notifications/events/configs.md b/mission-control/docs/notifications/events/configs.md index 49f0273a..5bd4eee7 100644 --- a/mission-control/docs/notifications/events/configs.md +++ b/mission-control/docs/notifications/events/configs.md @@ -1,5 +1,6 @@ --- title: Configs +description: Events that fire on config changes and health --- Configs emit events when their health changes or when they are created, modified, or removed. diff --git a/mission-control/docs/notifications/events/health-checks.md b/mission-control/docs/notifications/events/health-checks.md index f6c38cb4..a4aa18a5 100644 --- a/mission-control/docs/notifications/events/health-checks.md +++ b/mission-control/docs/notifications/events/health-checks.md @@ -1,4 +1,7 @@ -# Health Checks +--- +description: Events that fire when health checks pass or fail +title: Health Checks +--- Health checks emit 2 events diff --git a/mission-control/docs/notifications/events/index.md b/mission-control/docs/notifications/events/index.md index 83e6a7a1..51c78e47 100644 --- a/mission-control/docs/notifications/events/index.md +++ b/mission-control/docs/notifications/events/index.md @@ -2,3 +2,7 @@ title: Events sidebar_position: 2 --- + +import DocCardList from '@theme/DocCardList'; + + diff --git a/mission-control/docs/notifications/examples/slack.md b/mission-control/docs/notifications/examples/slack.md deleted file mode 100644 index dbb5e4ba..00000000 --- a/mission-control/docs/notifications/examples/slack.md +++ /dev/null @@ -1,90 +0,0 @@ ---- -title: Slack Notification ---- - -In this example, we will walk through the process of creating a health check alert notification on slack starting from creating the Slack bot token. - -## Create a Slack bot - -### Create a new app - -Visit https://api.slack.com/apps and create a new app. Use the "From an app manifest" option. - -![App Creation](/img/slack-app-creation.png) - -### Set up OAuth permission - -After creating the app, you should be navigated to the app's homepage. On the left panel menu, go to Features->OAuth & Permissions. Scroll down and you should see the **"Scopes"** section - -![](/img/slack-app-oauth-scope.png) - -Set `chat:write` permission - -### Install the Slack app - -While still on the same page, scroll up to the "OAuth Tokens for Your Workspace" section. Install the newly created app on your Slack workspace. - -![](/img/slack-app-install-to-workspace.png) - -Once you install the app you should see the OAuth token - -![](/img/slack-bot-user-oauth-token.png) - -## Set up the notification - -### Create kubernetes secret - -We'll create a new kubernetes secret using the OAuth token we just created. - -```yaml title="slack-secret.yaml" ---- -apiVersion: v1 -kind: Secret -metadata: - name: slack - namespace: default -stringData: - token: xoxb-910094966996-6596865117477-n7iujSYWmHtnTLMmITdm8z06 -``` - -### Create Connection - -Then, we create a new slack connection using that kubernetes secret. The channel that should receive the notification should go into `spec.username` field. - -```yaml title="slack-connection.yaml" ---- -apiVersion: mission-control.flanksource.com/v1 -kind: Connection -metadata: - name: flanksource - namespace: default -spec: - type: slack - url: - value: slack://$(password)@$(username) - username: - value: mission-control-notifications # <-- slack channel name - password: - valueFrom: - secretKeyRef: - name: slack - key: token -``` - -### Create notification - -```yaml title="http-check-notification.yaml" ---- -apiVersion: mission-control.flanksource.com/v1 -kind: Notification -metadata: - name: http-check-alerts - namespace: default -spec: - events: - - check.failed - to: - # use the slack connection as the recipient for this notification - connection: connection://flanksource - filter: check.type == 'http' -``` diff --git a/mission-control/docs/notifications/index.mdx b/mission-control/docs/notifications/index.mdx index 34521136..9ef5da84 100644 --- a/mission-control/docs/notifications/index.mdx +++ b/mission-control/docs/notifications/index.mdx @@ -1,18 +1,20 @@ --- pagination_next: registry/index pagination_prev: canary-checker/health-checks -title: Notifications +title: Overview +sidebar_position: 1 --- + import Notification from "../reference/notifications/_notification.mdx" -Notifications can be sent based on different type of events occuring including: +# Notifications + +Mission Control provides a flexible, event-based notification system that enables filtering and templating of notifications via email, push, slack, teams, etc. -- Health check failing (`check.failed`) -- Aggregated health of a topology failing (`component.unhealthy`) -- A scraped config item health (`config.unhealthy`) +Notifications are triggered by events. An event is a specific occurrence or change in state within the system. For example, notifications can be granular such as a health check failing or a pod crashlooping - or high level based on the health of the system as a whole. -```yaml title="http-check.yaml" +```yaml title="check-failed.yaml" apiVersion: mission-control.flanksource.com/v1 kind: Notification metadata: @@ -20,32 +22,45 @@ metadata: namespace: default spec: events: - - check.passed - filter: check.type == 'http' + - check.failed to: email: alerts@acme.com ``` +This notification will send an email to `alerts@acme.com` whenever a health check fails. + ## Templating -Notification title and bodies can be templated using Go Templates -```yaml title="template-title.yaml" +You can use Go Templates to customize the content of notification titles and bodies. This allows you to include dynamic information from the event that triggered the notification. + +For example, the following notification definition uses a Go Template to include the name and health status of the check in the notification title: + +```yaml title="notification-template" apiVersion: mission-control.flanksource.com/v1 kind: Notification spec: - // highlight-next-line title: Check {{.check.name}} is {{.check.health}} ``` -## Filtering +In this example `{{.check.name}}` and `{{.check.health}}` are placeholders that will be replaced with the actual values of the `name` and `health` fields from the [check](/reference/canary-checker/check) object associated with the event. + + +:::tip Markdown +All notification templates in Mission Control are defined in markdown, and depending on the support of the notification channel in use it will either be converted to HTML or plain text. +::: -Notifications can be filtered using CEL expressions. The filters have access to same [variables](./events) that can be used in the templates. + +## Filtering Events + +Mission Control allows you to fine-tune your notification delivery by filtering events using CEL. This enables you to specify precise conditions that dictate when a notification should be triggered. For instance, you can configure notifications to be sent only for specific event types, specific resources, or when certain conditions are met. + +The CEL filters you define have access to the same set of variables as the templates, providing flexibility in defining your filtering criteria. These variables, representing various attributes and properties of the events, empower you to create highly targeted notifications. + +To illustrate, consider a scenario where you want to receive notifications exclusively for failed HTTP checks. The following example demonstrates how to achieve this using a CEL filter: ```yaml title="filter-http.yaml" ---- -# Only send a notification for HTTP checks apiVersion: mission-control.flanksource.com/v1 kind: Notification metadata: @@ -53,9 +68,16 @@ metadata: spec: events: - check.failed + # Filter for events where the check type is 'http' // highlight-next-line filter: check.type == 'http' to: - connection: connection://slack/flanksource - title: Check {{.check.name}} is {{.check.health}} + email: alerts@acme.com +``` + +In this example: + +- The `filter` field specifies the CEL expression `check.type == 'http'`. +- This expression evaluates to true only when the `type` attribute of the [check](/reference/canary-checker/check) object is equal to `'http'`. +- Consequently, notifications will be sent only for events that satisfy this condition, ensuring that you are alerted specifically for failed HTTP checks. ``` diff --git a/mission-control/docs/playbooks/concepts/templating.mdx b/mission-control/docs/playbooks/concepts/templating.mdx index 8aa0f1e5..2b910c0c 100644 --- a/mission-control/docs/playbooks/concepts/templating.mdx +++ b/mission-control/docs/playbooks/concepts/templating.mdx @@ -14,7 +14,6 @@ You can use templating to access data from your configs, health checks, and comp To use templating in your playbooks, you can use the following syntax: - `{{.context.property}}` Where: @@ -24,10 +23,8 @@ Where: For example, to get the namespace of a Kubernetes deployment, you would use the following template: - `{{.config.tags.namespace}}` - ### Example The following playbook scales a Kubernetes deployment to a specified number of replicas. diff --git a/mission-control/docs/reference/config-db/changes.md b/mission-control/docs/reference/config-db/changes.md index 8f64c8c4..488aec2f 100644 --- a/mission-control/docs/reference/config-db/changes.md +++ b/mission-control/docs/reference/config-db/changes.md @@ -1,5 +1,6 @@ --- title: Changes +description: Fields available during change filtering / mapping --- | Field | Description | Scheme | diff --git a/mission-control/docs/reference/config-db/config.md b/mission-control/docs/reference/config-db/config.md index bb7b8bcd..68b00a57 100644 --- a/mission-control/docs/reference/config-db/config.md +++ b/mission-control/docs/reference/config-db/config.md @@ -1,6 +1,7 @@ --- title: Config sidebar_position: 4 +description: Fields available during lookup and transformation --- | Field | Description | Scheme | | diff --git a/mission-control/docs/reference/config-db/index.md b/mission-control/docs/reference/config-db/index.md index bffa2a38..00b29a6d 100644 --- a/mission-control/docs/reference/config-db/index.md +++ b/mission-control/docs/reference/config-db/index.md @@ -3,25 +3,7 @@ title: Config DB sidebar_position: 4 --- -| Field | Description | Scheme | | -| ----------------- | -------------------------------------- | ------------------- | ------------------- | -| `id` | ID of the config item | `uuid` | | -| `external_id` | Unique aliases that refer to the same item | `[]string` | `AmazonEC2/i-abcd`, `aws::ec2::instance:/i-abcd` | -| `agent_id` | The agent which scrapped the item | `uuid` | | -| `name` | The name of the config item | `string` | | -| `type` | The type of the config item | `string` | `EC2::Instance`, `Kubernetes::Pod`, `Azure:VM` | -| `config_class` | A non-cloud specific class of resources | `string` | `VM` | -| `config` | The config of the config item | `JSON` | | -| `description` | The description of the config item | `string` | | -| `namespace` | The namespace of the config item | `string` | | -| `parent_id` | The parent ID of the config item | `uuid` | | -| `scraper_id` | ID of the scraper | `uuid` | | -| `source` | The source of the config item | `string` | | -| `status` | The externally reported status of the item using [is-healthy](https://github.com/flanksource/is-healthy) | `string` | `Healthy`,`Progressing`, `Terminated` | -| `tags` | Tags or labels | `map[string]string` | | -| `created_at` | When the item was created (could be before the last scrape time) | `time.Date` | | -| `updated_at` | When the config item was last materially changed | `time.Date` | | -| `delete_reason` | The reason why an item was deleted, `STALE` items can be "undeleted" | `string` | `STALE`, `FROM_ATTRIBUTE`, `FROM_EVENT`,`FROM_DELETE_FIELD` | -| `deleted_at` | The time when a config item has been detected as removed | `time` | | -| `last_scraped_at` | When the config item was last scraped | `time.Date` | | +import DocCardList from '@theme/DocCardList'; + + diff --git a/mission-control/docs/reference/config-db/properties.md b/mission-control/docs/reference/config-db/properties.md index feeb6c53..53f45e56 100644 --- a/mission-control/docs/reference/config-db/properties.md +++ b/mission-control/docs/reference/config-db/properties.md @@ -1,5 +1,7 @@ --- title: Property +description: Property fields for config items + --- | Field | Description | Scheme | Required | diff --git a/mission-control/docs/reference/config-db/scrape-result.md b/mission-control/docs/reference/config-db/scrape-result.md index 552ae848..763fa412 100644 --- a/mission-control/docs/reference/config-db/scrape-result.md +++ b/mission-control/docs/reference/config-db/scrape-result.md @@ -1,5 +1,6 @@ --- title: Scrape Result +description: Fields available during scrape transform --- | Field | Description | Scheme | diff --git a/mission-control/docs/reference/connections/Notifications/discord.mdx b/mission-control/docs/reference/connections/Notifications/discord.mdx new file mode 100644 index 00000000..ff62dcbb --- /dev/null +++ b/mission-control/docs/reference/connections/Notifications/discord.mdx @@ -0,0 +1,26 @@ +--- +title: Discord +--- + +```yaml +apiVersion: mission-control.flanksource.com/v1 +kind: Connection +metadata: + name: discord-connection + namespace: default +spec: + discord: + token: your-discord-token + webhookID: your-webhook-id +``` + + diff --git a/mission-control/docs/reference/connections/Notifications/ntfy.mdx b/mission-control/docs/reference/connections/Notifications/ntfy.mdx new file mode 100644 index 00000000..e01ed8f1 --- /dev/null +++ b/mission-control/docs/reference/connections/Notifications/ntfy.mdx @@ -0,0 +1,38 @@ +```yaml +apiVersion: mission-control.flanksource.com/v1 +kind: Connection +metadata: + name: ntfy-connection + namespace: default +spec: + ntfy: + topic: your-topic + host: your-host + username: + value: your-username + password: + value: your-password +``` + + diff --git a/mission-control/docs/reference/connections/Notifications/pushbullet.mdx b/mission-control/docs/reference/connections/Notifications/pushbullet.mdx new file mode 100644 index 00000000..e619aeb2 --- /dev/null +++ b/mission-control/docs/reference/connections/Notifications/pushbullet.mdx @@ -0,0 +1,31 @@ +--- +title: Pushbullet +--- + +```yaml +apiVersion: mission-control.flanksource.com/v1 +kind: Connection +metadata: + name: pushbullet-connection + namespace: default +spec: + pushbullet: + token: + value: your-pushbullet-token + targets: + - target1 + - target2 +``` + + diff --git a/mission-control/docs/reference/connections/Notifications/pushover.mdx b/mission-control/docs/reference/connections/Notifications/pushover.mdx new file mode 100644 index 00000000..15470206 --- /dev/null +++ b/mission-control/docs/reference/connections/Notifications/pushover.mdx @@ -0,0 +1,45 @@ +--- +title: Pushover +--- + +```yaml +apiVersion: mission-control.flanksource.com/v1 +kind: Connection +metadata: + name: pushover-connection + namespace: default +spec: + pushover: + token: + value: your-pushover-token + user: your-user-key +``` + + diff --git a/mission-control/docs/reference/connections/Notifications/slack.mdx b/mission-control/docs/reference/connections/Notifications/slack.mdx new file mode 100644 index 00000000..23b5e34c --- /dev/null +++ b/mission-control/docs/reference/connections/Notifications/slack.mdx @@ -0,0 +1,65 @@ +--- +title: Slack +--- + +```yaml title="Example Slack Connection" +apiVersion: mission-control.flanksource.com/v1 +kind: Connection +metadata: + name: slack-connection + namespace: default +spec: + slack: + token: + value: your-slack-token + channel: Cxxxxxxxxxx + botName: your-bot-name + color: "#36a64f" + icon: ":robot_face:" + threadTS: "1234567890.123456" + title: "Notification Title" +``` + +This example: +1. Uses `token` to authenticate the Slack bot. +2. Sends messages to the specified `channel`. +3. Sets the `botName` to identify the bot. +4. Optionally sets the `color` of the message border. +5. Optionally sets the `icon` for the bot. +6. Optionally sends the message as a reply in a thread using `threadTS`. +7. Optionally prepends a `title` above the message. + + diff --git a/mission-control/docs/reference/connections/Notifications/smtp.mdx b/mission-control/docs/reference/connections/Notifications/smtp.mdx new file mode 100644 index 00000000..40cdffef --- /dev/null +++ b/mission-control/docs/reference/connections/Notifications/smtp.mdx @@ -0,0 +1,82 @@ +--- +title: SMTP +--- + +```yaml +apiVersion: mission-control.flanksource.com/v1 +kind: Connection +metadata: + name: smtp-connection + namespace: default +spec: + smtp: + host: your-smtp-host + username: + value: your-username + password: + value: your-password + insecureTLS: true + encryption: auto + port: 587 + fromAddress: your-from-address + toAddresses: + - recipient1@example.com + - recipient2@example.com + subject: your-email-subject + auth: Plain +``` + + diff --git a/mission-control/docs/reference/connections/Notifications/telegram.mdx b/mission-control/docs/reference/connections/Notifications/telegram.mdx new file mode 100644 index 00000000..ef31e712 --- /dev/null +++ b/mission-control/docs/reference/connections/Notifications/telegram.mdx @@ -0,0 +1,30 @@ +--- +title: Telegram +--- + +```yaml +apiVersion: mission-control.flanksource.com/v1 +kind: Connection +metadata: + name: telegram-connection + namespace: default +spec: + telegram: + token: + value: your-telegram-token + chats: + value: your-chat-id +``` + + diff --git a/mission-control/docs/reference/connections/azure.mdx b/mission-control/docs/reference/connections/azure.mdx index cce87689..67eed221 100644 --- a/mission-control/docs/reference/connections/azure.mdx +++ b/mission-control/docs/reference/connections/azure.mdx @@ -4,3 +4,23 @@ title: Azure + +## Example + +This example demonstrates how to configure an Azure connection in Mission Control: + +```yaml title="azure-connection.yaml" +apiVersion: v1 +kind: Connection +metadata: + name: azure-connection +spec: + azure: + clientID: + value: your-client-id + clientSecret: + value: your-client-secret + tenantID: your-tenant-id + subscriptionId: subscription-id +``` + diff --git a/mission-control/docs/reference/connections/gcp.mdx b/mission-control/docs/reference/connections/gcp.mdx index 9941cd53..65630b68 100644 --- a/mission-control/docs/reference/connections/gcp.mdx +++ b/mission-control/docs/reference/connections/gcp.mdx @@ -15,6 +15,29 @@ There are 3 options when connecting to GCP: GKE [workload identity](https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity) (the default if no `connection` or `credentials` is specified) +## Example + +This example demonstrates how to configure a GCP connection using a YAML file. + +```yaml title="gcp-connection-example.yaml" +apiVersion: canaries.flanksource.com/v1 +kind: Canary +metadata: + name: example-gcp-connection +spec: + interval: 60 + folder: + - name: gcs auth test + path: gcs://example-bucket + gcpConnection: + connection: connection://gcp/example +``` + +This example: +1. Configures a GCP connection to a bucket named `example-bucket`. +2. Uses the `connection://gcp/example` connection string. +3. Sets the interval to 60 seconds. + ```yaml title="gcs-connection.yaml" diff --git a/mission-control/docs/reference/connections/git.md b/mission-control/docs/reference/connections/git.md index 41575fc6..cbcca369 100644 --- a/mission-control/docs/reference/connections/git.md +++ b/mission-control/docs/reference/connections/git.md @@ -5,8 +5,6 @@ title: Git Git connections are used for [GitOps](/playbooks/actions/gitops) playbook actions and [Health Checks](/canary-checker/reference/git) -## Git - ```yaml apiVersion: mission-control.flanksource.com/v1 kind: Connection diff --git a/mission-control/docs/reference/connections/postgres.mdx b/mission-control/docs/reference/connections/postgres.mdx new file mode 100644 index 00000000..3b9ea9d0 --- /dev/null +++ b/mission-control/docs/reference/connections/postgres.mdx @@ -0,0 +1,52 @@ +--- +title: Postgres +--- + +```yaml +apiVersion: mission-control.flanksource.com/v1 +kind: Connection +metadata: + name: payments-database + namespace: default +spec: + postgres: + database: + value: payments + host: + value: postgres.host.com + insecureTLS: true + username: + valueFrom: + secretKeyRef: + name: payments-database-credentials + key: POSTGRES_USER + password: + valueFrom: + secretKeyRef: + name: payments-database-credentials + key: POSTGRES_PASSWORD +``` + + diff --git a/mission-control/docs/reference/connections/sftp.mdx b/mission-control/docs/reference/connections/sftp.mdx index 795dbc5a..5ac47154 100644 --- a/mission-control/docs/reference/connections/sftp.mdx +++ b/mission-control/docs/reference/connections/sftp.mdx @@ -2,3 +2,46 @@ title: SFTP --- + +## Example + +```yaml +apiVersion: v1 +kind: Secret +metadata: + name: sftp-connection +type: Opaque +data: + host: c3RlcC5leGFtcGxlLmNvbQ== # base64 encoded value of "step.example.com" + username: dXNlcm5hbWU= # base64 encoded value of "username" + password: cGFzc3dvcmQ= # base64 encoded value of "password" +--- +apiVersion: mission-control/v1 +kind: Connection +metadata: + name: example-sftp +spec: + sftp: + host: + valueFrom: + secretKeyRef: + name: sftp-connection + key: host + username: + valueFrom: + secretKeyRef: + name: sftp-connection + key: username + password: + valueFrom: + secretKeyRef: + name: sftp-connection + key: password + port: 22 + path: /upload +``` + +This example: +1. Creates a Kubernetes Secret to store the SFTP connection details. +2. Defines a Connection resource that references the secret for the SFTP connection. +3. Specifies the SFTP server's host, username, password, port, and path. diff --git a/mission-control/docs/reference/connections/smb.mdx b/mission-control/docs/reference/connections/smb.mdx index 6c73bfe3..1e52ef4c 100644 --- a/mission-control/docs/reference/connections/smb.mdx +++ b/mission-control/docs/reference/connections/smb.mdx @@ -3,4 +3,21 @@ title: SMB / CIFS --- +```yaml +apiVersion: v1 +kind: Connection +metadata: + name: example-smb-connection +spec: + smb: + server: "smb.example.com" + username: "exampleUser" + password: "examplePassword" + port: 445 + share: "exampleShare" +``` + + + + diff --git a/mission-control/docs/reference/notifications/_notification.mdx b/mission-control/docs/reference/notifications/_notification.mdx index 8a133de8..076463d4 100644 --- a/mission-control/docs/reference/notifications/_notification.mdx +++ b/mission-control/docs/reference/notifications/_notification.mdx @@ -1,20 +1,54 @@ -| Field | Description | Scheme | Required | Templatable | -| ---------- | --------------------------------------------------------------------------------------------------- | ----------------------------------------------------- | -------- | ----------- | -| `events` | | [[]Event](./events) | `true` | | -| `to` | Notification recipient | [`Recipient`](#recipient) | `true` | | -| `title` | Channel dependant e.g. subject for email | Go Template | | `true` | -| `template` | Channel dependant e.g. email body for email | Go Template | | `true` | -| `filter` | Filter out events. If the filter evaluates to true, the notification is processed - else discarded. | CEL | | | + > Only one recipient can be specified diff --git a/mission-control/sidebars.js b/mission-control/sidebars.js index 250e1f50..d4f653df 100644 --- a/mission-control/sidebars.js +++ b/mission-control/sidebars.js @@ -99,68 +99,8 @@ const sidebars = { ], notificationsSidebar: [ { - type: 'doc', - id: 'notifications/index', - label: 'Overview' - }, - - { - type: 'category', - label: 'Events', - link: { - type: 'generated-index', - title: 'Notification Events', - slug: '/notifications/events' - }, - items: [ - { - type: 'doc', - id: 'notifications/events/configs', - label: 'Configs' - }, - { - type: 'doc', - id: 'notifications/events/components', - label: 'Components' - }, - { - type: 'doc', - id: 'notifications/events/health-checks', - label: 'Health Checks' - }, - ] - }, - { - type: 'doc', - id: 'notifications/channels', - label: 'Channels' - }, - { - type: 'category', - label: 'Examples', - items: [ - { - type: 'doc', - id: 'notifications/examples/kube-podcrashlooping', - label: 'PodCrashLooping' - }, - { - type: 'doc', - id: 'notifications/examples/kube-job-failing', - label: 'Kubernetes Job Failing' - }, - ] - }, - { - type: 'category', - label: 'Tutorials', - items: [ - { - type: 'doc', - id: 'notifications/examples/slack', - label: 'Slack' - } - ] + type: 'autogenerated', + dirName: "notifications" } ], registrySidebar: [ diff --git a/modules/duty b/modules/duty new file mode 160000 index 00000000..84792eda --- /dev/null +++ b/modules/duty @@ -0,0 +1 @@ +Subproject commit 84792edaa2969f286ee6283731cf5449b15f63c1