Skip to content

Commit

Permalink
chore: update docs (#741)
Browse files Browse the repository at this point in the history
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
  • Loading branch information
eddycharly authored Dec 27, 2023
1 parent 2b5afab commit 54da051
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 18 deletions.
4 changes: 2 additions & 2 deletions website/docs/configuration/cleanup-delay.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Delay before cleanup

At the end of each test Chainsaw will delete the resources it created during the test.
At the end of each test, Chainsaw will delete the resources it created during the test.

When testing operators, it can be useful to wait a little bit before starting the cleanup process to make sure the operator/controller had the necessary time to update internal state.
When testing operators, it can be useful to wait a little bit before starting the cleanup process to make sure the operator/controller has the necessary time to update the internal state.

For this reason, Chainsaw provides the `delayBeforeCleanup` configuration option and the corresponding `--delay-before-cleanup` flag.

Expand Down
2 changes: 1 addition & 1 deletion website/docs/configuration/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ Please pay attention to the configuration options below, they may or may not be

- [Timeouts](./timeouts.md)
- [Termination graceful period](./grace.md)
- [Cleanup before delay](./cleanup-delay.md)
- [Delay before cleanup](./cleanup-delay.md)
- [Label selectors](./selector.md)
2 changes: 1 addition & 1 deletion website/docs/examples/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ To use Chainsaw you will need a [Kubernetes](https://kybernetes.io) cluster, Cha

In these examples, we will use [kind](https://kind.sigs.k8s.io) but feel free to use the tool of your choice.

!!! warning "Not a cluster management tool"
!!! note "Not a cluster management tool"

We consider this is not the responsibility of Chainsaw to manage clusters.

Expand Down
30 changes: 18 additions & 12 deletions website/docs/jp/functions.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
# Functions

!!! warning "Experimental functions"

Experimental functions are denoted by the `x_` prefix.

These are functions that are subject to signature change in a future version.

## built-in functions

| Name | Signature |
|---|---|
| abs | `abs(number)` |
| avg | `avg(array[number])` |
| ceil | `ceil(number)` |
| contains | `contains(array\|string, any)` |
| contains | `contains(array|string, any)` |
| ends_with | `ends_with(string, string)` |
| find_first | `find_first(string, string, number, number)` |
| find_last | `find_last(string, string, number, number)` |
Expand All @@ -17,20 +23,20 @@
| items | `items(object)` |
| join | `join(string, array[string])` |
| keys | `keys(object)` |
| length | `length(string\|array\|object)` |
| length | `length(string|array|object)` |
| lower | `lower(string)` |
| map | `map(expref, array)` |
| max | `max(array[number]\|array[string])` |
| max | `max(array[number]|array[string])` |
| max_by | `max_by(array, expref)` |
| merge | `merge(object)` |
| min | `min(array[number]\|array[string])` |
| min | `min(array[number]|array[string])` |
| min_by | `min_by(array, expref)` |
| not_null | `not_null(any)` |
| pad_left | `pad_left(string, number, string)` |
| pad_right | `pad_right(string, number, string)` |
| replace | `replace(string, string, string, number)` |
| reverse | `reverse(array\|string)` |
| sort | `sort(array[string]\|array[number])` |
| reverse | `reverse(array|string)` |
| sort | `sort(array[string]|array[number])` |
| sort_by | `sort_by(array, expref)` |
| split | `split(string, string, number)` |
| starts_with | `starts_with(string, string)` |
Expand Down Expand Up @@ -68,10 +74,10 @@
| trim | `trim(string, string)` |
| trim_prefix | `trim_prefix(string, string)` |
| split | `split(string, string)` |
| regex_replace_all | `regex_replace_all(string, string\|number, string\|number)` |
| regex_replace_all_literal | `regex_replace_all_literal(string, string\|number, string\|number)` |
| regex_match | `regex_match(string, string\|number)` |
| pattern_match | `pattern_match(string, string\|number)` |
| regex_replace_all | `regex_replace_all(string, string|number, string|number)` |
| regex_replace_all_literal | `regex_replace_all_literal(string, string|number, string|number)` |
| regex_match | `regex_match(string, string|number)` |
| pattern_match | `pattern_match(string, string|number)` |
| label_match | `label_match(object, object)` |
| to_boolean | `to_boolean(string)` |
| add | `add(any, any)` |
Expand All @@ -91,8 +97,8 @@
| semver_compare | `semver_compare(string, string)` |
| parse_json | `parse_json(string)` |
| parse_yaml | `parse_yaml(string)` |
| lookup | `lookup(object\|array, string\|number)` |
| items | `items(object\|array, string, string)` |
| lookup | `lookup(object|array, string|number)` |
| items | `items(object|array, string, string)` |
| object_from_lists | `object_from_lists(array, array)` |
| random | `random(string)` |
| x509_decode | `x509_decode(string)` |
Expand Down
32 changes: 32 additions & 0 deletions website/docs/more/lint.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Lint tests

## Overview

Chainsaw comes with a `lint` command to detect ill-formated tests.

!!! tip "Reference documentation"

You can view the full command documentation [here](../commands/chainsaw_lint.md).

## Usage

To build the docs of a test, Chainsaw provides the `chainsaw lint test -f path/to/chainsaw-test.yaml` command.

```bash
chainsaw lint test -f - <<EOF
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: Test
metadata:
name: assertion-tree
spec:
steps:
- try:
- assert:
file: assert.yaml
EOF
```

```bash
Processing input...
The document is valid
```
2 changes: 1 addition & 1 deletion website/docs/more/test-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ This is a very simple test that creates a configmap and checks the content is as

## Step: `step-1`

This steps applies the configmap in the cluster and checks the configmap content.
This step applies the configmap in the cluster and checks the configmap content.

### Try

Expand Down
8 changes: 7 additions & 1 deletion website/jp/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ import (
func main() {
fmt.Println("# Functions")
fmt.Println()
fmt.Println(`!!! warning "Experimental functions"`)
fmt.Println()
fmt.Println(" Experimental functions are denoted by the `x_` prefix.")
fmt.Println()
fmt.Println(" These are functions that are subject to signature change in a future version.")
fmt.Println()
fmt.Println("## built-in functions")
fmt.Println()
printFunctions(jpfunctions.GetDefaultFunctions()...)
Expand All @@ -35,7 +41,7 @@ func printFunctions(funcs ...jpfunctions.FunctionEntry) {
fmt.Println("| Name | Signature |")
fmt.Println("|---|---|")
for _, function := range funcs {
fmt.Println("|", function.Name, "|", "`"+strings.ReplaceAll(functionString(function), "|", `\|`)+"`", "|")
fmt.Println("|", function.Name, "|", "`"+functionString(function)+"`", "|")
}
}

Expand Down
1 change: 1 addition & 0 deletions website/mkdocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ nav:
- Other resources:
- more/events.md
- more/crds.md
- more/lint.md
- more/test-docs.md
- more/kuttl-migration.md
- Rerference Documentation:
Expand Down

0 comments on commit 54da051

Please sign in to comment.