Skip to content

Add loadBalancerClass field to ListenerClass.spec #986

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from all 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: 5 additions & 0 deletions crates/stackable-operator/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

15 changes: 15 additions & 0 deletions crates/stackable-operator/src/crd/listener/class/mod.rs
Original file line number Diff line number Diff line change
@@ -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>,
Original file line number Diff line number Diff line change
@@ -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)