@@ -123,6 +123,7 @@ pub const MAX_PREPARE_LOG_FILE_SIZE: MemoryQuantity = MemoryQuantity {
123123} ;
124124
125125const DOCKER_IMAGE_BASE_NAME : & str = "trino" ;
126+ const OPA_TLS_VOLUME_NAME : & str = "opa-tls" ;
126127
127128#[ derive( Snafu , Debug , EnumDiscriminants ) ]
128129#[ strum_discriminants( derive( IntoStaticStr ) ) ]
@@ -630,6 +631,7 @@ pub async fn reconcile_trino(
630631 & rbac_sa. name_any ( ) ,
631632 & resolved_fte_config,
632633 & resolved_client_protocol_config,
634+ & trino_opa_config,
633635 ) ?;
634636
635637 cluster_resources
@@ -1037,6 +1039,7 @@ fn build_rolegroup_statefulset(
10371039 sa_name : & str ,
10381040 resolved_fte_config : & Option < fault_tolerant_execution:: ResolvedFaultTolerantExecutionConfig > ,
10391041 resolved_spooling_config : & Option < client_protocol:: ResolvedClientProtocolConfig > ,
1042+ trino_opa_config : & Option < TrinoOpaConfig > ,
10401043) -> Result < StatefulSet > {
10411044 let role = trino
10421045 . role ( trino_role)
@@ -1140,6 +1143,7 @@ fn build_rolegroup_statefulset(
11401143 & requested_secret_lifetime,
11411144 resolved_fte_config,
11421145 resolved_spooling_config,
1146+ trino_opa_config,
11431147 ) ?;
11441148
11451149 let mut prepare_args = vec ! [ ] ;
@@ -1165,6 +1169,18 @@ fn build_rolegroup_statefulset(
11651169 prepare_args
11661170 . extend ( trino_authentication_config. commands ( & TrinoRole :: Coordinator , & Container :: Prepare ) ) ;
11671171
1172+ // Add OPA TLS certificate to truststore if configured
1173+ if trino_opa_config
1174+ . as_ref ( )
1175+ . and_then ( |c| c. tls_secret_class . as_ref ( ) )
1176+ . is_some ( )
1177+ {
1178+ prepare_args. extend ( command:: add_cert_to_truststore (
1179+ & format ! ( "/stackable/secrets/{OPA_TLS_VOLUME_NAME}/ca.crt" ) ,
1180+ STACKABLE_CLIENT_TLS_DIR ,
1181+ ) ) ;
1182+ }
1183+
11681184 let container_prepare = cb_prepare
11691185 . image_from_product_image ( resolved_product_image)
11701186 . command ( vec ! [
@@ -1710,6 +1726,7 @@ fn tls_volume_mounts(
17101726 requested_secret_lifetime : & Duration ,
17111727 resolved_fte_config : & Option < fault_tolerant_execution:: ResolvedFaultTolerantExecutionConfig > ,
17121728 resolved_spooling_config : & Option < client_protocol:: ResolvedClientProtocolConfig > ,
1729+ trino_opa_config : & Option < TrinoOpaConfig > ,
17131730) -> Result < ( ) > {
17141731 if let Some ( server_tls) = trino. get_server_tls ( ) {
17151732 cb_prepare
@@ -1789,6 +1806,28 @@ fn tls_volume_mounts(
17891806 . context ( AddVolumeSnafu ) ?;
17901807 }
17911808
1809+ if let Some ( opa_config) = trino_opa_config {
1810+ if let Some ( opa_tls_secret_class) = & opa_config. tls_secret_class {
1811+ let opa_tls_mount_path = format ! ( "/stackable/secrets/{OPA_TLS_VOLUME_NAME}" ) ;
1812+
1813+ cb_prepare
1814+ . add_volume_mount ( OPA_TLS_VOLUME_NAME , & opa_tls_mount_path)
1815+ . context ( AddVolumeMountSnafu ) ?;
1816+
1817+ let opa_tls_volume = VolumeBuilder :: new ( OPA_TLS_VOLUME_NAME )
1818+ . ephemeral (
1819+ SecretOperatorVolumeSourceBuilder :: new ( opa_tls_secret_class)
1820+ . build ( )
1821+ . context ( TlsCertSecretClassVolumeBuildSnafu ) ?,
1822+ )
1823+ . build ( ) ;
1824+
1825+ pod_builder
1826+ . add_volume ( opa_tls_volume)
1827+ . context ( AddVolumeSnafu ) ?;
1828+ }
1829+ }
1830+
17921831 // fault tolerant execution S3 credentials and other resources
17931832 if let Some ( resolved_fte) = resolved_fte_config {
17941833 cb_prepare
@@ -2028,6 +2067,7 @@ mod tests {
20282067 . to_string ( ) ,
20292068 ) ,
20302069 allow_permission_management_operations : true ,
2070+ tls_secret_class : None ,
20312071 } ) ;
20322072 let resolved_fte_config = match & trino. spec . cluster_config . fault_tolerant_execution {
20332073 Some ( fault_tolerant_execution) => Some (
0 commit comments