Skip to content

Commit 112ba1a

Browse files
committed
adapt to op-rs 0.79.0
1 parent bdb4e8b commit 112ba1a

File tree

10 files changed

+43
-21
lines changed

10 files changed

+43
-21
lines changed

CHANGELOG.md

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

99
- `Listener.status.addresses` can now be configured to prefer either IP addresses or DNS hostnames ([#233]).
10+
- The operator can now run on Kubernetes clusters using a non-default cluster domain. It should automatically detect the
11+
correct domain to use, but you can also use the env var `KUBERNETES_CLUSTER_DOMAIN` to set the domain explicitly
12+
or use the helm-chart property `kubernetesClusterDomain` ([#xxx]).
1013

1114
### Changed
1215

@@ -22,6 +25,7 @@ All notable changes to this project will be documented in this file.
2225
[#231]: https://github.com/stackabletech/listener-operator/pull/231
2326
[#233]: https://github.com/stackabletech/listener-operator/pull/233
2427
[#234]: https://github.com/stackabletech/listener-operator/pull/234
28+
[#xxx]: https://github.com/stackabletech/listener-operator/pull/xxx
2529

2630
## [24.7.0] - 2024-07-24
2731

Cargo.lock

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

Cargo.nix

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

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ prost = "0.13"
2121
prost-types = "0.13"
2222
serde = "1.0"
2323
snafu = "0.8"
24-
stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "stackable-operator-0.78.0" }
24+
stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "stackable-operator-0.79.0" }
2525
strum = { version = "0.26", features = ["derive"] }
2626
socket2 = { version = "0.5", features = ["all"] }
2727
tokio = { version = "1.40", features = ["full"] }
@@ -33,4 +33,4 @@ tracing = "0.1.40"
3333

3434
[patch."https://github.com/stackabletech/operator-rs.git"]
3535
# stackable-operator = { path = "../operator-rs/crates/stackable-operator" }
36-
stackable-operator = { git = "https://github.com/stackabletech//operator-rs.git", branch = "main" }
36+
# stackable-operator = { git = "https://github.com/stackabletech//operator-rs.git", branch = "main" }

crate-hashes.json

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

deploy/helm/listener-operator/templates/controller-deployment.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ spec:
4242
env:
4343
- name: CSI_ENDPOINT
4444
value: /csi/csi.sock
45+
{{- if .Values.kubernetesClusterDomain }}
46+
- name: KUBERNETES_CLUSTER_DOMAIN
47+
value: {{ .Values.kubernetesClusterDomain | quote }}
48+
{{- end }}
4549
volumeMounts:
4650
- name: csi
4751
mountPath: /csi

deploy/helm/listener-operator/templates/node-daemonset.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ spec:
4646
fieldRef:
4747
apiVersion: v1
4848
fieldPath: spec.nodeName
49+
{{- if .Values.kubernetesClusterDomain }}
50+
- name: KUBERNETES_CLUSTER_DOMAIN
51+
value: {{ .Values.kubernetesClusterDomain | quote }}
52+
{{- end }}
4953
volumeMounts:
5054
- name: csi
5155
mountPath: /csi

deploy/helm/listener-operator/values.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@ tolerations: []
9292

9393
affinity: {}
9494

95+
# When running on a non-default Kubernetes cluster domain and the auto detection is not working correctly,
96+
# you can set your custom cluster domain here.
97+
# See the https://docs.stackable.tech/home/stable/guides/kubernetes-cluster-domain guide for details
98+
# kubernetesClusterDomain: my-cluster.local
99+
95100
# Kubelet dir may vary in environments such as microk8s, see https://github.com/stackabletech/secret-operator/issues/229
96101
kubeletDir: /var/lib/kubelet
97102

rust/operator-binary/src/listener_controller.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ use stackable_operator::{
2525
},
2626
logging::controller::{report_controller_reconciled, ReconcilerError},
2727
time::Duration,
28+
utils::cluster_domain::KUBERNETES_CLUSTER_DOMAIN,
2829
};
2930
use strum::IntoStaticStr;
3031

@@ -328,6 +329,9 @@ pub async fn reconcile(listener: Arc<Listener>, ctx: Arc<Ctx>) -> Result<control
328329
.collect();
329330
}
330331
ServiceType::ClusterIP => {
332+
let cluster_domain = KUBERNETES_CLUSTER_DOMAIN.get().expect(
333+
"KUBERNETES_CLUSTER_DOMAIN must first be set by calling initialize_operator",
334+
);
331335
addresses = match listener_class.spec.preferred_address_type {
332336
AddressType::Ip => svc
333337
.spec
@@ -337,7 +341,7 @@ pub async fn reconcile(listener: Arc<Listener>, ctx: Arc<Ctx>) -> Result<control
337341
.map(|addr| (&**addr, AddressType::Ip))
338342
.collect::<Vec<_>>(),
339343
AddressType::Hostname => {
340-
kubernetes_service_fqdn = format!("{svc_name}.{ns}.svc.cluster.local");
344+
kubernetes_service_fqdn = format!("{svc_name}.{ns}.svc.{cluster_domain}");
341345
vec![(&kubernetes_service_fqdn, AddressType::Hostname)]
342346
}
343347
};

rust/operator-binary/src/main.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ async fn main() -> anyhow::Result<()> {
8484
built_info::RUSTC_VERSION,
8585
);
8686
let client =
87-
stackable_operator::client::create_client(Some(OPERATOR_KEY.to_string())).await?;
87+
stackable_operator::client::initialize_operator(Some(OPERATOR_KEY.to_string()))
88+
.await?;
8889
if csi_endpoint
8990
.symlink_metadata()
9091
.map_or(false, |meta| meta.file_type().is_socket())

0 commit comments

Comments
 (0)