Skip to content

Commit 6a5c85c

Browse files
sbernauerdervoeti
andauthored
Document JSON configOverrides (#842)
* Document JSON configOverrides * Apply suggestions from code review Co-authored-by: Lukas Krug <lukas@luvosys.de> --------- Co-authored-by: Lukas Krug <lukas@luvosys.de>
1 parent 5f1e30f commit 6a5c85c

1 file changed

Lines changed: 67 additions & 2 deletions

File tree

modules/concepts/pages/overrides.adoc

Lines changed: 67 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,78 @@ spec:
5151
<4> `configOverride` on role group level, takes precedence over overrides at role level.
5252

5353
The roles, as well as the configuration file and configuration settings available depend on the specific product.
54-
All override property values must be strings.
5554
The properties will be formatted and escaped correctly into the file format used by the product, which is again product specific.
56-
This can be a `.properities` file, XML, YAML or JSON.
55+
This can be a `.properties` file, XML, or YAML.
5756

5857
You can also set the property to an empty string (`my.property: ""`), which effectively disables the property the operator would write out normally.
5958
In case of a `.properties` file, this will show up as `my.property=` in the `.properties` file.
6059

60+
[#json-config-overrides]
61+
=== JSON config overrides
62+
63+
Some products accept JSON config files (e.g. Open Policy Agent's `config.json`).
64+
The above mentioned `Map<String, String>` structure doesn't fit this, so there is a special mechanism for these files.
65+
66+
==== JSON Merge Patch (https://datatracker.ietf.org/doc/html/rfc7396[RFC 7396])
67+
68+
The `jsonMergePatch` is used best in case you want to make simple additions or changes to the config.
69+
70+
[source,yaml]
71+
----
72+
configOverrides:
73+
config.json:
74+
jsonMergePatch:
75+
bundles:
76+
authz:
77+
polling:
78+
min_delay_seconds: 3
79+
----
80+
81+
==== JSON Patch (https://datatracker.ietf.org/doc/html/rfc6902[RFC 6902])
82+
83+
The `jsonPatch` is more complicated than the `jsonMergePatch`, but offers more flexibility, e.g. to remove config items.
84+
85+
[source,yaml]
86+
----
87+
configOverrides:
88+
config.json:
89+
jsonPatches:
90+
- '{"op": "test", "path": "/0/name", "value": "Andrew"}'
91+
- '{"op": "add", "path": "/0/happy", "value": true}'
92+
- '{"op": "remove", "path": "/0/birthDate"}'
93+
----
94+
95+
==== User provided JSON
96+
97+
As an escape hatch you can also provide your custom JSON config, which the operator will pass to the product.
98+
99+
[source,yaml]
100+
----
101+
configOverrides:
102+
config.json:
103+
userProvided: {
104+
"myString": "test",
105+
"myList": ["test"],
106+
"myBool": true,
107+
"my": {"nested.field.with.dots": 42}
108+
}
109+
----
110+
111+
NOTE: JSON is a valid subset of YAML, so you can inline JSON into YAML.
112+
However, you can also use YAML syntax:
113+
114+
[source,yaml]
115+
----
116+
configOverrides:
117+
config.json:
118+
userProvided:
119+
myString: test
120+
myList: [test]
121+
myBool: true
122+
my:
123+
nested.field.with.dots: 42
124+
----
125+
61126
[#env-overrides]
62127
== Environment variable overrides
63128

0 commit comments

Comments
 (0)