Skip to content

Commit

Permalink
docs: fixed some website docs errors
Browse files Browse the repository at this point in the history
Signed-off-by: Sanskarzz <sanskar.gur@gmail.com>
  • Loading branch information
Sanskarzz authored and anushkamittal2001 committed Jun 26, 2024
1 parent a8ad513 commit 8956638
Show file tree
Hide file tree
Showing 8 changed files with 169 additions and 61 deletions.
15 changes: 15 additions & 0 deletions website/docs/jp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Overview

`kyverno-json` uses [JMESPath community edition](https://jmespath.site/), a modern JMESPath implementation with lexical scopes support.

The current *payload*, *policy* and *rule* are always available using the following builtin bindings:

| Binding | Usage |
|---|---|
| `$payload` | Current payload being analysed |
| `$policy` | Current policy being executed |
| `$rule` | Current rule being evaluated |

!!! warning

No protection is made to prevent you from overriding those bindings.
108 changes: 108 additions & 0 deletions website/docs/jp/functions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# Functions

## built-in functions

| Name | Signature |
|---|---|
| abs | `abs(number)` |
| avg | `avg(array[number])` |
| ceil | `ceil(number)` |
| 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)` |
| floor | `floor(number)` |
| from_items | `from_items(array[array])` |
| group_by | `group_by(array, expref)` |
| items | `items(object)` |
| join | `join(string, array[string])` |
| keys | `keys(object)` |
| length | `length(string\|array\|object)` |
| lower | `lower(string)` |
| map | `map(expref, array)` |
| max | `max(array[number]\|array[string])` |
| max_by | `max_by(array, expref)` |
| merge | `merge(object)` |
| 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])` |
| sort_by | `sort_by(array, expref)` |
| split | `split(string, string, number)` |
| starts_with | `starts_with(string, string)` |
| sum | `sum(array[number])` |
| to_array | `to_array(any)` |
| to_number | `to_number(any)` |
| to_string | `to_string(any)` |
| trim | `trim(string, string)` |
| trim_left | `trim_left(string, string)` |
| trim_right | `trim_right(string, string)` |
| type | `type(any)` |
| upper | `upper(string)` |
| values | `values(object)` |
| zip | `zip(array, array)` |

## custom functions

| Name | Signature |
|---|---|
| at | `at(array, any)` |
| concat | `concat(string, string)` |
| json_parse | `json_parse(string)` |
| wildcard | `wildcard(string, string)` |

## kyverno functions

| Name | Signature |
|---|---|
| compare | `compare(string, string)` |
| equal_fold | `equal_fold(string, string)` |
| replace | `replace(string, string, string, number)` |
| replace_all | `replace_all(string, string, string)` |
| to_upper | `to_upper(string)` |
| to_lower | `to_lower(string)` |
| 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)` |
| label_match | `label_match(object, object)` |
| to_boolean | `to_boolean(string)` |
| add | `add(any, any)` |
| sum | `sum(array)` |
| subtract | `subtract(any, any)` |
| multiply | `multiply(any, any)` |
| divide | `divide(any, any)` |
| modulo | `modulo(any, any)` |
| round | `round(number, number)` |
| base64_decode | `base64_decode(string)` |
| base64_encode | `base64_encode(string)` |
| time_since | `time_since(string, string, string)` |
| time_now | `time_now()` |
| time_now_utc | `time_now_utc()` |
| path_canonicalize | `path_canonicalize(string)` |
| truncate | `truncate(string, number)` |
| 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)` |
| object_from_lists | `object_from_lists(array, array)` |
| random | `random(string)` |
| x509_decode | `x509_decode(string)` |
| time_to_cron | `time_to_cron(string)` |
| time_add | `time_add(string, string)` |
| time_parse | `time_parse(string, string)` |
| time_utc | `time_utc(string)` |
| time_diff | `time_diff(string, string)` |
| time_before | `time_before(string, string)` |
| time_after | `time_after(string, string)` |
| time_between | `time_between(string, string, string)` |
| time_truncate | `time_truncate(string, string)` |

51 changes: 0 additions & 51 deletions website/docs/jp/main.go

This file was deleted.

37 changes: 35 additions & 2 deletions website/docs/performance.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,40 @@ layered_runtime:

### Kyverno-envoy-plugin

The third component is the `kyverno-envoy-plugin` itself, which is configured to load and enforce Kyverno policies on incoming requests. checkout for [kyverno-envoy-plugin](././manifest/app-envoy-plugin.yaml)
The third component is the `kyverno-envoy-plugin` itself, which is configured to load and enforce Kyverno policies on incoming requests.

```yaml
containers:
- name: kyverno-envoy-plugin
image: sanskardevops/plugin:0.0.34
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8181
- containerPort: 9000
volumeMounts:
- readOnly: true
mountPath: /policies
name: policy-files
args:
- "serve"
- "--policy=/policies/policy.yaml"
- "--address=:9000"
- "--healthaddress=:8181"
livenessProbe:
httpGet:
path: /health
scheme: HTTP
port: 8181
initialDelaySeconds: 5
periodSeconds: 5
readinessProbe:
httpGet:
path: /health
scheme: HTTP
port: 8181
initialDelaySeconds: 5
periodSeconds: 5
```
## Benchmark Scenarios
Expand All @@ -107,7 +140,7 @@ To perform load testing, we'll use the k6 tool. Follow these steps:

1. **Install k6**: Install k6 on your machine by following the instructions on the official website: https://k6.io/docs/getting-started/installation/

2. **Write the k6 script**: An example script is provided in the repository [k6-script.js](k6-script.js)
2. **Write the k6 script**: Below is the example k6 script.

```js
import http from 'k6/http';
Expand Down
2 changes: 1 addition & 1 deletion website/docs/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ The `applicaition.yaml` manifest defines the following resource:

- A ConfigMap `envoy-config` is used to pass an Envoy configuration with an External Authorization Filter to direct authorization checks to the kyverno-envoy-plugin sidecar.

- The Deployment also includes an init container that install iptables rules to redirect all container traffic to the Envoy proxy sidecar container , more about init container can be found [here](./envoy_iptables)
- The Deployment also includes an init container that install iptables rules to redirect all container traffic to the Envoy proxy sidecar container , more about init container can be found [here](https://github.com/kyverno/kyverno-envoy-plugin/tree/main/demo/standalone-envoy/envoy_iptables)

### Make Test application accessible in the cluster .

Expand Down
2 changes: 1 addition & 1 deletion website/docs/tutorials/istio.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ metadata:
EOF
```

First we need to apply [kyverno policy configmap](manifests/policy-config.yaml) this policy will be passed to kyverno-envoy-sidecar injector admission controller:
First we need to apply kyverno policy configmap this policy will be passed to kyverno-envoy-sidecar injector admission controller:

```shell
$ kubectl apply -f - <<EOF
Expand Down
13 changes: 8 additions & 5 deletions website/docs/tutorials/mtls-istio.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ helm upgrade --install istiod --namespace $ISTIO_NS --create

### Sample applications

Manifests for the sample applications are available in [test-application-1.yaml](manifests/test-application-1.yaml) and [test-application-2.yaml](manifests/test-application-2.yaml). The sample app `testapp-1` provides information about books in a collection and exposes APIs to get, create and delete Book resources. The sample app `testapp-2` provides information about movies in a collection and exposes APIs to get, create and delete Movie resources.
Manifests for the sample applications are available in test-application-1.yaml and test-application-2.yaml. The sample app `testapp-1` provides information about books in a collection and exposes APIs to get, create and delete Book resources. The sample app `testapp-2` provides information about movies in a collection and exposes APIs to get, create and delete Movie resources.

```shell
$ kubectl apply -f - <<EOF
Expand All @@ -210,7 +210,8 @@ EOF
```

```shell
# deploy sample application testapp-1
# test-application-1.yaml
# Deploy sample application testapp-1
$ kubectl apply -f - <<EOF
apiVersion: apps/v1
kind: Deployment
Expand Down Expand Up @@ -249,7 +250,8 @@ EOF
```

```shell
# deploy sample application testapp-2
# test-application-2.yaml
# Deploy sample application testapp-2
$ kubectl apply -f - <<EOF
apiVersion: apps/v1
kind: Deployment
Expand Down Expand Up @@ -358,7 +360,7 @@ This policy configures an external service for authorization. Note that the serv

### Authorization service deployment

The deployment manifest of the authorization service is available in [ext-auth-server.yaml](manifests/ext-auth-server.yaml). This deployment require policy through configmap .
The deployment manifest of the authorization service is available in ext-auth-server.yaml. This deployment require policy through configmap .

Apply the policy configmap with the following command.

Expand Down Expand Up @@ -416,7 +418,8 @@ EOF
```

```shell
#Deploy the kyverno external authorizer server
# ext-auth-server.yaml
# Deploy the kyverno external authorizer server
$ kubectl apply -f - <<EOF
apiVersion: v1
kind: Service
Expand Down
2 changes: 1 addition & 1 deletion website/mkdocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ nav:
- Home: index.md
- Documentation:
- intro.md
- quickstart.md
- quick-start.md
- Writing policies:
- policies/policies.md
- policies/asserts.md
Expand Down

0 comments on commit 8956638

Please sign in to comment.