From 3605a8a57c86f4ac8d22fe60c3ec456e188ab7ee Mon Sep 17 00:00:00 2001 From: Aditya Thebe Date: Tue, 1 Oct 2024 23:01:39 +0545 Subject: [PATCH] chore: fixture updates --- canary-checker/docs/cli.mdx | 100 ------------------ .../expressions/display-formatting.md | 46 +------- .../docs/concepts/expressions/transforms.mdx | 27 +---- .../docs/concepts/metrics/stateful-metrics.md | 75 +------------ .../docs/concepts/secret-management.md | 82 +------------- canary-checker/docs/getting-started.mdx | 2 +- canary-checker/docs/reference/1-folder.mdx | 27 +---- canary-checker/docs/reference/1-http.mdx | 78 ++------------ canary-checker/docs/reference/1-sql.mdx | 34 +----- .../docs/reference/3-containerd.mdx | 26 +---- .../docs/reference/3-gcs-database-backup.mdx | 32 +----- canary-checker/docs/reference/3-helm.mdx | 22 +--- canary-checker/docs/reference/jmeter.mdx | 17 +-- canary-checker/docs/scripting/cel.mdx | 94 +--------------- canary-checker/docs/scripting/gotemplate.mdx | 12 +-- canary-checker/docs/scripting/javascript.md | 21 +--- modules/canary-checker | 2 +- modules/mission-control | 2 +- 18 files changed, 34 insertions(+), 665 deletions(-) delete mode 100644 canary-checker/docs/cli.mdx diff --git a/canary-checker/docs/cli.mdx b/canary-checker/docs/cli.mdx deleted file mode 100644 index 5451e25b..00000000 --- a/canary-checker/docs/cli.mdx +++ /dev/null @@ -1,100 +0,0 @@ ---- -hide: -- toc -title: CLI -description: Troubleshooting and/or running from CI/CD pipeline ---- -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - - -# Installation - - - - - - -```bash -wget https://github.com/flanksource/canary-checker/releases/latest/download/canary-checker_linux_amd64 \ - -O /usr/bin/canary-checker && \ - chmod +x /usr/bin/canary-checker -``` - - - - -```bash -wget https://github.com/flanksource/canary-checker/releases/latest/download/canary-checker_linux_arm64 \ - -O /usr/bin/canary-checker && \ - chmod +x /usr/bin/canary-checker -``` - - - - -```bash -wget https://github.com/flanksource/canary-checker/releases/latest/download/canary-checker_darwin_amd64 \ - -O /usr/local/bin/canary-checker && \ - chmod +x /usr/local/bin/canary-checker -``` - - - - -```bash -wget https://github.com/flanksource/canary-checker/releases/latest/download/canary-checker_darwin_arm64 \ - -O /usr/local/bin/canary-checker && \ - chmod +x /usr/local/bin/canary-checker -``` - - - - -```bash -OS = $(shell uname -s | tr '[:upper:]' '[:lower:]') -ARCH = $(shell uname -m | sed 's/x86_64/amd64/') -wget -nv -nc https://github.com/flanksource/canary-checker/releases/latest/download/canary-checker_$(OS)_$(ARCH) \\ - -O /usr/local/bin/canary-checker && \\ - chmod +x /usr/local/bin/canary-checker -``` - - - - -```bash -wget -nv -nc -O https://github.com/flanksource/canary-checker/releases/latest/download/canary-checker.exe -``` - - - - - - - - -```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 -``` - - - - diff --git a/canary-checker/docs/concepts/expressions/display-formatting.md b/canary-checker/docs/concepts/expressions/display-formatting.md index 09670f51..b9e49cc7 100644 --- a/canary-checker/docs/concepts/expressions/display-formatting.md +++ b/canary-checker/docs/concepts/expressions/display-formatting.md @@ -8,17 +8,7 @@ Canary checker can format the results of checks using the `display` field. All e In this example we get the current exchange rate: -```yaml title="display-with-gotemplate.yaml" -apiVersion: canaries.flanksource.com/v1 -kind: Canary -metadata: - name: http-check -spec: - http: - - name: USD - url: https://api.frankfurter.app/latest?from=USD&to=GBP,EUR,ILS,ZAR - display: - template: '$1 = €{{.json.rates.EUR}}, £{{.json.rates.GBP}}, ₪{{.json.rates.ILS}}' +```yaml title="display-with-gotemplate.yaml" file=../../../../modules/canary-checker/fixtures/minimal/display-with-gotemplate_pass.yaml ``` Which would display: @@ -33,44 +23,14 @@ See Go Template The equivalent using CEL expressions would be: -```yaml title="display-with-cel.yaml" -apiVersion: canaries.flanksource.com/v1 -kind: Canary -metadata: - name: http-check -spec: - http: - - name: USD - url: https://api.frankfurter.app/latest?from=USD&to=GBP,EUR,ILS,ZAR - display: - expr: "'$1 = €' + string(json.rates.EUR) + ', £' + string(json.rates.GBP) + ', ₪' + string(json.rates.ILS)" +```yaml title="display-with-cel.yaml" file=../../../../modules/canary-checker/fixtures/minimal/display-with-cel_pass.yaml ``` See Cel Expressions for a function reference ## Javascript -```yaml title="display-with-javascript.yaml" -apiVersion: canaries.flanksource.com/v1 -kind: Canary -metadata: - name: http-check -spec: - http: - - name: USD - url: https://api.frankfurter.app/latest?from=USD&to=GBP,EUR,ILS - display: - javascript: | - currencyCodes = { "EUR": "€", "GBP": "£", "ILS": "₪"} - - display = "" - for (var currency in json.rates) { - if (display != "") { - display += ", " - } - display += currency + " = " + currencyCodes[currency] + json.rates[currency] + ", " - } - "$1 = " + display +```yaml title="display-with-javascript.yaml" file=../../../../modules/canary-checker/fixtures/minimal/display-with-javascript_pass.yaml ``` :::info diff --git a/canary-checker/docs/concepts/expressions/transforms.mdx b/canary-checker/docs/concepts/expressions/transforms.mdx index 3a25495d..6958812e 100644 --- a/canary-checker/docs/concepts/expressions/transforms.mdx +++ b/canary-checker/docs/concepts/expressions/transforms.mdx @@ -6,32 +6,7 @@ import TransformFields from './_transform_fields.mdx' The `transform` can be used to convert one check into multiple checks programmatically. -```yaml -apiVersion: canaries.flanksource.com/v1 -kind: Canary -metadata: - name: alertmanager-check -spec: - schedule: "*/5 * * * *" - alertmanager: - - url: alertmanager.example.com - name: alert-manager-transform - alerts: - - .* - ignore: - - KubeScheduler.* - transform: - javascript: | - var out = _.map(results, function(r) { - return { - name: r.name, - labels: r.labels, - icon: 'alert', - message: r.message, - description: r.message, - } - }) - JSON.stringify(out); +```yaml title="alertmanager-check.yaml" file=../../../../modules/canary-checker/fixtures/datasources/alertmanager.yaml ``` In the above example, the check returns multiple alerts from alertmanager. By default, all those alerts are grouped in a single check. diff --git a/canary-checker/docs/concepts/metrics/stateful-metrics.md b/canary-checker/docs/concepts/metrics/stateful-metrics.md index c1359618..5c70fe07 100644 --- a/canary-checker/docs/concepts/metrics/stateful-metrics.md +++ b/canary-checker/docs/concepts/metrics/stateful-metrics.md @@ -4,80 +4,7 @@ title: Stateful Metrics Metrics can be generated from time based data, e.g. logs per minute, logins per second by using the output of one check execution as the input to the next. -```yaml -apiVersion: canaries.flanksource.com/v1 -kind: Canary -metadata: - name: 'container-log-counts' - namespace: observability - # The schedule can be as short or as long as you want, the query will always search for log - # since the last query - schedule: '@every 5m' - http: - - name: container_log_volume - url: 'https://elasticsearch/logstash-*/_search' - headers: - - name: Content-Type - value: application/json - templateBody: true - test: - # if no logs are found, fail the health check - expr: json.?aggregations.logs.doc_count.orValue(0) > 0 - # query for log counts by namespace, container and pod that have been created since the last check - body: >- - { - "size": 0, - "aggs": { - "logs": { - "filter": { - "range": { - "@timestamp" : { - {{- if last_result.results.max }} - "gte": "{{ last_result.results.max }}" - {{- else }} - "gte": "now-5m" - {{- end }} - } - } - }, - "aggs": { - "age": { - "max": { - "field": "@timestamp" - } - }, - "labels": { - "multi_terms": { - "terms": [ - { "field": "kubernetes_namespace_name.keyword"}, - { "field": "kubernetes_container_name.keyword"}, - { "field": "kubernetes_pod_name.keyword"} - ], - "size": 1000 - } - } - } - } - } - } - transform: - # Save the maximum age for usage in subsequent queries and create a metric for each pair - expr: | - json.orValue(null) != null ? - [{ - 'detail': { 'max': string(json.?aggregations.logs.age.value_as_string.orValue(last_result().?results.max.orValue(time.Now()))) }, - 'metrics': json.?aggregations.logs.labels.buckets.orValue([]).map(k, { - 'name': "namespace_log_count", - 'type': "counter", - 'value': double(k.doc_count), - 'labels': { - "namespace": k.key[0], - "container": k.key[1], - "pod": k.key[2] - } - }) - }].toJSON() - : '{}' +```yaml file=../../../../modules/canary-checker/fixtures/elasticsearch/stateful_metrics.yaml ``` This snippet retrieves the `last_result.results.max` value from the last execution ensuring data is not duplicated or missed diff --git a/canary-checker/docs/concepts/secret-management.md b/canary-checker/docs/concepts/secret-management.md index ee8acc1a..5de8b69c 100644 --- a/canary-checker/docs/concepts/secret-management.md +++ b/canary-checker/docs/concepts/secret-management.md @@ -21,7 +21,7 @@ Avoid inlining secrets, use `valueFrom` and EnvV Using a HTTP health check as an example for static values: -```yaml title="http-basic-auth-static.yaml" file=../../../modules/canary-checker/fixtures/minimal/http_auth.yaml +```yaml title="http-basic-auth.yaml" file=../../../modules/canary-checker/fixtures/minimal/http_auth_static_pass.yaml ``` ## Configmaps @@ -32,26 +32,7 @@ To use a configmap, we first need to create the configmap: kubectl create configmap basic-auth --from-literal=user=hello --from-literal=pass=world -n default ``` -```yaml title="http-basic-auth-configmap.yaml" -apiVersion: canaries.flanksource.com/v1 -kind: Canary -metadata: - name: http-basic-auth-configmap -spec: - http: - - url: https://httpbin.org/basic-auth/hello/world - responseCodes: [200] - authentication: - username: - valueFrom: - configMapKeyRef: - name: basic-auth - key: user - password: - valueFrom: - configMapKeyRef: - name: basic-auth - key: pass +```yaml title="http-basic-auth.yaml" file=../../../modules/canary-checker/fixtures/minimal/http_auth_from_config_map.yaml ``` ## Secrets @@ -62,24 +43,7 @@ To use a secret, first we create the secret: kubectl create secret generic basic-auth --from-literal=user=hello --from-literal=pass=world -n default ``` -```yaml title="http-basic-auth-secret.yaml" -apiVersion: canaries.flanksource.com/v1 -kind: Canary -metadata: - name: http-basic-auth-configmap -spec: - http: - - url: https://httpbin.demo.aws.flanksource.com/basic-auth/hello/world - username: - valueFrom: - secretKeyRef: - name: basic-auth - key: user - password: - valueFrom: - secretKeyRef: - name: basic-auth - key: pass +```yaml title="http-basic-auth.yaml" file=../../../modules/canary-checker/fixtures/minimal/http_auth_from_secret.yaml ``` ## Helm Values @@ -90,50 +54,14 @@ To use a secret, first we deploy a helm chart helm install podinfo podinfo/podinfo -n podinfo --set ingress.enabled=true ``` -```yaml title="http-from-helm.yaml" -apiVersion: canaries.flanksource.com/v1 -kind: Canary -metadata: - name: http-from-helm -spec: - http: - - env: - - name: url - valueFrom: - helmRef: - name: podinfo - key: .ingress.hosts[0].host - - url: $(url) +```yaml title="http-from-helm.yaml" file=../../../modules/canary-checker/fixtures/minimal/http_auth_from_helm_ref.yaml ``` ## Service Accounts Checks can use service accounts for authentication with external services that have existing trust established -```yaml title="http-service-accounts.yaml" -apiVersion: canaries.flanksource.com/v1 -kind: Canary -metadata: - name: http-basic-auth-configmap -spec: - http: - - interval: 30 - http: - - name: vault-example-sre - description: "HashiCorp Vault functionality check." - url: https://vault.example/v1/auth/kubernetes/login - env: - - name: TOKEN - valueFrom: - serviceAccount: default-account - templateBody: true - body: | - { - "jwt": "$(TOKEN)", - "role": "example-role" - } +```yaml title="http-service-accounts.yaml" file=../../../modules/canary-checker/fixtures/minimal/http_auth_from_service_account.yaml ``` diff --git a/canary-checker/docs/getting-started.mdx b/canary-checker/docs/getting-started.mdx index e0ea83c4..6e79f338 100644 --- a/canary-checker/docs/getting-started.mdx +++ b/canary-checker/docs/getting-started.mdx @@ -20,7 +20,7 @@ import { HiOutlineExternalLink } from "react-icons/hi"; 2. Create a new check - ```yaml title="canary.yaml" file=../../modules/canary-checker/fixtures/minimal/http_auth.yaml + ```yaml title="canary.yaml" file=../../modules/canary-checker/fixtures/minimal/http_simple.yaml ```

diff --git a/canary-checker/docs/reference/1-folder.mdx b/canary-checker/docs/reference/1-folder.mdx index 3466698a..973a9a9f 100644 --- a/canary-checker/docs/reference/1-folder.mdx +++ b/canary-checker/docs/reference/1-folder.mdx @@ -13,18 +13,7 @@ Checks the contents of a folder for size, age, and count. Folder based checks ar - Checking the size of queue processing backlog - Checking if any error (`.err` or `.log`) files have been produced. -```yaml title="folder-check.yaml" -apiVersion: canaries.flanksource.com/v1 -kind: Canary -metadata: - name: folder-check -spec: - interval: 30 - folder: - - path: /etc/ - name: folder-check-min - description: Checks if there are at least 10 files in the folder - minCount: 10 +```yaml title="folder-check.yaml" file=../../../modules/canary-checker/fixtures/datasources/folder_single_pass.yaml ``` HTTP -This check performs queries on HTTP endpoints, and HTTP namespaces to monitor their activity. - -```yaml title=http-check.yaml -apiVersion: canaries.flanksource.com/v1 -kind: Canary -metadata: - name: http-check -spec: - interval: 30 - http: - - name: http pass response 200 status code - endpoint: https://httpbin.demo.aws.flanksource.com/status/200 - thresholdMillis: 3000 - responseCodes: [201, 200, 301] - maxSSLExpiry: 7 +This check performs queries on HTTP to monitor their activity. + +```yaml title=http-check.yaml file=../../../modules/canary-checker/fixtures/minimal/http_single_pass.yaml ``` -```yaml title=http-check.yaml -apiVersion: canaries.flanksource.com/v1 -kind: Canary -metadata: - name: http-check -spec: - interval: 30 - http: - - name: http pass response 200 status code - url: https://httpbin.demo.aws.flanksource.com/status/200 - tlsConfig: - ca: - valueFrom: - secretKeyRef: - name: ca-cert - key: ca.pem +```yaml title=http-check.yaml file=../../../modules/canary-checker/fixtures/minimal/http_tls_config.yaml ``` @@ -92,18 +65,7 @@ Result variables can be used in `test`, `display` and `transform` [expressions]( The above canary (`http-check.yaml`) is functionally equivalent to `http-check-expr.yaml` below -```yaml title=http-check-expr.yaml -apiVersion: canaries.flanksource.com/v1 -kind: Canary -metadata: - name: http-check-expr -spec: - interval: 30 - http: - - name: http pass response 200 status code - endpoint: https://httpbin.demo.aws.flanksource.com/status/200 - test: - expr: "code in [200,201,301] and sslAge > Duration('7d')" +```yaml title=http-check-expr.yaml file=../../../modules/canary-checker/fixtures/minimal/http_tls_check_pass.yaml ``` ## Authentication @@ -111,7 +73,7 @@ spec:

-```yaml title="http_auth.yaml" file=../../../modules/canary-checker/fixtures/minimal/http_auth.yaml +```yaml title="http_auth.yaml" file=../../../modules/canary-checker/fixtures/minimal/http_auth_from_secret.yaml ```
@@ -137,33 +99,9 @@ Eg: In the following spec, the vars `my_secret_path` and `my_secret_var`, define
+
-```yaml title="http_user_pass_template.yaml" -apiVersion: canaries.flanksource.com/v1 -kind: Canary -metadata: - name: http-basic-auth-url - namespace: canaries -spec: - http: - - name: test-url-via-env - # The URL can be templated from arbitrary values using the env field and $(.) syntax - url: $(.url) - env: - - name: url - value: https://hello:world2@httpbin.demo.aws.flanksource.com/basic-auth/hello/world2 - - name: test-basic-via-env - # the url can be constructed from multiple variables - url: https://$(.user):$(.pass)@httpbin.demo.aws.flanksource.com/basic-auth/hello/world - templateBody: true - body: | - {{. | toJSONPretty " " }} - responseCodes: [200] - env: - - name: user - value: hello - - name: pass - value: world +```yaml title="http_user_pass_template.yaml" file=../../../modules/canary-checker/fixtures/minimal/http_auth_url_pass.yaml ```
diff --git a/canary-checker/docs/reference/1-sql.mdx b/canary-checker/docs/reference/1-sql.mdx index 823dd012..d109ca59 100644 --- a/canary-checker/docs/reference/1-sql.mdx +++ b/canary-checker/docs/reference/1-sql.mdx @@ -8,33 +8,7 @@ import { AzureSqlServer} from "@flanksource/icons/mi" This check connects to a specified Postgres database, run a query against it and verify the results. -```yaml -apiVersion: canaries.flanksource.com/v1 -kind: Canary -metadata: - name: postgres-check -spec: - interval: 30 - postgres: # or mysql, mssql - - name: postgres schemas check - url: "postgres://$(username):$(password)@postgres.default.svc:5432/postgres?sslmode=disable" - username: - valueFrom: - secretKeyRef: - name: postgres-credentials - key: USERNAME - password: - valueFrom: - secretKeyRef: - name: postgres-credentials - key: PASSWORD - query: SELECT current_schemas(true) - display: - template: | - {{- range $r := .results.rows }} - {{- $r.current_schemas}} - {{- end}} - results: 1 +```yaml file=../../../modules/canary-checker/fixtures/datasources/postgres.yaml ``` - ## Result Variables | Name | Description | Scheme | @@ -64,11 +37,8 @@ spec: # ... ``` - ## MySQL - - ```yaml title=lookup-mysql.yaml # ... kind: Canary @@ -78,8 +48,8 @@ spec: - url: "$(username):$(password)@tcp(mysql.default.svc:3306)/mysqldb" # ... ``` -## Postgres +## Postgres ```yaml title=canary-postgres.yaml # ... diff --git a/canary-checker/docs/reference/3-containerd.mdx b/canary-checker/docs/reference/3-containerd.mdx index 6a6a3296..814f9d9e 100644 --- a/canary-checker/docs/reference/3-containerd.mdx +++ b/canary-checker/docs/reference/3-containerd.mdx @@ -14,20 +14,9 @@ The containerd and docker health checks require access to a working socket that ## Pulling images -```yaml -apiVersion: canaries.flanksource.com/v1 -kind: Canary -metadata: - name: containerd-pull-check -spec: - interval: 30 - containerd: # use docker if running outside kubernetes / docker - - image: docker.io/library/busybox:1.31.1 - expectedDigest: sha256:95cf004f559831017cdf4628aaf1bb30133677be8702a8c5f2994629f637a209 - expectedSize: 764556 +```yaml file=../../../modules/canary-checker/fixtures/minimal/containerd-pull.yaml title='containerd-pull.yaml' ``` - - password: +```yaml file=../../../modules/canary-checker/fixtures/minimal/containerd-push.yaml title='containerd-push.yaml' ``` diff --git a/canary-checker/docs/reference/3-gcs-database-backup.mdx b/canary-checker/docs/reference/3-gcs-database-backup.mdx index 2a78dc56..f8532328 100644 --- a/canary-checker/docs/reference/3-gcs-database-backup.mdx +++ b/canary-checker/docs/reference/3-gcs-database-backup.mdx @@ -45,38 +45,10 @@ There are 3 options when connecting to GCP: 1. GKE [workload identity](https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity) (the default if no `connection` or `credentials` is specified) 2. `connection`, this is the recommended method, connections are reusable and secure -```yaml title="aws-connection.yaml" -apiVersion: canaries.flanksource.com/v1 -kind: Canary -metadata: - name: database-backup-check -spec: - interval: 60 - databaseBackup: - - maxAge: 6h - gcp: - project: google-project-name - instance: cloudsql-instance-name - connection: connection://gcp/internal +```yaml title="database-backup-check.yaml" file=../../../modules/canary-checker/fixtures/datasources/GCP/database_backup_cred_from_connection.yaml ``` 3. `accessKey` and `secretKey` _EnvVar_ with the credentials stored in a secret. -```yaml title="gcs-database-backup.yaml" -apiVersion: canaries.flanksource.com/v1 -kind: Canary -metadata: - name: database-backup-check -spec: - interval: 60 - databaseBackup: - - name: gcp db check - maxAge: 6h - gcp: - project: google-project-name - credentials: - valueFrom: - secretKeyRef: - name: gcp-credentials - key: AUTH_ACCESS_TOKEN +```yaml title="gcs-database-backup.yaml" file=../../../modules/canary-checker/fixtures/datasources/GCP/database_backup_cred.yaml ``` diff --git a/canary-checker/docs/reference/3-helm.mdx b/canary-checker/docs/reference/3-helm.mdx index 4a55fba6..8ac35c9a 100644 --- a/canary-checker/docs/reference/3-helm.mdx +++ b/canary-checker/docs/reference/3-helm.mdx @@ -8,27 +8,7 @@ sidebar_class_name: beta Builds and pushes your helm chart to a helm repository. -```yaml -apiVersion: canaries.flanksource.com/v1 -kind: Canary -metadata: - name: helm-check -spec: - interval: 30 - helm: - - chartmuseum: http://chartmuseum.default:8080 - project: library - auth: - username: - valueFrom: - secretKeyRef: - name: helm-credentials - key: USERNAME - password: - valueFrom: - secretKeyRef: - name: helm-credentials - key: PASSWORD +```yaml title='helm-check.yaml' file=../../../modules/canary-checker/fixtures/k8s/helm_check.yaml ``` | Field | Description | Scheme | Required | diff --git a/canary-checker/docs/reference/jmeter.mdx b/canary-checker/docs/reference/jmeter.mdx index fa8111e8..3cef6be1 100644 --- a/canary-checker/docs/reference/jmeter.mdx +++ b/canary-checker/docs/reference/jmeter.mdx @@ -9,22 +9,7 @@ title: Jmeter This check executes the JMeter CLI to execute the JMX test plan on the specified host. -```yaml -apiVersion: canaries.flanksource.com/v1 -kind: Canary -metadata: - name: jmeter-check -spec: - interval: 30 - jmeter: - - name: jmeter check - url: 192.168.1.5 - jmx: - valueFrom: - configMapKeyRef: - name: jmeter-config - key: sample-test.jmx - port: 1099 +```yaml title='jmeter-check.yaml' file=../../../modules/canary-checker/fixtures/minimal/jmeter.yaml ``` | Field | Description | Scheme | Required | diff --git a/canary-checker/docs/scripting/cel.mdx b/canary-checker/docs/scripting/cel.mdx index fe02179c..554d1381 100644 --- a/canary-checker/docs/scripting/cel.mdx +++ b/canary-checker/docs/scripting/cel.mdx @@ -9,18 +9,7 @@ The [CEL playground](https://playcel.undistro.io/) lets you quickly test CEL exp ::: -```yaml title=http-check-expr.yaml -apiVersion: canaries.flanksource.com/v1 -kind: Canary -metadata: - name: http-check-expr -spec: - interval: 30 - http: - - name: http pass response 200 status code - endpoint: https://httpbin.demo.aws.flanksource.com/status/200 - test: - expr: "code in [200,201,301] and sslAge < Duration('7d')" +```yaml title=http-check-expr.yaml file=../../../modules/canary-checker/fixtures/minimal/display-with-cel_pass.yaml ``` Values in CEL represent any of the following: @@ -592,87 +581,6 @@ CSV(["Alice,30", "Bob,31"])[0][0] // "Alice" --- - - ## crypto ### crypto.SHA1|256|384|512 diff --git a/canary-checker/docs/scripting/gotemplate.mdx b/canary-checker/docs/scripting/gotemplate.mdx index f85683e7..a3b733b0 100644 --- a/canary-checker/docs/scripting/gotemplate.mdx +++ b/canary-checker/docs/scripting/gotemplate.mdx @@ -6,17 +6,7 @@ import GoTemplate from '@site/docs/partials/_gotemplate.md' In this example we print out the exchange rates returned by an HTTP API Call -```yaml title="display-with-gotemplate.yaml" -apiVersion: canaries.flanksource.com/v1 -kind: Canary -metadata: - name: http-check -spec: - http: - - name: USD - url: https://api.frankfurter.app/latest?from=USD&to=GBP,EUR,ILS,ZAR - display: - template: '$1 = €{{.json.rates.EUR}}, £{{.json.rates.GBP}}, ₪{{.json.rates.ILS}}' +```yaml title="display-with-gotemplate.yaml" file=../../../modules/canary-checker/fixtures/minimal/display-with-gotemplate_pass.yaml ```

diff --git a/canary-checker/docs/scripting/javascript.md b/canary-checker/docs/scripting/javascript.md index 21ac421e..4aa023ac 100644 --- a/canary-checker/docs/scripting/javascript.md +++ b/canary-checker/docs/scripting/javascript.md @@ -4,26 +4,7 @@ title: Javascript `javascript` expressions use to the [otto](https://github.com/robertkrimen/otto) Javascript VM -```yaml title="display-with-javascript.yaml" -apiVersion: canaries.flanksource.com/v1 -kind: Canary -metadata: - name: http-check -spec: - http: - - name: USD - url: https://api.frankfurter.app/latest?from=USD&to=GBP,EUR,ILS - display: - javascript: | - currencyCodes = { "EUR": "€", "GBP": "£", "ILS": "₪"} - display = "" - for (var currency in json.rates) { - if (display != "") { - display += ", " - } - display += currency + " = " + currencyCodes[currency] + json.rates[currency] + ", " - } - "$1 = " + display +```yaml title="display-with-javascript.yaml" file=../../../modules/canary-checker/fixtures/minimal/display-with-javascript_pass.yaml ``` :::tip Troubleshooting diff --git a/modules/canary-checker b/modules/canary-checker index cd3d9d86..8a592f16 160000 --- a/modules/canary-checker +++ b/modules/canary-checker @@ -1 +1 @@ -Subproject commit cd3d9d86873c07c6b753b45d3eed83a087269de3 +Subproject commit 8a592f16302468e281a69e4f1719d1dc4a893ebe diff --git a/modules/mission-control b/modules/mission-control index c8797f60..ad372f8f 160000 --- a/modules/mission-control +++ b/modules/mission-control @@ -1 +1 @@ -Subproject commit c8797f60d05f18c5100bbfaaa0ae6cb24d93582f +Subproject commit ad372f8fe1539f6ddce60feb376baaf5d452113e