Skip to content
This repository was archived by the owner on Jun 6, 2025. It is now read-only.

Commit 85e0e05

Browse files
committed
adapt to op-rs 0.79.0
1 parent 4c7475f commit 85e0e05

File tree

6 files changed

+41
-8
lines changed

6 files changed

+41
-8
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
44

55
## [Unreleased]
66

7+
### Added
8+
9+
- The operator can now run on Kubernetes clusters using a non-default cluster domain. It should automatically detect the
10+
correct domain to use, but you can also use the env var `KUBERNETES_CLUSTER_DOMAIN` to set the domain explicitly
11+
or use the helm-chart property `kubernetesClusterDomain` ([#xxx]).
12+
713
### Changed
814

915
- Reduce CRD size from `475KB` to `49KB` by accepting arbitrary YAML input instead of the underlying schema for the following fields ([#112]):
@@ -16,6 +22,7 @@ All notable changes to this project will be documented in this file.
1622

1723
[#112]: https://github.com/stackabletech/hello-world-operator/pull/112
1824
[#121]: https://github.com/stackabletech/hello-world-operator/pull/121
25+
[#xxx]: https://github.com/stackabletech/hello-world-operator/pull/xxx
1926

2027
## [24.7.0] - 2024-07-24
2128

Cargo.lock

Lines changed: 16 additions & 3 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
@@ -23,7 +23,7 @@ serde = { version = "1.0", features = ["derive"] }
2323
serde_json = "1.0"
2424
serde_yaml = "0.9"
2525
snafu = "0.8"
26-
stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "stackable-operator-0.78.0" }
26+
stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "stackable-operator-0.79.0" }
2727
strum = { version = "0.26", features = ["derive"] }
2828
tokio = { version = "1.40", features = ["full"] }
2929
tracing = "0.1"

deploy/helm/hello-world-operator/values.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,8 @@ nodeSelector: {}
4747
tolerations: []
4848

4949
affinity: {}
50+
51+
# When running on a non-default Kubernetes cluster domain and the auto detection is not working correctly,
52+
# you can set your custom cluster domain here.
53+
# See the https://docs.stackable.tech/home/stable/guides/kubernetes-cluster-domain guide for details
54+
# kubernetesClusterDomain: my-cluster.local

rust/operator-binary/src/crd.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ use stackable_operator::{
1515
PvcConfig, PvcConfigFragment, Resources, ResourcesFragment,
1616
},
1717
},
18-
config::{fragment, fragment::Fragment, fragment::ValidationError, merge::Merge},
18+
config::{
19+
fragment::{self, Fragment, ValidationError},
20+
merge::Merge,
21+
},
1922
k8s_openapi::apimachinery::pkg::api::resource::Quantity,
2023
kube::{runtime::reflector::ObjectRef, CustomResource, ResourceExt},
2124
product_config_utils::{self, Configuration},
@@ -24,6 +27,7 @@ use stackable_operator::{
2427
schemars::{self, JsonSchema},
2528
status::condition::{ClusterCondition, HasStatusCondition},
2629
time::Duration,
30+
utils::cluster_domain::KUBERNETES_CLUSTER_DOMAIN,
2731
};
2832
use std::{collections::BTreeMap, str::FromStr};
2933
use strum::{Display, EnumIter, EnumString, IntoEnumIterator};
@@ -476,9 +480,12 @@ pub struct PodRef {
476480

477481
impl PodRef {
478482
pub fn fqdn(&self) -> String {
483+
let cluster_domain = KUBERNETES_CLUSTER_DOMAIN
484+
.get()
485+
.expect("KUBERNETES_CLUSTER_DOMAIN must first be set by calling initialize_operator");
479486
format!(
480-
"{}.{}.{}.svc.cluster.local",
481-
self.pod_name, self.role_group_service_name, self.namespace
487+
"{}.{}.{}.svc.{}",
488+
self.pod_name, self.role_group_service_name, self.namespace, cluster_domain
482489
)
483490
}
484491
}

rust/operator-binary/src/main.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ async fn main() -> anyhow::Result<()> {
6464
])?;
6565

6666
let client =
67-
stackable_operator::client::create_client(Some(OPERATOR_NAME.to_string())).await?;
67+
stackable_operator::client::initialize_operator(Some(OPERATOR_NAME.to_string()))
68+
.await?;
6869

6970
Controller::new(
7071
watch_namespace.get_api::<HelloCluster>(&client),

0 commit comments

Comments
 (0)