diff --git a/crates/stackable-operator/CHANGELOG.md b/crates/stackable-operator/CHANGELOG.md index 2de9d7aab..6210fca8a 100644 --- a/crates/stackable-operator/CHANGELOG.md +++ b/crates/stackable-operator/CHANGELOG.md @@ -4,10 +4,15 @@ All notable changes to this project will be documented in this file. ## [Unreleased] +### Added + +- Added `ListenerClass.spec.loadBalancerClass` and `.loadBalancerAllocateNodePorts` fields ([#986]). + ### Removed - Remove instrumenation from uninteresting funtions ([#1023]). +[#986]: https://github.com/stackabletech/operator-rs/pull/986 [#1023]: https://github.com/stackabletech/operator-rs/pull/1023 ## [0.93.1] - 2025-05-20 diff --git a/crates/stackable-operator/src/crd/listener/class/mod.rs b/crates/stackable-operator/src/crd/listener/class/mod.rs index a520ff087..ecbd50109 100644 --- a/crates/stackable-operator/src/crd/listener/class/mod.rs +++ b/crates/stackable-operator/src/crd/listener/class/mod.rs @@ -31,6 +31,21 @@ pub mod versioned { pub struct ListenerClassSpec { pub service_type: core_v1alpha1::ServiceType, + /// Configures whether a LoadBalancer service should also allocate node ports (like NodePort). + /// + /// Ignored unless serviceType is LoadBalancer. + // TODO: v1alpha2: Move into ServiceType::LoadBalancer + #[serde(default = "ListenerClassSpec::default_load_balancer_allocate_node_ports")] + pub load_balancer_allocate_node_ports: bool, + + /// Configures a custom Service loadBalancerClass, which can be used to access secondary + /// load balancer controllers that are installed in the cluster, or to provision + /// custom addresses manually. + /// + /// Ignored unless serviceType is LoadBalancer. + // TODO: v1alpha2: Move into ServiceType::LoadBalancer + pub load_balancer_class: Option, + /// Annotations that should be added to the Service object. #[serde(default)] pub service_annotations: BTreeMap, diff --git a/crates/stackable-operator/src/crd/listener/class/v1alpha1_impl.rs b/crates/stackable-operator/src/crd/listener/class/v1alpha1_impl.rs index 56cb57780..1913994d2 100644 --- a/crates/stackable-operator/src/crd/listener/class/v1alpha1_impl.rs +++ b/crates/stackable-operator/src/crd/listener/class/v1alpha1_impl.rs @@ -12,6 +12,10 @@ impl ListenerClassSpec { PreferredAddressType::HostnameConservative } + pub(super) const fn default_load_balancer_allocate_node_ports() -> bool { + true + } + /// Resolves [`Self::preferred_address_type`]'s "smart" modes depending on the rest of `self`. pub fn resolve_preferred_address_type(&self) -> AddressType { self.preferred_address_type.resolve(self)