Skip to content

Commit e088d9c

Browse files
committed
Use Volume as the primary mechanism for directing Listener traffic, rather than labels (#474)
## Description Part of stackabletech/listener-operator#1 Co-authored-by: Teo Klestrup Röijezon <[email protected]>
1 parent 3e1e9e8 commit e088d9c

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.
44

55
## [Unreleased]
66

7+
This is a rerelease of 0.25.1 which some last-minute incompatible API changes to the additions that would have been released in 0.25.1.
8+
9+
### Changed
10+
11+
- Use Volume as the primary mechanism for directing Listener traffic, rather than labels ([#474]).
12+
13+
[#474]: https://github.com/stackabletech/operator-rs/pull/474
14+
715
## ~~[0.25.1] - 2022-09-23~~ YANKED
816

917
### Added

src/commons/listener.rs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use schemars::JsonSchema;
77
use serde::{Deserialize, Serialize};
88

99
#[cfg(doc)]
10-
use k8s_openapi::api::core::v1::{Node, Pod, Service};
10+
use k8s_openapi::api::core::v1::{Node, Pod, Service, Volume};
1111

1212
/// Defines a policy for how [`Listener`]s should be exposed.
1313
#[derive(CustomResource, Serialize, Deserialize, Clone, Debug, JsonSchema)]
@@ -38,6 +38,7 @@ pub enum ServiceType {
3838
/// Essentially a Stackable extension of a Kubernetes [`Service`]. Compared to [`Service`], [`Listener`] changes two things:
3939
/// 1. It uses a cluster-level policy object ([`ListenerClass`]) to define how exactly the exposure works
4040
/// 2. It has a consistent API for reading back the exposed address(es) of the service
41+
/// 3. The [`Pod`] must mount a [`Volume`] referring to the `Listener`, which also allows us to control stickiness
4142
#[derive(CustomResource, Serialize, Deserialize, Clone, Debug, JsonSchema, Default)]
4243
#[kube(
4344
group = "listeners.stackable.tech",
@@ -50,10 +51,20 @@ pub enum ServiceType {
5051
pub struct ListenerSpec {
5152
/// The name of the [`ListenerClass`].
5253
pub class_name: Option<String>,
53-
/// Labels that the [`Pod`]s must share in order to be exposed.
54-
pub pod_selector: Option<BTreeMap<String, String>>,
54+
/// Extra labels that the [`Pod`]s must match in order to be exposed. They must _also_ still have a `Volume` referring to the listener.
55+
#[serde(default)]
56+
pub extra_pod_selector_labels: BTreeMap<String, String>,
5557
/// Ports that should be exposed.
5658
pub ports: Option<Vec<ListenerPort>>,
59+
/// Whether incoming traffic should also be directed to `Pod`s that are not `Ready`.
60+
#[schemars(default = "Self::default_publish_not_ready_addresses")]
61+
pub publish_not_ready_addresses: Option<bool>,
62+
}
63+
64+
impl ListenerSpec {
65+
fn default_publish_not_ready_addresses() -> Option<bool> {
66+
Some(true)
67+
}
5768
}
5869

5970
#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema)]

0 commit comments

Comments
 (0)