Skip to content

Commit 093c3fa

Browse files
committed
refactor: use v2 SecretClass in CRD
1 parent 2af6a04 commit 093c3fa

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

rust/operator-binary/src/authorization/opa.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
use std::collections::BTreeMap;
1+
use std::{collections::BTreeMap, str::FromStr};
22

33
use stackable_operator::{
44
client::Client, commons::opa::OpaApiVersion, k8s_openapi::api::core::v1::ConfigMap,
5-
kube::ResourceExt,
5+
kube::ResourceExt, v2::types::kubernetes::SecretClassName,
66
};
77

88
use crate::crd::v1alpha1;
@@ -34,7 +34,7 @@ pub struct TrinoOpaConfig {
3434
/// Optional TLS secret class for OPA communication.
3535
/// If set, the CA certificate from this secret class will be added
3636
/// to Trino's truststore to make it trust OPA's TLS certificate.
37-
pub(crate) tls_secret_class: Option<String>,
37+
pub(crate) tls_secret_class: Option<SecretClassName>,
3838
}
3939

4040
impl TrinoOpaConfig {
@@ -93,7 +93,8 @@ impl TrinoOpaConfig {
9393
.await
9494
.ok()
9595
.and_then(|cm| cm.data)
96-
.and_then(|mut data| data.remove("OPA_SECRET_CLASS"));
96+
.and_then(|mut data| data.remove("OPA_SECRET_CLASS"))
97+
.and_then(|secret_class| SecretClassName::from_str(&secret_class).ok());
9798

9899
Ok(TrinoOpaConfig {
99100
non_batched_connection_string,

rust/operator-binary/src/controller/build/resource/statefulset.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -743,7 +743,7 @@ fn tls_volume_mounts(
743743
let opa_tls_volume = VolumeBuilder::new(OPA_TLS_VOLUME_NAME)
744744
.ephemeral(
745745
SecretOperatorVolumeSourceBuilder::new(
746-
tls_secret_class,
746+
tls_secret_class.as_ref(),
747747
SecretClassVolumeProvisionParts::PublicPrivate,
748748
)
749749
.build()

0 commit comments

Comments
 (0)