@@ -30,11 +30,12 @@ use crate::{
3030 constant,
3131 framework:: {
3232 ClusterName , ConfigMapName , ContainerName , ListenerClassName , NameIsValidLabelValue ,
33- ProductName , RoleName , TlsSecretClassName , role_utils:: GenericProductSpecificCommonConfig ,
33+ ProductName , RoleName , SecretClassName , role_utils:: GenericProductSpecificCommonConfig ,
3434 } ,
3535} ;
3636
3737constant ! ( DEFAULT_LISTENER_CLASS : ListenerClassName = "cluster-internal" ) ;
38+ constant ! ( TLS_DEFAULT_SECRET_CLASS : SecretClassName = "tls" ) ;
3839
3940#[ versioned(
4041 version( name = "v1alpha1" ) ,
@@ -80,6 +81,8 @@ pub mod versioned {
8081 #[ derive( Clone , Debug , Default , Deserialize , Eq , JsonSchema , PartialEq , Serialize ) ]
8182 #[ serde( rename_all = "camelCase" ) ]
8283 pub struct OpenSearchClusterConfig {
84+ /// TLS configuration options for the REST API and internal communication (transport).
85+ #[ serde( default ) ]
8386 pub tls : OpenSearchTls ,
8487 /// Name of the Vector aggregator [discovery ConfigMap](DOCS_BASE_URL_PLACEHOLDER/concepts/service_discovery).
8588 /// It must contain the key `ADDRESS` with the address of the Vector aggregator.
@@ -89,14 +92,24 @@ pub mod versioned {
8992 pub vector_aggregator_config_map_name : Option < ConfigMapName > ,
9093 }
9194
92- #[ derive( Clone , Debug , Default , Deserialize , Eq , JsonSchema , PartialEq , Serialize ) ]
95+ #[ derive( Clone , Debug , Deserialize , Eq , JsonSchema , PartialEq , Serialize ) ]
9396 #[ serde( rename_all = "camelCase" ) ]
9497 pub struct OpenSearchTls {
95- /// Affects client connections and internal transport connections .
98+ /// Only affects client connections to the REST API .
9699 /// This setting controls:
97100 /// - If TLS encryption is used at all
98101 /// - Which cert the servers should use to authenticate themselves against the client
99- pub secret_class : Option < TlsSecretClassName > ,
102+ #[ serde(
103+ default = "rest_secret_class_default" ,
104+ skip_serializing_if = "Option::is_none"
105+ ) ]
106+ pub rest_secret_class : Option < SecretClassName > ,
107+ /// Only affects internal communication (transport). Used for mutual verification between OpenSearch nodes.
108+ /// This setting controls:
109+ /// - Which cert the servers should use to authenticate themselves against other servers
110+ /// - Which ca.crt to use when validating the other server
111+ #[ serde( default = "transport_secret_class_default" ) ]
112+ pub transport_secret_class : SecretClassName ,
100113 }
101114
102115 // The possible node roles are by default the built-in roles and the search role, see
@@ -320,6 +333,23 @@ impl v1alpha1::OpenSearchConfig {
320333 }
321334}
322335
336+ impl Default for v1alpha1:: OpenSearchTls {
337+ fn default ( ) -> Self {
338+ v1alpha1:: OpenSearchTls {
339+ rest_secret_class : rest_secret_class_default ( ) ,
340+ transport_secret_class : transport_secret_class_default ( ) ,
341+ }
342+ }
343+ }
344+
345+ fn rest_secret_class_default ( ) -> Option < SecretClassName > {
346+ Some ( TLS_DEFAULT_SECRET_CLASS . to_owned ( ) )
347+ }
348+
349+ fn transport_secret_class_default ( ) -> SecretClassName {
350+ TLS_DEFAULT_SECRET_CLASS . to_owned ( )
351+ }
352+
323353#[ derive( Clone , Debug , Default , Deserialize , JsonSchema , PartialEq , Serialize ) ]
324354pub struct NodeRoles ( pub Vec < v1alpha1:: NodeRole > ) ;
325355
0 commit comments