Skip to content

Commit c999960

Browse files
Fix the scope of the constants in node_config; Fix a failing unit test
1 parent 1f58a6e commit c999960

File tree

1 file changed

+22
-23
lines changed

1 file changed

+22
-23
lines changed

rust/operator-binary/src/controller/build/node_config.rs

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -24,103 +24,101 @@ pub const CONFIGURATION_FILE_OPENSEARCH_YML: &str = "opensearch.yml";
2424

2525
/// The cluster name.
2626
/// Type: string
27-
pub const CONFIG_OPTION_CLUSTER_NAME: &str = "cluster.name";
27+
const CONFIG_OPTION_CLUSTER_NAME: &str = "cluster.name";
2828

2929
/// The list of hosts that perform discovery when a node is started.
3030
/// Type: (comma-separated) list of strings
31-
pub const CONFIG_OPTION_DISCOVERY_SEED_HOSTS: &str = "discovery.seed_hosts";
31+
const CONFIG_OPTION_DISCOVERY_SEED_HOSTS: &str = "discovery.seed_hosts";
3232

3333
/// By default, OpenSearch forms a multi-node cluster. Set `discovery.type` to `single-node` to
3434
/// form a single-node cluster.
3535
/// Type: string
36-
pub const CONFIG_OPTION_DISCOVERY_TYPE: &str = "discovery.type";
36+
const CONFIG_OPTION_DISCOVERY_TYPE: &str = "discovery.type";
3737

3838
/// Specifies an address or addresses that an OpenSearch node publishes to other nodes for HTTP
3939
/// communication.
4040
/// Type: (comma-separated) list of strings
41-
pub const CONFIG_OPTION_HTTP_PUBLISH_HOST: &str = "http.publish_host";
41+
const CONFIG_OPTION_HTTP_PUBLISH_HOST: &str = "http.publish_host";
4242

4343
/// A list of cluster-manager-eligible nodes used to bootstrap the cluster.
4444
/// Type: (comma-separated) list of strings
45-
pub const CONFIG_OPTION_INITIAL_CLUSTER_MANAGER_NODES: &str =
46-
"cluster.initial_cluster_manager_nodes";
45+
const CONFIG_OPTION_INITIAL_CLUSTER_MANAGER_NODES: &str = "cluster.initial_cluster_manager_nodes";
4746

4847
/// Binds an OpenSearch node to an address.
4948
/// Type: string
50-
pub const CONFIG_OPTION_NETWORK_HOST: &str = "network.host";
49+
const CONFIG_OPTION_NETWORK_HOST: &str = "network.host";
5150

5251
/// Specifies an address or addresses that an OpenSearch node publishes to other nodes in the
5352
/// cluster so that they can connect to it.
5453
/// Type: (comma-separated) list of strings
55-
pub const CONFIG_OPTION_NETWORK_PUBLISH_HOST: &str = "network.publish_host";
54+
const CONFIG_OPTION_NETWORK_PUBLISH_HOST: &str = "network.publish_host";
5655

5756
/// The custom node attribute "role-group"
5857
/// Type: string
59-
pub const CONFIG_OPTION_NODE_ATTR_ROLE_GROUP: &str = "node.attr.role-group";
58+
const CONFIG_OPTION_NODE_ATTR_ROLE_GROUP: &str = "node.attr.role-group";
6059

6160
/// A descriptive name for the node.
6261
/// Type: string
63-
pub const CONFIG_OPTION_NODE_NAME: &str = "node.name";
62+
const CONFIG_OPTION_NODE_NAME: &str = "node.name";
6463

6564
/// Defines one or more roles for an OpenSearch node.
6665
/// Type: (comma-separated) list of strings
67-
pub const CONFIG_OPTION_NODE_ROLES: &str = "node.roles";
66+
const CONFIG_OPTION_NODE_ROLES: &str = "node.roles";
6867

6968
/// Defines the path for the logs
7069
/// OpenSearch grants the required access rights, see
7170
/// https://github.com/opensearch-project/OpenSearch/blob/3.4.0/server/src/main/java/org/opensearch/bootstrap/Security.java#L369
7271
/// The permissions "write" and "delete" are required for the log file rollover.
7372
/// Type: string
74-
pub const CONFIG_OPTION_PATH_LOGS: &str = "path.logs";
73+
const CONFIG_OPTION_PATH_LOGS: &str = "path.logs";
7574

7675
/// Specifies a list of distinguished names (DNs) that denote the other nodes in the cluster.
7776
/// Type: (comma-separated) list of strings
78-
pub const CONFIG_OPTION_PLUGINS_SECURITY_NODES_DN: &str = "plugins.security.nodes_dn";
77+
const CONFIG_OPTION_PLUGINS_SECURITY_NODES_DN: &str = "plugins.security.nodes_dn";
7978

8079
/// Whether to enable TLS on the REST layer. If enabled, only HTTPS is allowed.
8180
/// Type: boolean
82-
pub const CONFIG_OPTION_PLUGINS_SECURITY_SSL_HTTP_ENABLED: &str =
83-
"plugins.security.ssl.http.enabled";
81+
const CONFIG_OPTION_PLUGINS_SECURITY_SSL_HTTP_ENABLED: &str = "plugins.security.ssl.http.enabled";
8482

8583
/// Path to the cert PEM file used for TLS on the HTTP PORT.
8684
/// type: string
87-
pub const CONFIG_OPTION_PLUGINS_SECURITY_SSL_HTTP_PEMCERT_FILEPATH: &str =
85+
const CONFIG_OPTION_PLUGINS_SECURITY_SSL_HTTP_PEMCERT_FILEPATH: &str =
8886
"plugins.security.ssl.http.pemcert_filepath";
8987

9088
/// Path to the key PEM file used for TLS on the HTTP PORT.
9189
/// type: string
92-
pub const CONFIG_OPTION_PLUGINS_SECURITY_SSL_HTTP_PEMKEY_FILEPATH: &str =
90+
const CONFIG_OPTION_PLUGINS_SECURITY_SSL_HTTP_PEMKEY_FILEPATH: &str =
9391
"plugins.security.ssl.http.pemkey_filepath";
9492

9593
/// Path to the trusted CAs PEM file used for TLS on the HTTP PORT.
9694
/// type: string
97-
pub const CONFIG_OPTION_PLUGINS_SECURITY_SSL_HTTP_PEMTRUSTEDCAS_FILEPATH: &str =
95+
const CONFIG_OPTION_PLUGINS_SECURITY_SSL_HTTP_PEMTRUSTEDCAS_FILEPATH: &str =
9896
"plugins.security.ssl.http.pemtrustedcas_filepath";
9997

10098
/// Whether to enable TLS on internal node-to-node communication using the transport port.
10199
/// type: boolean
102-
pub const CONFIG_OPTION_PLUGINS_SECURITY_SSL_TRANSPORT_ENABLED: &str =
100+
const CONFIG_OPTION_PLUGINS_SECURITY_SSL_TRANSPORT_ENABLED: &str =
103101
"plugins.security.ssl.transport.enabled";
104102

105103
/// Path to the cert PEM file used for TLS on the transport PORT.
106104
/// type: string
107-
pub const CONFIG_OPTION_PLUGINS_SECURITY_SSL_TRANSPORT_PEMCERT_FILEPATH: &str =
105+
const CONFIG_OPTION_PLUGINS_SECURITY_SSL_TRANSPORT_PEMCERT_FILEPATH: &str =
108106
"plugins.security.ssl.transport.pemcert_filepath";
109107

110108
/// Path to the key PEM file used for TLS on the transport PORT.
111109
/// type: string
112-
pub const CONFIG_OPTION_PLUGINS_SECURITY_SSL_TRANSPORT_PEMKEY_FILEPATH: &str =
110+
const CONFIG_OPTION_PLUGINS_SECURITY_SSL_TRANSPORT_PEMKEY_FILEPATH: &str =
113111
"plugins.security.ssl.transport.pemkey_filepath";
114112

115113
/// Path to the trusted CAs PEM file used for TLS on the transport PORT.
116114
/// type: string
117-
pub const CONFIG_OPTION_PLUGINS_SECURITY_SSL_TRANSPORT_PEMTRUSTEDCAS_FILEPATH: &str =
115+
const CONFIG_OPTION_PLUGINS_SECURITY_SSL_TRANSPORT_PEMTRUSTEDCAS_FILEPATH: &str =
118116
"plugins.security.ssl.transport.pemtrustedcas_filepath";
119117

120118
/// Specifies an address or addresses that an OpenSearch node publishes to other nodes for
121119
/// transport communication.
122120
/// Type: (comma-separated) list of strings
123-
pub const CONFIG_OPTION_TRANSPORT_PUBLISH_HOST: &str = "transport.publish_host";
121+
const CONFIG_OPTION_TRANSPORT_PUBLISH_HOST: &str = "transport.publish_host";
124122

125123
const DEFAULT_OPENSEARCH_HOME: &str = "/stackable/opensearch";
126124

@@ -631,6 +629,7 @@ mod tests {
631629
"discovery.type: \"zen\"\n",
632630
"network.host: \"0.0.0.0\"\n",
633631
"node.attr.role-group: \"data\"\n",
632+
"path.logs: \"/stackable/log/opensearch\"\n",
634633
"plugins.security.nodes_dn: [\"CN=generated certificate for pod\"]\n",
635634
"plugins.security.ssl.http.enabled: true\n",
636635
"plugins.security.ssl.http.pemcert_filepath: \"/stackable/opensearch/config/tls/server/tls.crt\"\n",

0 commit comments

Comments
 (0)