Skip to content

Commit d7b1f95

Browse files
committed
bump to op-rs 0.80.0
1 parent d769c21 commit d7b1f95

File tree

6 files changed

+106
-66
lines changed

6 files changed

+106
-66
lines changed

Cargo.lock

Lines changed: 77 additions & 41 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ serde = { version = "1.0", features = ["derive"] }
2525
serde_json = "1.0"
2626
serde_yaml = "0.9"
2727
snafu = "0.8"
28-
stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "stackable-operator-0.79.0" }
28+
stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "stackable-operator-0.80.0" }
2929
strum = { version = "0.26", features = ["derive"] }
3030
tokio = { version = "1.40", features = ["full"] }
3131
tracing = "0.1"

rust/crd/src/lib.rs

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ use stackable_operator::{
4949
status::condition::{ClusterCondition, HasStatusCondition},
5050
time::Duration,
5151
utils::{
52-
cluster_domain::KUBERNETES_CLUSTER_DOMAIN, crds::raw_object_list_schema,
52+
cluster_info::KubernetesClusterInfo, crds::raw_object_list_schema,
5353
COMMON_BASH_TRAP_FUNCTIONS,
5454
},
5555
};
@@ -720,14 +720,16 @@ impl DruidCluster {
720720
}
721721

722722
/// The fully-qualified domain name of the role-level load-balanced Kubernetes `Service`
723-
pub fn role_service_fqdn(&self, role: &DruidRole) -> Option<String> {
724-
let cluster_domain = KUBERNETES_CLUSTER_DOMAIN
725-
.get()
726-
.expect("KUBERNETES_CLUSTER_DOMAIN must first be set by calling initialize_operator");
723+
pub fn role_service_fqdn(
724+
&self,
725+
role: &DruidRole,
726+
cluster_info: &KubernetesClusterInfo,
727+
) -> Option<String> {
727728
Some(format!(
728-
"{}.{}.svc.{cluster_domain}",
729-
self.role_service_name(role)?,
730-
self.metadata.namespace.as_ref()?,
729+
"{service_name}.{namespace}.svc.{cluster_domain}",
730+
service_name = self.role_service_name(role)?,
731+
namespace = self.metadata.namespace.as_ref()?,
732+
cluster_domain = cluster_info.cluster_domain,
731733
))
732734
}
733735

@@ -1487,23 +1489,17 @@ pub fn build_recommended_labels<'a, T>(
14871489

14881490
#[cfg(test)]
14891491
mod tests {
1492+
use stackable_operator::commons::networking::DomainName;
1493+
14901494
use super::*;
14911495

14921496
#[test]
14931497
fn test_service_name_generation() {
14941498
let cluster =
14951499
deserialize_yaml_file::<DruidCluster>("test/resources/role_service/druid_cluster.yaml");
1496-
1497-
// As we are not calling stackable_operator::client::initialize_operator, we need to set the
1498-
// Kubernetes cluster domain ourselves.
1499-
KUBERNETES_CLUSTER_DOMAIN
1500-
.set(
1501-
"cluster.local"
1502-
.to_owned()
1503-
.try_into()
1504-
.expect("must always be a valid domain"),
1505-
)
1506-
.expect("failed to set Kubernetes cluster domain");
1500+
let dummy_cluster_info = KubernetesClusterInfo {
1501+
cluster_domain: DomainName::try_from("cluster.local").unwrap(),
1502+
};
15071503

15081504
assert_eq!(cluster.metadata.name, Some("testcluster".to_string()));
15091505

@@ -1513,7 +1509,7 @@ mod tests {
15131509
);
15141510

15151511
assert_eq!(
1516-
cluster.role_service_fqdn(&DruidRole::Router),
1512+
cluster.role_service_fqdn(&DruidRole::Router, &dummy_cluster_info),
15171513
Some("testcluster-router.default.svc.cluster.local".to_string())
15181514
)
15191515
}

0 commit comments

Comments
 (0)