Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ All notable changes to this project will be documented in this file.

### Added

- `Listener.status.addresses` can now be configured to prefer either IP addresses or DNS hostnames ([#233]).
- `Listener.status.addresses` can now be configured to prefer either IP addresses or DNS hostnames ([#233], [#244]).
- The operator can now run on Kubernetes clusters using a non-default cluster domain.
Use the env var `KUBERNETES_CLUSTER_DOMAIN` or the operator Helm chart property `kubernetesClusterDomain` to set a non-default cluster domain ([#237]).

### Changed

- `Listener.status.addresses` for NodePort listeners now includes replicas that are currently unavailable ([#231]).
- `Listener.status.addresses` now defaults to DNS hostnames for all service types (previously NodePort and ClusterIP would prefer IP addresses, [#233]).
- BREAKING: `Listener.status.addresses` now defaults to DNS hostnames for ClusterIP services, rather than IP addresses ([#233], [#244]).
- Stale Listener subobjects will now be deleted ([#232]).
- Tagged Listener Services with the SDP labels ([#232]).

Expand All @@ -30,6 +30,7 @@ All notable changes to this project will be documented in this file.
[#234]: https://github.com/stackabletech/listener-operator/pull/234
[#237]: https://github.com/stackabletech/listener-operator/pull/237
[#238]: https://github.com/stackabletech/listener-operator/pull/238
[#244]: https://github.com/stackabletech/listener-operator/pull/244

## [24.7.0] - 2024-07-24

Expand Down
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions Cargo.nix

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@ tracing = "0.1.40"
[patch."https://github.com/stackabletech/operator-rs.git"]
# stackable-operator = { path = "../operator-rs/crates/stackable-operator" }
# stackable-operator = { git = "https://github.com/stackabletech//operator-rs.git", branch = "main" }
stackable-operator = { git = "https://github.com/stackabletech//operator-rs.git", branch = "feature/smart-preferred-address-type" }
6 changes: 3 additions & 3 deletions crate-hashes.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions deploy/helm/listener-operator/crds/crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,17 @@ spec:
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.
properties:
preferredAddressType:
default: Hostname
default: HostnameConservative
description: |-
Whether addresses should prefer using the IP address (`IP`) or the hostname (`Hostname`).
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.

The other type will be used if the preferred type is not available. By default `Hostname` is used.
The other type will be used if the preferred type is not available.

Defaults to `HostnameConservative`.
enum:
- Hostname
- IP
- HostnameConservative
type: string
serviceAnnotations:
additionalProperties:
Expand Down
7 changes: 6 additions & 1 deletion docs/modules/listener-operator/pages/listenerclass.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Additionally, many cloud providers charge for load-balanced traffic.
[#addresstype]
== Address types

The Stackable Listener Operator supports both IP addresses and DNS hostnames. The preferred address type for a given ListenerClass can be configured using the `ListenerClass.spec.preferredAddressType` field. If no `preferredAddressType` is specified then it defaults to xref:#addresstype-hostname[].
The Stackable Listener Operator supports both IP addresses and DNS hostnames. The preferred address type for a given ListenerClass can be configured using the `ListenerClass.spec.preferredAddressType` field. If no `preferredAddressType` is specified then it defaults to xref:#addresstype-hostname-conservative[].

NOTE: If the preferred address type is not supported for a given environment then another type will be used.

Expand All @@ -81,6 +81,11 @@ but does not require any special client configuration (beyond what the xref:#ser

The DNS hostname of a resource. Clients must be able to resolve these addresses in order to connect, which may require special DNS configuration.

[#addresstype-hostname-conservative]
=== HostnameConservative

A pseudo-addresstype that is equivalent to xref:#addresstype-ip[] for xref:#servicetype-nodeport[] services, and xref:#addresstype-hostname[] for all others. This means that we default to hostnames where "safe", but don't assume that nodes are resolvable by external clients.

== Default ListenerClasses

The Stackable Data Platform assumes the existence of a few predefined ListenerClasses, and will use them by default as appropriate:
Expand Down
2 changes: 1 addition & 1 deletion rust/operator-binary/src/csi_server/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ async fn local_listener_addresses_for_pod(
})?;

Ok(node_primary_addresses(&node)
.pick(listener_class.spec.preferred_address_type)
.pick(listener_class.spec.resolve_preferred_address_type())
.map(|(address, address_type)| ListenerIngress {
// nodes: Some(vec![node_name.to_string()]),
address: address.to_string(),
Expand Down
9 changes: 4 additions & 5 deletions rust/operator-binary/src/listener_controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ pub async fn reconcile(
.add(&ctx.client, svc)
.await
.context(ApplyServiceSnafu { svc: svc_ref })?;
let preferred_address_type = listener_class.spec.resolve_preferred_address_type();

let nodes: Vec<Node>;
let kubernetes_service_fqdn: String;
Expand All @@ -384,9 +385,7 @@ pub async fn reconcile(
.await?;
addresses = nodes
.iter()
.flat_map(|node| {
node_primary_addresses(node).pick(listener_class.spec.preferred_address_type)
})
.flat_map(|node| node_primary_addresses(node).pick(preferred_address_type))
.collect::<Vec<_>>();
ports = svc
.spec
Expand All @@ -408,7 +407,7 @@ pub async fn reconcile(
ip: ingress.ip.as_deref(),
hostname: ingress.hostname.as_deref(),
}
.pick(listener_class.spec.preferred_address_type)
.pick(preferred_address_type)
})
.collect();
ports = svc
Expand All @@ -422,7 +421,7 @@ pub async fn reconcile(
}
ServiceType::ClusterIP => {
let cluster_domain = &cluster_info.cluster_domain;
addresses = match listener_class.spec.preferred_address_type {
addresses = match preferred_address_type {
AddressType::Ip => svc
.spec
.iter()
Expand Down
Loading