Skip to content

Commit a8af627

Browse files
committed
fix: use checked namespace im opa config
1 parent b6ec3b2 commit a8af627

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

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

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

33
use stackable_operator::{
4-
client::Client, commons::opa::OpaApiVersion, k8s_openapi::api::core::v1::ConfigMap,
5-
kube::ResourceExt, v2::types::kubernetes::SecretClassName,
4+
client::Client,
5+
commons::opa::OpaApiVersion,
6+
k8s_openapi::api::core::v1::ConfigMap,
7+
v2::types::kubernetes::{NamespaceName, SecretClassName},
68
};
79

810
use crate::crd::v1alpha1;
@@ -41,6 +43,7 @@ impl TrinoOpaConfig {
4143
pub async fn from_opa_config(
4244
client: &Client,
4345
trino: &v1alpha1::TrinoCluster,
46+
namespace: &NamespaceName,
4447
opa_config: &v1alpha1::TrinoAuthorizationOpaConfig,
4548
) -> Result<Self, stackable_operator::commons::opa::Error> {
4649
let non_batched_connection_string = opa_config
@@ -86,10 +89,7 @@ impl TrinoOpaConfig {
8689
};
8790

8891
let tls_secret_class = client
89-
.get::<ConfigMap>(
90-
&opa_config.opa.config_map_name,
91-
trino.namespace().as_deref().unwrap_or("default"),
92-
)
92+
.get::<ConfigMap>(&opa_config.opa.config_map_name, namespace.as_ref())
9393
.await
9494
.ok()
9595
.and_then(|cm| cm.data)

rust/operator-binary/src/controller/dereference.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ pub async fn dereference(
121121

122122
let trino_opa_config = match trino.get_opa_config() {
123123
Some(opa_config) => Some(
124-
TrinoOpaConfig::from_opa_config(client, trino, opa_config)
124+
TrinoOpaConfig::from_opa_config(client, trino, &namespace, opa_config)
125125
.await
126126
.context(InvalidOpaConfigSnafu)?,
127127
),

0 commit comments

Comments
 (0)