Skip to content

Commit 341f3f6

Browse files
committed
chore!: Default ListenerClass externalTrafficPolicy to null
1 parent be42204 commit 341f3f6

4 files changed

Lines changed: 45 additions & 20 deletions

File tree

crates/stackable-operator/crds/ListenerClass.yaml

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

crates/stackable-operator/src/crd/listener/class/mod.rs

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,21 @@ pub mod versioned {
5050
#[serde(default)]
5151
pub service_annotations: BTreeMap<String, String>,
5252

53-
/// `externalTrafficPolicy` that should be set on the created [`Service`] objects.
53+
/// `externalTrafficPolicy` that should be set on the created Service objects.
5454
///
55-
/// The default is `Local` (in contrast to `Cluster`), as we aim to direct traffic to a node running the workload
56-
/// and we should keep testing that as the primary configuration. Cluster is a fallback option for providers that
57-
/// break Local mode (IONOS so far).
58-
#[serde(default = "ListenerClassSpec::default_service_external_traffic_policy")]
59-
pub service_external_traffic_policy: core_v1alpha1::KubernetesTrafficPolicy,
55+
/// It is a Kubernetes feature that controls how external traffic is routed to a Kubernetes
56+
/// Service.
57+
///
58+
/// * `Cluster`: Kubernetes defaults to `Cluster`, which means that traffic is routed to any
59+
/// node in the Kubernetes cluster that has a pod running the service.
60+
/// * `Local`: Means that traffic is only routed to pods running on the same node as the
61+
/// Service.
62+
///
63+
/// `Local` has a better performance as it avoids a network hop, but requires a "clever"
64+
/// LoadBalancer, that respects what Pods run on which nodes and routes traffic only to that
65+
/// nodes accordingly. Some cloud providers (such as IONOS) or bare metal installations
66+
/// don't have such features, so the default is `Cluster` to work everywhere.
67+
pub service_external_traffic_policy: Option<core_v1alpha1::KubernetesTrafficPolicy>,
6068

6169
/// Whether addresses should prefer using the IP address (`IP`) or the hostname (`Hostname`).
6270
/// Can also be set to `HostnameConservative`, which will use `IP` for `NodePort` service types, but `Hostname` for everything else.

crates/stackable-operator/src/crd/listener/class/v1alpha1_impl.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
use crate::crd::listener::{
22
class::v1alpha1::ListenerClassSpec,
3-
core::v1alpha1::{AddressType, KubernetesTrafficPolicy, PreferredAddressType},
3+
core::v1alpha1::{AddressType, PreferredAddressType},
44
};
55

66
impl ListenerClassSpec {
7-
pub(super) const fn default_service_external_traffic_policy() -> KubernetesTrafficPolicy {
8-
KubernetesTrafficPolicy::Local
9-
}
10-
117
pub(super) const fn default_preferred_address_type() -> PreferredAddressType {
128
PreferredAddressType::HostnameConservative
139
}

crates/stackable-operator/src/crd/listener/core/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ pub mod versioned {
4545

4646
/// Preserves the client source IP and avoid a second hop for LoadBalancer and NodePort type
4747
/// Services, but makes clients responsible for spreading the load.
48+
///
49+
/// Does not work everywhere, e.g. not on IONOS!
4850
Local,
4951
}
5052

0 commit comments

Comments
 (0)