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

Moshloopv2 #244

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ site/
.docusaurus
node_modules
.vscode
modules/
17 changes: 7 additions & 10 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
[submodule "mission-control/canary-checker/canary-checker"]
path = mission-control/canary-checker/canary-checker
url = https://github.com/flanksource/canary-checker
[submodule "mission-control/modules/config-db"]
path = mission-control/modules/config-db
[submodule "modules/config-db"]
path = modules/config-db
url = https://github.com/flanksource/config-db.git
[submodule "mission-control/modules/mission-control"]
path = mission-control/modules/mission-control
[submodule "modules/mission-control"]
path = modules/mission-control
url = https://github.com/flanksource/mission-control.git
[submodule "mission-control/modules/canary-checker"]
path = mission-control/modules/canary-checker
url = https://github.com/flanksource/canary-checker
[submodule "modules/canary-checker"]
path = modules/canary-checker
url = https://github.com/flanksource/canary-checker.git
[submodule "docs-vale-package"]
path = docs-vale-package
url = https://github.com/flanksource/docs-vale-package
23 changes: 23 additions & 0 deletions CONVENTIONS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
1. Use an active, present tense voice
2. Do not use any salesy or marketing terms, Do not use adverbs
3. Use MDX formatting
4. Do not use the first person, Use "you" or "your team"
5. Do not use archaic language
6. Do not use oxymorons
7. Precede every command with an explanation of what the command does. After the command, provide additional details about the command, such as what the arguments do and why your reader is using them.
8. Avoid pop culture references, gender assumptions, holidays, hemisphere seasons, and other exclusionary language
9. Do not tell people how they feel
10. Explicitly tell the user to create or open each file you’ll have them use.
11. Like commands, always introduce a file or script by describing its general purpose, then explain any changes that the reader will be making in the file. Without these explanations, readers won’t be able to customize, update, or troubleshoot issues in the long run.
12. If you’re asking the reader to write code, follow the same approach for commands: introduce the code block with a high-level explanation of what it does. Then show the code, and then call out any important details.
13. Avoid adverbs and complex language
14. Use markdown codeblocks with a language and a title
15. Do not remove any "```" or "//highlight-next-line" text
16. Do not use the term "this document", when referring to the system or product being documented always use "Mission Control"
17. For examples using the following structure:
Introduction of example
Example Code
This example:
1. Using `field1` to perform A
2. Using `field2` to perform B
3. Achieves the result
15 changes: 15 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.PHONY: lint
lint:
vale sync
vale canary-checker/docs
vale mission-control/docs
markdownlint mission-control/docs
markdownlint canary-checker/docs


.PHONY:
sync:
git submodule update --init --recursive

update-submodules:
git submodule update --remote --merge && git submodule sync
6 changes: 6 additions & 0 deletions canary-checker/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
watch:
npm exec -c 'docusaurus start'

.PHONY:
sync:
git submodule update --init --recursive
132 changes: 132 additions & 0 deletions canary-checker/docs/concepts/expressions/_transform_fields.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
<Fields rows={[
{
field: "start",
description: "The time the check or event logically started (e.g if coming from an external source)",
scheme: "time.Time",
priority: 1,
required: false
},
{
field: "pass",
description: "Set to true if the health check is passing",
scheme: "bool",
priority: 2,
required: true
},
{
field: "invalid",
description: "Set to true if the check is not configured correctly, and can never pass",
scheme: "bool",
priority: 2,
required: false
},
{
field: "error",
description: "An error message to be shown, if non-empty sets `pass: false` automatically",
scheme: "string",
priority: 1,
required: false
},

{
field: "deletedAt",
description: "The time the check or event logically ended",
scheme: "time.Time",
priority: 1,
required: false
},
{
field: "duration",
description: "Time in ms to use for the duration of the check",
scheme: "int64",
priority: 2,
required: false
},

{
field: "message",
description: "Informational message to be shown to users",
scheme: "string",
priority: 1,
required: false
},

{
field: "name",
description: "Name of the check to use, the name will be used to lookup existing checks to update",
priority: 2,
scheme: "string",
required: true
},
{
field: "namespace",
description: null,
priority: 1,
scheme: "string",
required: false
},
{
field: "description",
description: null,
scheme: "string",
required: false
},
{
field: "type",
description: null,
scheme: "string",
required: false
},
{
field: "labels",
priority: 1,
description: null,
scheme: "map[string]string",
required: false
},

{
field: "detail",
description: null,
scheme: "interface{}",
required: false
},
{
field: "data",
description: null,
scheme: "map[string]interface{}",
required: false
},
{
field: "metrics",
description: "Add custom metrics to be exported",
scheme: "[[]Metric](../metrics/custom-metrics#metric)",
required: false
},
{
field: "icon",
description: null,
priority: 1,
scheme: "Icon",
required: false
},

{
field: "endpoint",
description: null,
scheme: "string",
required: false
},
{
field: "displayType",
description: null,
scheme: "string",
required: false
},
{
field: "transformDeleteStrategy",
description: "How to handle checks that were returned in a previous transformation, but not in the current ",
anyOf: ["MarkHealthy", "MarkUnhealthy", "Ignore"],
required: false
}
]}/>
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
title: Transformation
---

import TransformFields from './_transform_fields.mdx'



The `transform` can be used to convert one canary check into multiple checks programmatically.

Expand Down Expand Up @@ -38,3 +41,8 @@ In the above example, the check will return multiple alerts from alertmanager. B
But if we want to display each alert as its own check in the UI, we can use the `transform` function for this. The transform function takes a `Template` as input and the output from the template expected are the checks in JSON format.

For example, if there are 9 different alerts, each alert will have its own check that can be managed and interacted with equally.

<TransformFields/>



105 changes: 58 additions & 47 deletions canary-checker/docs/getting-started.mdx
Original file line number Diff line number Diff line change
@@ -1,68 +1,80 @@
---
title: Getting Started
---

import { HiOutlineExternalLink } from "react-icons/hi";

# Getting Started

<Step step={1} name="Install canary checker">
1. Install canary checker using helm

```bash
helm repo add flanksource https://flanksource.github.io/charts
helm repo update
helm install canary-checker \
flanksource/canary-checker \
-n "canary-checker" \
--create-namespace
```
<p/>

2. Create a new check

```bash
helm repo add flanksource https://flanksource.github.io/charts
helm repo update
helm install canary-checker flanksource/canary-checker -n "canary-checker" --create-namespace
```
</Step>
<Step step={2} name="Create a new check">
```yaml title="canary.yaml"
apiVersion: canaries.flanksource.com/v1
kind: Canary
metadata:
name: http-check
spec:
interval: 30
http:
- name: basic-check
url: https://httpbin.demo.aws.flanksource.com/status/200
- name: failing-check
url: https://httpbin.demo.aws.flanksource.com/status/500
```
<p/>
3. And then apply it to the cluster:

```shell
kubectl apply -f canary.yaml
```
<p/>
<Details summary="Run the check locally">
You can also run the check locally to see its output by using the [cli](./cli)

```yaml title="canary.yaml"
apiVersion: canaries.flanksource.com/v1
kind: Canary
metadata:
name: http-check
spec:
interval: 30
http:
- name: basic-check
url: https://httpbin.demo.aws.flanksource.com/status/200
- name: failing-check
url: https://httpbin.demo.aws.flanksource.com/status/500
```
```bash
canary-checker run canary.yaml
```

And then apply it to the cluster:
<Asciinema id="594517" width="850px"/>
</Details>

```shell
kubectl apply -f canary.yaml
```

:::info
You can also run the check locally to see its output by using the [cli](./cli)
4. Check the status via kubectl

```bash
canary-checker run canary.yaml
```
```shell
kubectl get canary
```

<Asciinema id="594517" width="850px"/>
:::
<Asciinema id="tXluDS5sH68gVdko4qctIZEC1"/>

</Step>
<Step name="Check the status" step={3}>
5. Port Forward the dashboard

```shell
kubectl get canary
```
You can access the web dashboard by forwarding the port:

<Asciinema id="tXluDS5sH68gVdko4qctIZEC1"/>
```bash
kubectl -n canary-checker port-forward svc/canary-checker-ui 8080:80
```
<p/>
6. View the dashboard

</Step>
<Step step={4} name="Check the Dashboard">
The dashboard can be accessed at <HiOutlineExternalLink/>[http://localhost:8080](http://localhost:8080)

You can access the web dashboard by forwarding the port:

```bash
kubectl -n canary-checker port-forward svc/canary-checker-ui 8080:80
```

![](./images/http-checks.png)
![](./images/http-checks.png)

[http://localhost:8080](http://localhost:8080)

The canary checker itself only presents an API. To view the data graphically, the Flanksource UI is required, and is installed by default. The UI should be configured in [values.yaml](https://github.com/flanksource/canary-checker/blob/699f31a2326034f761ba1b30d966436d6318dd06/chart/values.yaml#L105) to allow external access via ingress

Expand All @@ -74,7 +86,6 @@ The canary checker itself only presents an API. To view the data graphically, th

More details regarding ingress configuration can be found in the [kubernetes documentation](https://kubernetes.io/docs/concepts/services-networking/ingress/)

</Step>

## Getting Help

Expand Down
Loading
Loading