@@ -13,6 +13,7 @@ use crate::{
1313 crd:: v1alpha1,
1414 framework:: {
1515 builder:: pod:: container:: { EnvVarName , EnvVarSet } ,
16+ product_logging:: framework:: STACKABLE_LOG_DIR ,
1617 role_group_utils,
1718 types:: { kubernetes:: ServiceName , operator:: RoleGroupName } ,
1819 } ,
@@ -23,96 +24,101 @@ pub const CONFIGURATION_FILE_OPENSEARCH_YML: &str = "opensearch.yml";
2324
2425/// The cluster name.
2526/// Type: string
26- pub const CONFIG_OPTION_CLUSTER_NAME : & str = "cluster.name" ;
27+ const CONFIG_OPTION_CLUSTER_NAME : & str = "cluster.name" ;
2728
2829/// The list of hosts that perform discovery when a node is started.
2930/// Type: (comma-separated) list of strings
30- pub const CONFIG_OPTION_DISCOVERY_SEED_HOSTS : & str = "discovery.seed_hosts" ;
31+ const CONFIG_OPTION_DISCOVERY_SEED_HOSTS : & str = "discovery.seed_hosts" ;
3132
3233/// By default, OpenSearch forms a multi-node cluster. Set `discovery.type` to `single-node` to
3334/// form a single-node cluster.
3435/// Type: string
35- pub const CONFIG_OPTION_DISCOVERY_TYPE : & str = "discovery.type" ;
36+ const CONFIG_OPTION_DISCOVERY_TYPE : & str = "discovery.type" ;
3637
3738/// Specifies an address or addresses that an OpenSearch node publishes to other nodes for HTTP
3839/// communication.
3940/// Type: (comma-separated) list of strings
40- pub const CONFIG_OPTION_HTTP_PUBLISH_HOST : & str = "http.publish_host" ;
41+ const CONFIG_OPTION_HTTP_PUBLISH_HOST : & str = "http.publish_host" ;
4142
4243/// A list of cluster-manager-eligible nodes used to bootstrap the cluster.
4344/// Type: (comma-separated) list of strings
44- pub const CONFIG_OPTION_INITIAL_CLUSTER_MANAGER_NODES : & str =
45- "cluster.initial_cluster_manager_nodes" ;
45+ const CONFIG_OPTION_INITIAL_CLUSTER_MANAGER_NODES : & str = "cluster.initial_cluster_manager_nodes" ;
4646
4747/// Binds an OpenSearch node to an address.
4848/// Type: string
49- pub const CONFIG_OPTION_NETWORK_HOST : & str = "network.host" ;
49+ const CONFIG_OPTION_NETWORK_HOST : & str = "network.host" ;
5050
5151/// Specifies an address or addresses that an OpenSearch node publishes to other nodes in the
5252/// cluster so that they can connect to it.
5353/// Type: (comma-separated) list of strings
54- pub const CONFIG_OPTION_NETWORK_PUBLISH_HOST : & str = "network.publish_host" ;
54+ const CONFIG_OPTION_NETWORK_PUBLISH_HOST : & str = "network.publish_host" ;
5555
5656/// The custom node attribute "role-group"
5757/// Type: string
58- 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" ;
5959
6060/// A descriptive name for the node.
6161/// Type: string
62- pub const CONFIG_OPTION_NODE_NAME : & str = "node.name" ;
62+ const CONFIG_OPTION_NODE_NAME : & str = "node.name" ;
6363
6464/// Defines one or more roles for an OpenSearch node.
6565/// Type: (comma-separated) list of strings
66- pub const CONFIG_OPTION_NODE_ROLES : & str = "node.roles" ;
66+ const CONFIG_OPTION_NODE_ROLES : & str = "node.roles" ;
67+
68+ /// Defines the path for the logs
69+ /// OpenSearch grants the required access rights, see
70+ /// https://github.com/opensearch-project/OpenSearch/blob/3.4.0/server/src/main/java/org/opensearch/bootstrap/Security.java#L369
71+ /// The permissions "write" and "delete" are required for the log file rollover.
72+ /// Type: string
73+ const CONFIG_OPTION_PATH_LOGS : & str = "path.logs" ;
6774
6875/// Specifies a list of distinguished names (DNs) that denote the other nodes in the cluster.
6976/// Type: (comma-separated) list of strings
70- 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" ;
7178
7279/// Whether to enable TLS on the REST layer. If enabled, only HTTPS is allowed.
7380/// Type: boolean
74- pub const CONFIG_OPTION_PLUGINS_SECURITY_SSL_HTTP_ENABLED : & str =
75- "plugins.security.ssl.http.enabled" ;
81+ const CONFIG_OPTION_PLUGINS_SECURITY_SSL_HTTP_ENABLED : & str = "plugins.security.ssl.http.enabled" ;
7682
7783/// Path to the cert PEM file used for TLS on the HTTP PORT.
7884/// type: string
79- pub const CONFIG_OPTION_PLUGINS_SECURITY_SSL_HTTP_PEMCERT_FILEPATH : & str =
85+ const CONFIG_OPTION_PLUGINS_SECURITY_SSL_HTTP_PEMCERT_FILEPATH : & str =
8086 "plugins.security.ssl.http.pemcert_filepath" ;
8187
8288/// Path to the key PEM file used for TLS on the HTTP PORT.
8389/// type: string
84- pub const CONFIG_OPTION_PLUGINS_SECURITY_SSL_HTTP_PEMKEY_FILEPATH : & str =
90+ const CONFIG_OPTION_PLUGINS_SECURITY_SSL_HTTP_PEMKEY_FILEPATH : & str =
8591 "plugins.security.ssl.http.pemkey_filepath" ;
8692
8793/// Path to the trusted CAs PEM file used for TLS on the HTTP PORT.
8894/// type: string
89- pub const CONFIG_OPTION_PLUGINS_SECURITY_SSL_HTTP_PEMTRUSTEDCAS_FILEPATH : & str =
95+ const CONFIG_OPTION_PLUGINS_SECURITY_SSL_HTTP_PEMTRUSTEDCAS_FILEPATH : & str =
9096 "plugins.security.ssl.http.pemtrustedcas_filepath" ;
9197
9298/// Whether to enable TLS on internal node-to-node communication using the transport port.
9399/// type: boolean
94- pub const CONFIG_OPTION_PLUGINS_SECURITY_SSL_TRANSPORT_ENABLED : & str =
100+ const CONFIG_OPTION_PLUGINS_SECURITY_SSL_TRANSPORT_ENABLED : & str =
95101 "plugins.security.ssl.transport.enabled" ;
96102
97103/// Path to the cert PEM file used for TLS on the transport PORT.
98104/// type: string
99- pub const CONFIG_OPTION_PLUGINS_SECURITY_SSL_TRANSPORT_PEMCERT_FILEPATH : & str =
105+ const CONFIG_OPTION_PLUGINS_SECURITY_SSL_TRANSPORT_PEMCERT_FILEPATH : & str =
100106 "plugins.security.ssl.transport.pemcert_filepath" ;
101107
102108/// Path to the key PEM file used for TLS on the transport PORT.
103109/// type: string
104- pub const CONFIG_OPTION_PLUGINS_SECURITY_SSL_TRANSPORT_PEMKEY_FILEPATH : & str =
110+ const CONFIG_OPTION_PLUGINS_SECURITY_SSL_TRANSPORT_PEMKEY_FILEPATH : & str =
105111 "plugins.security.ssl.transport.pemkey_filepath" ;
106112
107113/// Path to the trusted CAs PEM file used for TLS on the transport PORT.
108114/// type: string
109- pub const CONFIG_OPTION_PLUGINS_SECURITY_SSL_TRANSPORT_PEMTRUSTEDCAS_FILEPATH : & str =
115+ const CONFIG_OPTION_PLUGINS_SECURITY_SSL_TRANSPORT_PEMTRUSTEDCAS_FILEPATH : & str =
110116 "plugins.security.ssl.transport.pemtrustedcas_filepath" ;
111117
112118/// Specifies an address or addresses that an OpenSearch node publishes to other nodes for
113119/// transport communication.
114120/// Type: (comma-separated) list of strings
115- pub const CONFIG_OPTION_TRANSPORT_PUBLISH_HOST : & str = "transport.publish_host" ;
121+ const CONFIG_OPTION_TRANSPORT_PUBLISH_HOST : & str = "transport.publish_host" ;
116122
117123const DEFAULT_OPENSEARCH_HOME : & str = "/stackable/opensearch" ;
118124
@@ -203,6 +209,13 @@ impl NodeConfig {
203209 CONFIG_OPTION_NODE_ATTR_ROLE_GROUP . to_owned ( ) ,
204210 json ! ( self . role_group_name) ,
205211 ) ;
212+ config. insert (
213+ CONFIG_OPTION_PATH_LOGS . to_owned ( ) ,
214+ json ! ( format!(
215+ "{STACKABLE_LOG_DIR}/{container}" ,
216+ container = v1alpha1:: Container :: OpenSearch . to_container_name( )
217+ ) ) ,
218+ ) ;
206219
207220 config
208221 }
@@ -616,6 +629,7 @@ mod tests {
616629 "discovery.type: \" zen\" \n " ,
617630 "network.host: \" 0.0.0.0\" \n " ,
618631 "node.attr.role-group: \" data\" \n " ,
632+ "path.logs: \" /stackable/log/opensearch\" \n " ,
619633 "plugins.security.nodes_dn: [\" CN=generated certificate for pod\" ]\n " ,
620634 "plugins.security.ssl.http.enabled: true\n " ,
621635 "plugins.security.ssl.http.pemcert_filepath: \" /stackable/opensearch/config/tls/server/tls.crt\" \n " ,
0 commit comments