Skip to content

Commit 1b31797

Browse files
committed
Revert to preferring IP addresses for Node listeners by default
1 parent 7adc686 commit 1b31797

File tree

7 files changed

+27
-24
lines changed

7 files changed

+27
-24
lines changed

Cargo.lock

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

Cargo.nix

Lines changed: 9 additions & 9 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 & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,4 @@ tracing = "0.1.40"
3434
[patch."https://github.com/stackabletech/operator-rs.git"]
3535
# stackable-operator = { path = "../operator-rs/crates/stackable-operator" }
3636
# stackable-operator = { git = "https://github.com/stackabletech//operator-rs.git", branch = "main" }
37+
stackable-operator = { git = "https://github.com/stackabletech//operator-rs.git", branch = "feature/smart-preferred-address-type" }

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/crds/crds.yaml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,17 @@ spec:
2525
description: Defines a policy for how [Listeners](https://docs.stackable.tech/home/nightly/listener-operator/listener) should be exposed. Read the [ListenerClass documentation](https://docs.stackable.tech/home/nightly/listener-operator/listenerclass) for more information.
2626
properties:
2727
preferredAddressType:
28-
default: Hostname
28+
default: HostnameConservative
2929
description: |-
30-
Whether addresses should prefer using the IP address (`IP`) or the hostname (`Hostname`).
30+
Whether addresses should prefer using the IP address (`IP`) or the hostname (`Hostname`). Can also be set to `HostnameConservative`, which will use `IP` for `NodePort` service types, but `Hostname` for everything else.
3131
32-
The other type will be used if the preferred type is not available. By default `Hostname` is used.
32+
The other type will be used if the preferred type is not available.
33+
34+
Defaults to `HostnameConservative`.
3335
enum:
3436
- Hostname
3537
- IP
38+
- HostnameConservative
3639
type: string
3740
serviceAnnotations:
3841
additionalProperties:

rust/operator-binary/src/csi_server/node.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ async fn local_listener_addresses_for_pod(
464464
})?;
465465

466466
Ok(node_primary_addresses(&node)
467-
.pick(listener_class.spec.preferred_address_type)
467+
.pick(listener_class.spec.resolve_preferred_address_type())
468468
.map(|(address, address_type)| ListenerIngress {
469469
// nodes: Some(vec![node_name.to_string()]),
470470
address: address.to_string(),

rust/operator-binary/src/listener_controller.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,7 @@ pub async fn reconcile(
364364
.add(&ctx.client, svc)
365365
.await
366366
.context(ApplyServiceSnafu { svc: svc_ref })?;
367+
let preferred_address_type = listener_class.spec.resolve_preferred_address_type();
367368

368369
let nodes: Vec<Node>;
369370
let kubernetes_service_fqdn: String;
@@ -384,9 +385,7 @@ pub async fn reconcile(
384385
.await?;
385386
addresses = nodes
386387
.iter()
387-
.flat_map(|node| {
388-
node_primary_addresses(node).pick(listener_class.spec.preferred_address_type)
389-
})
388+
.flat_map(|node| node_primary_addresses(node).pick(preferred_address_type))
390389
.collect::<Vec<_>>();
391390
ports = svc
392391
.spec
@@ -408,7 +407,7 @@ pub async fn reconcile(
408407
ip: ingress.ip.as_deref(),
409408
hostname: ingress.hostname.as_deref(),
410409
}
411-
.pick(listener_class.spec.preferred_address_type)
410+
.pick(preferred_address_type)
412411
})
413412
.collect();
414413
ports = svc
@@ -422,7 +421,7 @@ pub async fn reconcile(
422421
}
423422
ServiceType::ClusterIP => {
424423
let cluster_domain = &cluster_info.cluster_domain;
425-
addresses = match listener_class.spec.preferred_address_type {
424+
addresses = match preferred_address_type {
426425
AddressType::Ip => svc
427426
.spec
428427
.iter()

0 commit comments

Comments
 (0)