Skip to content

Commit

Permalink
docs: added JSONPatch example for modifying Bootstrap config using th…
Browse files Browse the repository at this point in the history
…e EnvoyProxy resource (#4742)

Signed-off-by: Evgeniya Pankova <[email protected]>
  • Loading branch information
alrai committed Nov 24, 2024
1 parent 71c0b54 commit eac1651
Show file tree
Hide file tree
Showing 3 changed files with 126 additions and 9 deletions.
45 changes: 42 additions & 3 deletions site/content/en/docs/tasks/operations/customize-envoyproxy.md
Original file line number Diff line number Diff line change
Expand Up @@ -498,13 +498,14 @@ After applying the config, you can get the envoyproxy service, and see annotatio
## Customize EnvoyProxy Bootstrap Config

You can customize the EnvoyProxy bootstrap config via EnvoyProxy Config.
There are two ways to customize it:
There are three ways to customize it:

* Replace: the whole bootstrap config will be replaced by the config you provided.
* Merge: the config you provided will be merged into the default bootstrap config.
* JSONPatch: the list of JSON Patches you provided will be applied to the bootstrap config. JSON Patch is a standard format specified in [RFC 6902](https://datatracker.ietf.org/doc/html/rfc6902/).

{{< tabpane text=true >}}
{{% tab header="Apply from stdin" %}}
{{% tab header="Replace: apply from stdin" %}}

```shell
cat <<EOF | kubectl apply -f -
Expand Down Expand Up @@ -591,7 +592,7 @@ EOF
```

{{% /tab %}}
{{% tab header="Apply from file" %}}
{{% tab header="Replace: apply from file" %}}
Save and apply the following resource to your cluster:

```yaml
Expand Down Expand Up @@ -677,6 +678,44 @@ spec:
name: runtime-0
```

{{% /tab %}}
{{% tab header="JSONPatch: apply from stdin" %}}
Save and apply the following resource to your cluster:

```shell
cat <<EOF | kubectl apply -f -
apiVersion: gateway.envoyproxy.io/v1alpha1
kind: EnvoyProxy
metadata:
name: custom-proxy-config
namespace: default
spec:
bootstrap:
type: JSONPatch
jsonPatches:
- {"op": "add", "path": "/static_resources/clusters/0/dns_lookup_family", "value": "V4_ONLY"}
- {"op": "replace", "path": "/admin/address/socket_address/port_value", "value": 9901}
EOF
```

{{% /tab %}}
{{% tab header="JSONPatch: apply from file" %}}
Save and apply the following resource to your cluster:
```yaml

Check failure on line 704 in site/content/en/docs/tasks/operations/customize-envoyproxy.md

View workflow job for this annotation

GitHub Actions / docs-lint

Fenced code blocks should be surrounded by blank lines [Context: "```yaml"]
---
apiVersion: gateway.envoyproxy.io/v1alpha1
kind: EnvoyProxy
metadata:
name: custom-proxy-config
namespace: default
spec:
bootstrap:
type: JSONPatch
jsonPatches:
- {"op": "add", "path": "/static_resources/clusters/0/dns_lookup_family", "value": "V4_ONLY"}
- {"op": "replace", "path": "/admin/address/socket_address/port_value", "value": 9901}
```

{{% /tab %}}
{{< /tabpane >}}

Expand Down
45 changes: 42 additions & 3 deletions site/content/en/latest/tasks/operations/customize-envoyproxy.md
Original file line number Diff line number Diff line change
Expand Up @@ -498,13 +498,14 @@ After applying the config, you can get the envoyproxy service, and see annotatio
## Customize EnvoyProxy Bootstrap Config

You can customize the EnvoyProxy bootstrap config via EnvoyProxy Config.
There are two ways to customize it:
There are three ways to customize it:

* Replace: the whole bootstrap config will be replaced by the config you provided.
* Merge: the config you provided will be merged into the default bootstrap config.
* JSONPatch: the list of JSON Patches you provided will be applied to the bootstrap config. JSON Patch is a standard format specified in [RFC 6902](https://datatracker.ietf.org/doc/html/rfc6902/).

{{< tabpane text=true >}}
{{% tab header="Apply from stdin" %}}
{{% tab header="Replace: apply from stdin" %}}

```shell
cat <<EOF | kubectl apply -f -
Expand Down Expand Up @@ -591,7 +592,7 @@ EOF
```

{{% /tab %}}
{{% tab header="Apply from file" %}}
{{% tab header="Replace: apply from file" %}}
Save and apply the following resource to your cluster:

```yaml
Expand Down Expand Up @@ -677,6 +678,44 @@ spec:
name: runtime-0
```

{{% /tab %}}
{{% tab header="JSONPatch: apply from stdin" %}}
Save and apply the following resource to your cluster:

```shell
cat <<EOF | kubectl apply -f -
apiVersion: gateway.envoyproxy.io/v1alpha1
kind: EnvoyProxy
metadata:
name: custom-proxy-config
namespace: default
spec:
bootstrap:
type: JSONPatch
jsonPatches:
- {"op": "add", "path": "/static_resources/clusters/0/dns_lookup_family", "value": "V4_ONLY"}
- {"op": "replace", "path": "/admin/address/socket_address/port_value", "value": 9901}
EOF
```

{{% /tab %}}
{{% tab header="JSONPatch: apply from file" %}}
Save and apply the following resource to your cluster:
```yaml

Check failure on line 704 in site/content/en/latest/tasks/operations/customize-envoyproxy.md

View workflow job for this annotation

GitHub Actions / docs-lint

Fenced code blocks should be surrounded by blank lines [Context: "```yaml"]
---
apiVersion: gateway.envoyproxy.io/v1alpha1
kind: EnvoyProxy
metadata:
name: custom-proxy-config
namespace: default
spec:
bootstrap:
type: JSONPatch
jsonPatches:
- {"op": "add", "path": "/static_resources/clusters/0/dns_lookup_family", "value": "V4_ONLY"}
- {"op": "replace", "path": "/admin/address/socket_address/port_value", "value": 9901}
```

{{% /tab %}}
{{< /tabpane >}}

Expand Down
45 changes: 42 additions & 3 deletions site/content/en/v1.2/tasks/operations/customize-envoyproxy.md
Original file line number Diff line number Diff line change
Expand Up @@ -498,13 +498,14 @@ After applying the config, you can get the envoyproxy service, and see annotatio
## Customize EnvoyProxy Bootstrap Config

You can customize the EnvoyProxy bootstrap config via EnvoyProxy Config.
There are two ways to customize it:
There are three ways to customize it:

* Replace: the whole bootstrap config will be replaced by the config you provided.
* Merge: the config you provided will be merged into the default bootstrap config.
* JSONPatch: the list of JSON Patches you provided will be applied to the bootstrap config. JSON Patch is a standard format specified in [RFC 6902](https://datatracker.ietf.org/doc/html/rfc6902/).

{{< tabpane text=true >}}
{{% tab header="Apply from stdin" %}}
{{% tab header="Replace: apply from stdin" %}}

```shell
cat <<EOF | kubectl apply -f -
Expand Down Expand Up @@ -591,7 +592,7 @@ EOF
```

{{% /tab %}}
{{% tab header="Apply from file" %}}
{{% tab header="Replace: apply from file" %}}
Save and apply the following resource to your cluster:

```yaml
Expand Down Expand Up @@ -677,6 +678,44 @@ spec:
name: runtime-0
```

{{% /tab %}}
{{% tab header="JSONPatch: apply from stdin" %}}
Save and apply the following resource to your cluster:

```shell
cat <<EOF | kubectl apply -f -
apiVersion: gateway.envoyproxy.io/v1alpha1
kind: EnvoyProxy
metadata:
name: custom-proxy-config
namespace: default
spec:
bootstrap:
type: JSONPatch
jsonPatches:
- {"op": "add", "path": "/static_resources/clusters/0/dns_lookup_family", "value": "V4_ONLY"}
- {"op": "replace", "path": "/admin/address/socket_address/port_value", "value": 9901}
EOF
```

{{% /tab %}}
{{% tab header="JSONPatch: apply from file" %}}
Save and apply the following resource to your cluster:
```yaml

Check failure on line 704 in site/content/en/v1.2/tasks/operations/customize-envoyproxy.md

View workflow job for this annotation

GitHub Actions / docs-lint

Fenced code blocks should be surrounded by blank lines [Context: "```yaml"]
---
apiVersion: gateway.envoyproxy.io/v1alpha1
kind: EnvoyProxy
metadata:
name: custom-proxy-config
namespace: default
spec:
bootstrap:
type: JSONPatch
jsonPatches:
- {"op": "add", "path": "/static_resources/clusters/0/dns_lookup_family", "value": "V4_ONLY"}
- {"op": "replace", "path": "/admin/address/socket_address/port_value", "value": 9901}
```

{{% /tab %}}
{{< /tabpane >}}

Expand Down

0 comments on commit eac1651

Please sign in to comment.