From d8d2ed65e2f834334df2a41ad2d1126d6375711e Mon Sep 17 00:00:00 2001 From: Yash Mehrotra Date: Mon, 30 Sep 2024 19:58:03 +0530 Subject: [PATCH 1/3] chore: add env var to http docs --- canary-checker/docs/reference/1-http.mdx | 46 +++++++++++++++++++++--- canary-checker/docusaurus.config.js | 5 +++ 2 files changed, 47 insertions(+), 4 deletions(-) diff --git a/canary-checker/docs/reference/1-http.mdx b/canary-checker/docs/reference/1-http.mdx index 5044a0a5..b0620412 100644 --- a/canary-checker/docs/reference/1-http.mdx +++ b/canary-checker/docs/reference/1-http.mdx @@ -33,7 +33,8 @@ spec: {field: "responseContent", description: "Expected response content", scheme: "string"}, {field: "thresholdMillis", description: "Request timeout", default: 5000, scheme: "int"}, {field: "maxSSLExpiry", description: "Max SSL expiry days", scheme: "int"}, - {field: "insecureSkipVerify", description: "Skip TLS verification", scheme: "bool"} + {field: "insecureSkipVerify", description: "Skip TLS verification", scheme: "bool"}, + {field: "env", description: "Setup environment variables that are accessible while templating", scheme: "[]EnvVar"}, ]}/> ### TLS Config @@ -68,6 +69,14 @@ spec: +### OAuth + + + ### Result Variables Result variables can be used in `test`, `display` and `transform` [expressions](../concepts/expressions) @@ -107,9 +116,7 @@ spec: -### OAuth - -### Template Body Variables +## Template Body Variables | Name | Scheme | | ----------------------------- | ------------------- | @@ -129,6 +136,37 @@ 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 arbritrary 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 +``` +
+ See Escaping variables ## Metrics diff --git a/canary-checker/docusaurus.config.js b/canary-checker/docusaurus.config.js index ae341779..7dc5ceb9 100644 --- a/canary-checker/docusaurus.config.js +++ b/canary-checker/docusaurus.config.js @@ -117,6 +117,11 @@ export default async function createConfigAsync() { label: 'GitHub', position: 'right', }, + { + href: 'https://cloud-native.slack.com/messages/canary-checker/', + label: 'Slack', + position: 'right', + }, ], }, colorMode: { From cbb186356033a1a02738c98f7e0c93a194695294 Mon Sep 17 00:00:00 2001 From: Yash Mehrotra Date: Mon, 30 Sep 2024 20:52:50 +0530 Subject: [PATCH 2/3] chore: lint fixes --- canary-checker/docs/reference/1-http.mdx | 3 ++- styles/ignore/words-with-suggestions.txt | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/canary-checker/docs/reference/1-http.mdx b/canary-checker/docs/reference/1-http.mdx index b0620412..69f132ab 100644 --- a/canary-checker/docs/reference/1-http.mdx +++ b/canary-checker/docs/reference/1-http.mdx @@ -147,7 +147,7 @@ metadata: spec: http: - name: test-url-via-env - # The URL can be templated from arbritrary values using the env field and $(.) syntax + # The URL can be templated from arbitrary values using the env field and $(.) syntax url: $(.url) env: - name: url @@ -166,6 +166,7 @@ spec: value: world ``` +
See Escaping variables diff --git a/styles/ignore/words-with-suggestions.txt b/styles/ignore/words-with-suggestions.txt index 94fd7447..6319e53a 100644 --- a/styles/ignore/words-with-suggestions.txt +++ b/styles/ignore/words-with-suggestions.txt @@ -1,4 +1,5 @@ actionPrefix +apiVersion agent_id aggregatorName alarmPrefix From 16ef8c362ce316e9a45821b52b03755c950eb1d6 Mon Sep 17 00:00:00 2001 From: Moshe Immerman Date: Tue, 1 Oct 2024 11:12:02 +0300 Subject: [PATCH 3/3] Update canary-checker/docs/reference/1-http.mdx --- canary-checker/docs/reference/1-http.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/canary-checker/docs/reference/1-http.mdx b/canary-checker/docs/reference/1-http.mdx index 69f132ab..68e07fd9 100644 --- a/canary-checker/docs/reference/1-http.mdx +++ b/canary-checker/docs/reference/1-http.mdx @@ -136,7 +136,7 @@ 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