Skip to content

Commit e29da66

Browse files
doc: Adapt overrides page
1 parent 3f63f60 commit e29da66

2 files changed

Lines changed: 111 additions & 53 deletions

File tree

docs/modules/opensearch/pages/index.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ It creates a number of different Kubernetes resources based on this {crs}[custom
3232
The OpenSearchCluster is the resource for the configuration of the OpenSearch instance.
3333
The resource defines only one xref:concepts:roles-and-role-groups.adoc[role], the `nodes`.
3434
The various configuration options are explained in the xref:usage-guide/index.adoc[].
35-
It helps you tune your cluster to your needs by configuring xref:usage-guide/storage-resource-configuration.adoc[resource usage], xref:usage-guide/security.adoc[security], xref:usage-guide/logging.adoc[logging] and more.
35+
It helps you tune your cluster to your needs by configuring xref:usage-guide/storage-resource-configuration.adoc[resource usage] and more.
3636

3737
=== Kubernetes resources
3838

Lines changed: 110 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
= Configuration & Environment Overrides
22

3-
The cluster definition also supports overriding configuration properties and environment variables,
3+
The cluster definition also supports overriding configuration properties, environment variables and CLI parameters,
44
either per role or per role group, where the more specific override (role group) has precedence over
55
the less specific one (role).
66

7-
IMPORTANT: Overriding certain properties which are set by the operator (such as the `STATS_LOGGER`) can interfere with the operator and can lead to problems.
7+
IMPORTANT: Overriding certain properties which are set by the operator (such as the `network.host`) can interfere with the operator and can lead to problems.
88

99
== Configuration Properties
1010

11-
For a role or role group, at the same level of `config`, you can specify `configOverrides` for the `superset_config.py`.
12-
For example, if you want to set the CSV export encoding and the preferred databases adapt the `nodes` section of the cluster resource as follows:
11+
For a role or role group, at the same level of `config`, you can specify `configOverrides` for the `opensearch.yml`.
12+
For example, if you want to enable role-based access to the REST management API for the role `all_access`, then adapt the `nodes` section of the cluster resource as follows:
1313

1414
[source,yaml]
1515
----
@@ -18,16 +18,8 @@ nodes:
1818
default:
1919
config: {}
2020
configOverrides:
21-
superset_config.py:
22-
CSV_EXPORT: "{'encoding': 'utf-8'}"
23-
PREFERRED_DATABASES: |-
24-
[
25-
'PostgreSQL',
26-
'Presto',
27-
'MySQL',
28-
'SQLite',
29-
# etc.
30-
]
21+
opensearch.yml:
22+
plugins.security.restapi.roles_enabled: all_access
3123
----
3224

3325
Just as for the `config`, it is possible to specify this at the role level as well:
@@ -36,53 +28,95 @@ Just as for the `config`, it is possible to specify this at the role level as we
3628
----
3729
nodes:
3830
configOverrides:
39-
superset_config.py:
40-
CSV_EXPORT: "{'encoding': 'utf-8'}"
41-
PREFERRED_DATABASES: |-
42-
[
43-
'PostgreSQL',
44-
'Presto',
45-
'MySQL',
46-
'SQLite',
47-
# etc.
48-
]
31+
opensearch.yml:
32+
plugins.security.restapi.roles_enabled: all_access
4933
roleGroups:
5034
default:
5135
config: {}
5236
----
5337

5438
All override property values must be strings.
55-
They are treated as Python expressions.
39+
They are added unchanged to the configuration file.
5640
So care must be taken to produce a valid configuration.
5741

58-
For a full list of configuration options we refer to the
59-
https://github.com/apache/superset/blob/master/superset/config.py[main config file for Superset].
42+
For a list of configuration options, we refer to the
43+
https://docs.opensearch.org/docs/latest/install-and-configure/configuring-opensearch/index/[Configuring OpenSearch] section in the OpenSearch documentation.
6044

61-
As Superset can be configured with python code too, arbitrary code can be added to the `superset_conf.py`.
62-
You can use either `EXPERIMENTAL_FILE_HEADER` to add code to the top or `EXPERIMENTAL_FILE_FOOTER` to add to the bottom.
45+
The file `opensearch.yml` is a YAML file, where deep structures are possible.
46+
On the other hand, `configOverrides` are only flat key-value pairs.
47+
Fortunately, this is not a problem because the OpenSearch YAML parser allows both representations.
48+
Keys can be flattened as follows:
6349

64-
IMPORTANT: This is an experimental feature
50+
[source,yaml]
51+
----
52+
# File: opensearch.yml
53+
54+
plugins.security.restapi.roles_enabled: all_access
55+
56+
# is equivalent to
57+
58+
plugins:
59+
security:
60+
restapi:
61+
roles_enabled: all_access
62+
----
63+
64+
Lists can be flattened as follows:
6565

6666
[source,yaml]
6767
----
68-
nodes:
69-
configOverrides:
70-
superset_config.py:
71-
CSV_EXPORT: "{'encoding': 'utf-8'}"
72-
EXPERIMENTAL_FILE_HEADER: |
73-
from modules.my_module import my_class
74-
EXPERIMENTAL_FILE_FOOTER: |
75-
import logging
76-
from superset.security import SupersetSecurityManager
77-
78-
class myCustomSecurityManger(SupersetSecurityManager):
79-
def __init__():
80-
init()
81-
82-
CUSTOM_SECURITY_MANAGER = myCustomSecurityManger
83-
roleGroups:
84-
default:
85-
config: {}
68+
# File: opensearch.yml
69+
70+
# as a comma-separated list: <1>
71+
plugins.security.restapi.roles_enabled: role1,role2,role3
72+
73+
# as a JSON list: <2>
74+
plugins.security.restapi.roles_enabled: ["role1", "role2", "role3"]
75+
76+
# as an indexed flat list: <3>
77+
plugins.security.restapi.roles_enabled.0: role1
78+
plugins.security.restapi.roles_enabled.1: role2
79+
plugins.security.restapi.roles_enabled.2: role3
80+
81+
# All options above are equivalent to
82+
83+
plugins:
84+
security:
85+
restapi:
86+
roles_enabled:
87+
- role1
88+
- role2
89+
- role3
90+
----
91+
<1> Commas in list entries cannot be escaped.
92+
<2> The brackets must be escaped in `configOverrides` as follows: `"[\"role1\", \"role2\", \"role3\"]"`
93+
<3> Indexed flat lists are considered "legacy" in the OpenSearch code.
94+
// see https://github.com/opensearch-project/OpenSearch/blob/3.1.0/server/src/main/java/org/opensearch/common/settings/Settings.java#L1049
95+
96+
Other types can be set as strings in `configOverrides` because OpenSearch parses them:
97+
98+
[source,yaml]
99+
----
100+
# File: opensearch.yml
101+
102+
# Boolean as string
103+
cluster.blocks.read_only: "true"
104+
105+
# Integer as string
106+
cluster.max_shards_per_node: "10000"
107+
108+
# Floating point as string
109+
cluster.routing.allocation.balance.index: "0.6"
110+
111+
# Time unit as string
112+
cluster.info.update.interval: "10s"
113+
114+
# The options above are equivalent to
115+
116+
cluster.blocks.read_only: true
117+
cluster.max_shards_per_node: 10000
118+
cluster.routing.allocation.balance.index: 0.6
119+
cluster.info.update.interval: 10s
86120
----
87121

88122
== Environment Variables
@@ -97,7 +131,7 @@ nodes:
97131
default:
98132
config: {}
99133
envOverrides:
100-
FLASK_ENV: development
134+
OPENSEARCH_PATH_CONF: /etc/opensearch
101135
----
102136

103137
or per role:
@@ -106,15 +140,39 @@ or per role:
106140
----
107141
nodes:
108142
envOverrides:
109-
FLASK_ENV: development
143+
OPENSEARCH_PATH_CONF: /etc/opensearch
110144
roleGroups:
111145
default:
112146
config: {}
113147
----
114148

115-
// cliOverrides don't make sense for this operator, so the feature is omitted for now
149+
== CLI parameters
150+
151+
CLI parameters can be set with `cliOverrides` per role group:
152+
153+
[source,yaml]
154+
----
155+
nodes:
156+
roleGroups:
157+
default:
158+
config: {}
159+
cliOverrides:
160+
--pidfile: /tmp/mypidfile.pid
161+
----
162+
163+
or per role:
164+
165+
[source,yaml]
166+
----
167+
nodes:
168+
cliOverrides:
169+
--pidfile: /tmp/mypidfile.pid
170+
roleGroups:
171+
default:
172+
config: {}
173+
----
116174

117175
== Pod overrides
118176

119-
The Superset operator also supports Pod overrides, allowing you to override any property that you can set on a Kubernetes Pod.
177+
The OpenSearch operator also supports Pod overrides, allowing you to override any property that you can set on a Kubernetes Pod.
120178
Read the xref:concepts:overrides.adoc#pod-overrides[Pod overrides documentation] to learn more about this feature.

0 commit comments

Comments
 (0)