Skip to content

Commit 26b4891

Browse files
committed
docs: add JsonPatch and UserProvided config override examples
1 parent 338aaa1 commit 26b4891

1 file changed

Lines changed: 33 additions & 8 deletions

File tree

docs/modules/opa/pages/usage-guide/configuration-environment-overrides.adoc

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,43 @@ This will lead to faulty installations.
1111
OPA's `config.json` can be overridden using `configOverrides`.
1212
For details on the supported override strategies, see the xref:concepts:overrides.adoc#json-config-overrides[config overrides documentation].
1313

14+
A JSON merge patch (https://datatracker.ietf.org/doc/html/rfc7396[RFC 7396]) is the recommended way to override the configuration.
15+
For example per role group:
16+
17+
[source,yaml]
18+
----
19+
servers:
20+
roleGroups:
21+
default:
22+
configOverrides:
23+
config.json:
24+
jsonMergePatch:
25+
distributed_tracing:
26+
address: jaeger-collector.default.svc.cluster.local:4317
27+
type: grpc
28+
----
29+
30+
When more flexibility is needed, e.g. to only modify elements in a list based on a condition, a JSON patch (https://datatracker.ietf.org/doc/html/rfc6902[RFC 6902]) can be used.
1431
For example per role:
1532

1633
[source,yaml]
1734
----
1835
servers:
1936
configOverrides:
2037
config.json:
21-
jsonPatches:
22-
- '{"op": "replace", "path": "/bundles/stackable/polling/min_delay_seconds", "value": 3}'
23-
- '{"op": "add", "path": "/default_decision", "value": "allow"}'
38+
jsonPatch:
39+
- op: replace
40+
path: /bundles/stackable/polling/min_delay_seconds
41+
value: 3
42+
- op: add
43+
path: /default_decision
44+
value: allow
2445
roleGroups:
2546
default:
2647
config: {}
2748
----
2849

29-
or per role group:
50+
To replace the entire `config.json` file instead of patching it, use `userProvided`:
3051

3152
[source,yaml]
3253
----
@@ -35,10 +56,14 @@ servers:
3556
default:
3657
configOverrides:
3758
config.json:
38-
jsonMergePatch:
39-
distributed_tracing:
40-
address: jaeger-collector.default.svc.cluster.local:4317
41-
type: grpc
59+
userProvided:
60+
services:
61+
- name: stackable
62+
url: http://localhost:3030/opa/v1
63+
bundles:
64+
stackable:
65+
service: stackable
66+
resource: opa/bundle.tar.gz
4267
----
4368

4469
== Environment variables

0 commit comments

Comments
 (0)