diff --git a/crates/stackable-operator/CHANGELOG.md b/crates/stackable-operator/CHANGELOG.md index ec0fdd5e..32ec59cf 100644 --- a/crates/stackable-operator/CHANGELOG.md +++ b/crates/stackable-operator/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. ## [Unreleased] +### Added + +- Added `ListenerClass.spec.loadBalancerClass` and `.loadBalancerAllocateNodePorts` fields ([#986]). + ### Changed - BREAKING: Version common CRD structs and enums ([#968]). @@ -13,6 +17,7 @@ All notable changes to this project will be documented in this file. - Import are now more granular in general. [#968]: https://github.com/stackabletech/operator-rs/pull/968 +[#986]: https://github.com/stackabletech/operator-rs/pull/986 ## [0.92.0] - 2025-04-14 diff --git a/crates/stackable-operator/src/crd/listener/class/mod.rs b/crates/stackable-operator/src/crd/listener/class/mod.rs index a520ff08..ecbd5010 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<String>, + /// Annotations that should be added to the Service object. #[serde(default)] pub service_annotations: BTreeMap<String, String>, 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 56cb5778..1913994d 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)