@@ -7,7 +7,7 @@ use schemars::JsonSchema;
7
7
use serde:: { Deserialize , Serialize } ;
8
8
9
9
#[ cfg( doc) ]
10
- use k8s_openapi:: api:: core:: v1:: { Node , Pod , Service } ;
10
+ use k8s_openapi:: api:: core:: v1:: { Node , Pod , Service , Volume } ;
11
11
12
12
/// Defines a policy for how [`Listener`]s should be exposed.
13
13
#[ derive( CustomResource , Serialize , Deserialize , Clone , Debug , JsonSchema ) ]
@@ -38,6 +38,7 @@ pub enum ServiceType {
38
38
/// Essentially a Stackable extension of a Kubernetes [`Service`]. Compared to [`Service`], [`Listener`] changes two things:
39
39
/// 1. It uses a cluster-level policy object ([`ListenerClass`]) to define how exactly the exposure works
40
40
/// 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
41
42
#[ derive( CustomResource , Serialize , Deserialize , Clone , Debug , JsonSchema , Default ) ]
42
43
#[ kube(
43
44
group = "listeners.stackable.tech" ,
@@ -50,10 +51,20 @@ pub enum ServiceType {
50
51
pub struct ListenerSpec {
51
52
/// The name of the [`ListenerClass`].
52
53
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 > ,
55
57
/// Ports that should be exposed.
56
58
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
+ }
57
68
}
58
69
59
70
#[ derive( Serialize , Deserialize , Clone , Debug , JsonSchema ) ]
0 commit comments