-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into canary-checker-testing
- Loading branch information
Showing
7 changed files
with
287 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
# Artifacts | ||
|
||
Artifacts allow you to archive files generated by some checks to a file store of your choice. | ||
|
||
## Filestores | ||
|
||
- AWS S3 | ||
- Google Cloud Storage | ||
- SFTP | ||
- SMB | ||
- Local Filesystem | ||
|
||
## Setting up artifact store | ||
|
||
One of the above filestores can be used as the global artifact store. To setup an artifact store, pass the connection name of the store using the `artifact-connection` flag. If the artifact connection isn't setup, the artifacts are simply ignored. | ||
|
||
Example: | ||
|
||
```bash | ||
canary-checker --artifact-connection='connection://sftp/artifacts' | ||
``` | ||
|
||
## Archiving artifacts | ||
|
||
The following checks support archiving artifacts | ||
|
||
- [Exec](../reference/exec) | ||
- [Junit](../reference/junit) | ||
|
||
The only configuration required is to provide the path(s) of the artifacts generated by the check. | ||
|
||
### Ex1. Archiving `/tmp/results/` directory | ||
|
||
For the following script in an exec check | ||
|
||
``` | ||
mkdir -p /tmp/results | ||
curl -sL 'https://example.com' > /tmp/results/example.com | ||
curl -sL 'https://flanksource.com' > /tmp/results/flanksource.com | ||
``` | ||
|
||
one can provide the artifact paths as follows | ||
|
||
```yaml title="archive-websites.yaml" | ||
apiVersion: canaries.flanksource.com/v1 | ||
kind: Canary | ||
metadata: | ||
name: exec-artifact | ||
spec: | ||
interval: 30 | ||
exec: | ||
- name: Download example.com and flanksource.com | ||
script: | | ||
mkdir -p /tmp/results | ||
curl -sL 'https://example.com' > /tmp/results/example.com | ||
curl -sL 'https://flanksource.com' > /tmp/results/flanksource.com | ||
artifacts: | ||
- path: /tmp/results/example.com | ||
- path: /tmp/results/flanksource.com | ||
``` | ||
or, use a glob as | ||
```yaml | ||
artifacts | ||
- path: '/tmp/results/*.com' | ||
``` | ||
### Ex2. Archiving artifacts from stdout/stderr | ||
The path field accepts two special paths | ||
- `/dev/stdout` | ||
- `/dev/stderr` | ||
|
||
```yaml title="archive-website.yaml" | ||
apiVersion: canaries.flanksource.com/v1 | ||
kind: Canary | ||
metadata: | ||
name: exec-artifact | ||
spec: | ||
interval: 30 | ||
exec: | ||
- name: Archive response of example.com | ||
script: | | ||
curl -sL 'https://example.com' | ||
artifacts: | ||
- path: /dev/stdout | ||
- path: /dev/stderr | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Scaling Canaries up/down | ||
|
||
Canaries can be scaled up or down just like other kubernetes resources. However, scaling to more than one replica is identical to having just one replica. In other words, scaling a canary can be thought of as a mechanism to turn on/off the canary. | ||
|
||
## Example | ||
|
||
1. List all the canaries | ||
|
||
```bash | ||
kubectl get canaries -o wide | ||
# NAME REPLICAS INTERVAL STATUS LAST CHECK UPTIME 1H LATENCY 1H LAST TRANSITIONED ... | ||
# folder-pass 1 300 Failed 34s 0/35 0% 16ms | ||
# folder-pass-empty 1 300 Passed 34s 37/37 (100.0%) 0ms | ||
# s3-bucket-pass 1 30 Failed 3s 0/358 0% 1s | ||
``` | ||
|
||
2. Scale one of the canaries to 10 replicas | ||
|
||
```bash | ||
kubectl scale --replicas=10 canaries.canaries.flanksource.com folder-pass | ||
# canary.canaries.flanksource.com/folder-pass scaled | ||
``` | ||
|
||
```bash | ||
kubectl get canaries folder-pass -o wide | ||
# NAME REPLICAS INTERVAL STATUS LAST CHECK UPTIME 1H LATENCY 1H LAST TRANSITIONED MESSAGE ERROR | ||
# folder-pass 10 300 Failed 3m13s 0/35 0% 16ms | ||
``` | ||
|
||
3. Scale it down to 0 replicas | ||
|
||
```bash | ||
kubectl scale --replicas=0 canaries.canaries.flanksource.com folder-pass | ||
# canary.canaries.flanksource.com/folder-pass scaled | ||
``` | ||
|
||
```bash | ||
kubectl get canaries folder-pass -o wide | ||
# NAME REPLICAS INTERVAL STATUS LAST CHECK UPTIME 1H LATENCY 1H LAST TRANSITIONED MESSAGE ERROR | ||
# folder-pass 0 300 Failed 3m13s 0/35 0% 16ms | ||
``` | ||
|
||
This effectively stops the canary from running. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Connections | ||
|
||
### AWS Connection | ||
|
||
| Field | Description | Type | Required | | ||
| ---------------- | --------------- | ----------------------------------------------------------------------------- | -------- | | ||
| `connectionName` | Connection name | `string` | | | ||
| `accessKey` | Access key | [`types.EnvVar`](https://pkg.go.dev/github.com/flanksource/duty/types#EnvVar) | | | ||
| `secretKey` | Secret key | [`types.EnvVar`](https://pkg.go.dev/github.com/flanksource/duty/types#EnvVar) | | | ||
| `region` | Region | `string` | | | ||
| `endpoint` | Endpoint | `string` | | | ||
| `skipTLSVerify` | Skip TLS verify | `bool` | | | ||
| `objectPath` | Object path | `string` | | | ||
| `usePathStyle` | Use path style | `bool` | | | ||
|
||
### GCP Connection | ||
|
||
| Field | Description | Type | Required | | ||
| ---------------- | --------------- | ----------------------------------------------------------------------------- | -------- | | ||
| `connectionName` | Connection name | `string` | | | ||
| `endpoint` | Endpoint | `string` | | | ||
| `credentials` | Credentials | [`types.EnvVar`](https://pkg.go.dev/github.com/flanksource/duty/types#EnvVar) | | | ||
|
||
### Azure Connection | ||
|
||
| Field | Description | Type | Required | | ||
| ---------------- | --------------- | ----------------------------------------------------------------------------- | -------- | | ||
| `connectionName` | Connection name | `string` | | | ||
| `clientID` | Client ID | [`types.EnvVar`](https://pkg.go.dev/github.com/flanksource/duty/types#EnvVar) | | | ||
| `clientSecret` | Client Secret | [`types.EnvVar`](https://pkg.go.dev/github.com/flanksource/duty/types#EnvVar) | | | ||
| `tenantID` | Tenant ID | `string` | | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.