Skip to content

Commit

Permalink
Moshloop (#208)
Browse files Browse the repository at this point in the history
* wip

* chore: updates

* chore: updates

* chore: docs

* chore: wip

* chore update

* chore: doc updates

* chore: doc updates

* chore: markdown and spelling fixes

* chore: add submodules

* chore: markdown fixes
  • Loading branch information
moshloop authored May 14, 2024
1 parent 7c505f4 commit 6305595
Show file tree
Hide file tree
Showing 64 changed files with 367 additions and 478 deletions.
10 changes: 5 additions & 5 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[submodule "mission-control/modules/canary-checker"]
path = mission-control/modules/canary-checker
url = https://github.com/flanksource/canary-checker.git
[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
url = https://github.com/flanksource/config-db.git
[submodule "mission-control/modules/mission-control"]
path = mission-control/modules/mission-control
url = https://github.com/flanksource/mission-control.git
[submodule "mission-control/canary-checker/canary-checker"]
path = mission-control/canary-checker/canary-checker
[submodule "mission-control/modules/canary-checker"]
path = mission-control/modules/canary-checker
url = https://github.com/flanksource/canary-checker
9 changes: 9 additions & 0 deletions .markdownlint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"MD033": false,
"MD004": false,
"MD045": false,
"MD013": false,
"MD012": false,
"MD024": false,
"MD040": false
}
2 changes: 1 addition & 1 deletion canary-checker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ Metrics exposed by. anary-checler

| Metric | Type | Description |
| ---------------------------------------------- | --------- | ------------------------------------------- |
| canary_check | Guage | Set to 0 when passing and 1 when failing |
| canary_check | Gauge | Set to 0 when passing and 1 when failing |
| canary_check_success_count | Counter | |
| canary_check_failed_count | Counter | |
| canary_check_info | Info | |
Expand Down
6 changes: 1 addition & 5 deletions canary-checker/docs/comparisons/blackbox-exporter.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
# Canary-Checker vs Prometheus blackbox exporter



[Prometheus Blackbox Exporter](https://github.com/prometheus/blackbox_exporter) is a prometheus exporter for probing HTTP, HTTPS, DNS, TCP, ICMP and gRPC.


| | Blackbox Exporter | Canary Checker |
| ------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
| Prometheus Exporter | Yes | Yes |
Expand All @@ -22,8 +19,7 @@
| Secrets | Via [Probe](https://prometheus-operator.dev/docs/operator/api/#monitoring.coreos.com/v1.Probe) | |
| **Check Types** | | |
| Synthetic | No | Builtin check types for any test exporting JUnit test results e.g. (k6, playwright, robot, postman, etc) |
| Infrastructre | No | Verify the ability to launch new pods, create new EC2 instances or push and pull from docker / helm / git repositories |
| Infrastructure | No | Verify the ability to launch new pods, create new EC2 instances or push and pull from docker / helm / git repositories |
| Backup | No | Check backups via Restic, S3, SMB, SFTP, GCS |
| Compliance | No | AWS Config Rules, Flanksource Config DB |
| Alert Aggregation | No | Alert Manager, AWS Cloudwatch, Dynatrace |

2 changes: 0 additions & 2 deletions canary-checker/docs/concepts/grafana.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ Default grafana dashboards are available. After you deploy Grafana, these dashbo

![](/img/grafana-dashboard.png)



### Prometheus

The helm chart can install a `ServiceMonitor` for the prometheus operator, by enabling the serviceMonitor flag
Expand Down
1 change: 0 additions & 1 deletion canary-checker/docs/concepts/image-variants.md

This file was deleted.

5 changes: 3 additions & 2 deletions canary-checker/docs/concepts/metrics-exporter.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ metadata:
```
This snippet will retrieve the `last_result.results.max` value from the last execution ensuring data is not duplicated or missed

```go
"@timestamp" : {
{{- if last_result.results.max }}
Expand Down Expand Up @@ -183,7 +184,7 @@ The max value is saved in the `transform` section using:
| `valueExpr` | An expression to derive the header value from | `Expression` | |
| `labels` | Labels for prometheus metric (values can be templated) | `map[string]string` | |

Expresions can make use of the following variables:
Expressions can make use of the following variables:

### **Expression Variables**

Expand All @@ -194,7 +195,7 @@ Expresions can make use of the following variables:
| `check.name` | Check name | `string` |
| `check.description` | Check description | `string` |
| `check.labels` | Dynamic labels attached to the check | `map[string]string` |
| `check.endpoint` | Endpoint (usally a URL) | `string` |
| `check.endpoint` | Endpoint (usually a URL) | `string` |
| `check.duration` | Duration in milliseconds | `int64` |
| `canary.name` | Canary name | `string` |
| `canary.namespace` | Canary namespace | `string` |
Expand Down
2 changes: 1 addition & 1 deletion canary-checker/docs/concepts/secret-management.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ rules:

:::

# Recommendations
## Recommendations

Kubernetes Secrets are, by default, stored unencrypted in the API server's underlying data store (etcd). Anyone with API access can retrieve or modify a Secret, and so can anyone with access to etcd. With this in mind, it is recommended to implement some level of security to prevent unauthorized access to your Kubernetes secrets.
You may consider the following for your encryption and security needs:
Expand Down
2 changes: 1 addition & 1 deletion canary-checker/docs/examples/newman.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ spec:
command: ["/start.sh"]
```
By configuring newman to export JUnit to the `testResults` folder, canary-checker will pick up the results and make then available display formating and health evaluation.
By configuring newman to export JUnit to the `testResults` folder, canary-checker will pick up the results and make then available display formatting and health evaluation.

```bash title="start.sh"
set -x
Expand Down
2 changes: 1 addition & 1 deletion canary-checker/docs/examples/playwright.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ spec:
command: ["/start.sh"]
```
By configuring playwright to export JUnit to the `testResults` folder, canary-checker will pick up the results and make then available display formating and health evaluation.
By configuring playwright to export JUnit to the `testResults` folder, canary-checker will pick up the results and make then available display formatting and health evaluation.

```bash title="start.sh"
mkdir -p /tmp/junit-results
Expand Down
4 changes: 3 additions & 1 deletion canary-checker/docs/health-checks.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
---
pagination_next: notifications/index
pagination_prev: topology/index
slug: /canary-checker
title: Health Checks
---
Expand All @@ -22,7 +24,7 @@ Active infrastructure checks provision infrastructure (e.g. EC2 Instances, Kuber

</Step>

<Step step={3} name="Integration" style="list">
<Step step={4} name="Integration" style="list">
Integration checks run automated test suites using tools like Playwright, JUnit, Newman and K6 to validate end-to-end functionality across services and infrastructure.
</Step>

Expand Down
5 changes: 0 additions & 5 deletions canary-checker/docs/reference/1-alert-manager.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,6 @@ spec:
description: "A list of alert prefix names to include",
scheme: '[]string'
},
{
field: "relationships",
description: "Link the check results to components and configs using lookup expressions.",
scheme: '[Relationships](#relationships)'
},
{
field: "ignore",
description: "A list of alert prefix names to exclude",
Expand Down
2 changes: 1 addition & 1 deletion canary-checker/docs/reference/1-folder.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ spec:
{field: "minCount", description: "The minimum number of files inside the `path`", scheme: "int"},
{field: "maxCount", description: "The maximum number of files inside the `path`, can be used in conjunction with `filter.regex` to detect error files", scheme: "int"},
{field: "minAge", description: "The youngest age a file can be", scheme: "Duration"},
{field: "maxAge", description: "The oldest age a file can be, often used to check for unprocessed files or filess that have not been cleaned up", scheme: "Duration"},
{field: "maxAge", description: "The oldest age a file can be, often used to check for unprocessed files or files that have not been cleaned up", scheme: "Duration"},
{field: "minSize", description: "The minimum file size, can be used to detect backups that did not upload successfully", scheme: "Size"},
{field: "maxSize", description: "The maximim file size", scheme: "Size"}

Expand Down
2 changes: 1 addition & 1 deletion canary-checker/docs/reference/1-git.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ spec:
schedule: "@every 1m"
github:
- githubToken: <token>
query: SELECT count(*) FROM commits WHERE author_email = '[email protected]'
query: SELECT count(*) FROM commits WHERE author_email = '[email protected]'
```
<HealthCheck name="github" rows={[
Expand Down
12 changes: 6 additions & 6 deletions canary-checker/docs/reference/1-http.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ Result variables can be used in `test`, `display` and `transform` [expressions](

| Name | Description | Scheme |
| --------- | --------------------------------------------------------------------------- | ------------------- |
| `code` | HTTP response code | _int_ |
| `headers` | HTTP response headers | _map[string]string_ |
| `elapsed` | HTTP Request duration | _time.Duration_ |
| `sslAge` | Time until SSL certificate expires | _time.Duration_ |
| `code` | HTTP response code | `int` |
| `headers` | HTTP response headers | `map[string]string` |
| `elapsed` | HTTP Request duration | `time.Duration` |
| `sslAge` | Time until SSL certificate expires | `time.Duration` |
| `content` | HTTP Response body | string |
| `json` | If `Content-Type=application/json` response body converted into JSON object | `JSON` |

Expand Down Expand Up @@ -107,7 +107,7 @@ See <CommonLink to="gotemplate" anchor="escaping">Escaping variables</CommonLink
| **HTTP Check Metrics** | | |
| ------------------------------------------------------------- | ------- | --------------------------------------- |
| `canary_check_http_response_status{status, statusClass, url}` | Counter | Response code counter for each endpoint |
| `canary_check_http_ssl_expiry{url}` | Guage | |
| `canary_check_http_ssl_expiry{url}` | Gauge | |

Status class is one of `1xx`, `2xx`, `3xx`, `4xx`, `5xx`

Expand All @@ -120,7 +120,7 @@ Status class is one of `1xx`, `2xx`, `3xx`, `4xx`, `5xx`
</details>


<details summary="Transformings metrics into individual checks">
<details summary="Transforming metrics into individual checks">

<div>
```yaml title="metrics.yaml" file=../../../modules/canary-checker/fixtures/minimal/metrics-transformed.yaml
Expand Down
4 changes: 1 addition & 3 deletions canary-checker/docs/reference/1-kubernetes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ sidebar_class_name: popular

The Kubernetes check performs requests on Kubernetes resources such as Pods to get the desired information.

```yaml title="junit.yaml" file=../../../modules/canary-checker/fixtures/k8s/kubernetes-minimal_pass.yaml

```yaml title="junit.yaml" file=../../../modules/canary-checker/fixtures/k8s/kubernetes-minimal_pass.yaml
```

<HealthCheck name="kubernetes" edition="standard" connection="kubeconfig" rows={[
Expand Down Expand Up @@ -67,8 +67,6 @@ dyn(results).all(x, k8s.isReady(x))
<div>
```yaml title="junit.yaml" file=../../../modules/canary-checker/fixtures/k8s/certmanager.yaml
```

</div>
</details>
2 changes: 1 addition & 1 deletion canary-checker/docs/reference/1-prometheus.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ sidebar_class_name: popular
The Prometheus Check connects to the Prometheus host, performs the desired query, and displays the results.


```yaml title="promtheus.yaml" file=../../../modules/canary-checker/fixtures/datasources/prometheus.yaml
```yaml title="prometheus.yaml" file=../../../modules/canary-checker/fixtures/datasources/prometheus.yaml
```
<HealthCheck name="prometheus" connection="url" rows={[
{field: "url", description: "Prometheus instance, if not specified in installation it is required", required: true},
Expand Down
2 changes: 1 addition & 1 deletion canary-checker/docs/reference/1-redis.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ title: Redis

The Redis check connects to a specified Redis database instance to check its availability.

```yaml title="promtheus.yaml" file=../../../modules/canary-checker/fixtures/datasources/redis_pass.yaml
```yaml title="redis.yaml" file=../../../modules/canary-checker/fixtures/datasources/redis_pass.yaml
```
<HealthCheck name="redis" connection="url" rows={[
{field: "url", description: "Redis instance", required: true},
Expand Down
Loading

0 comments on commit 6305595

Please sign in to comment.