@@ -90,6 +90,39 @@ pub struct HdfsClusterConfig {
90
90
pub vector_aggregator_config_map_name : Option < String > ,
91
91
/// Name of the ZooKeeper discovery config map.
92
92
pub zookeeper_config_map_name : String ,
93
+ /// In the future this setting will control, which ListenerClass <https://docs.stackable.tech/home/stable/listener-operator/listenerclass.html>
94
+ /// will be used to expose the service.
95
+ /// Currently only a subset of the ListenerClasses are supported by choosing the type of the created Services
96
+ /// by looking at the ListenerClass name specified,
97
+ /// In a future release support for custom ListenerClasses will be introduced without a breaking change:
98
+ ///
99
+ /// * cluster-internal: Use a ClusterIP service
100
+ ///
101
+ /// * external-unstable: Use a NodePort service
102
+ #[ serde( default ) ]
103
+ pub listener_class : CurrentlySupportedListenerClasses ,
104
+ }
105
+
106
+ // TODO: Temporary solution until listener-operator is finished
107
+ #[ derive(
108
+ Clone , Debug , Default , Display , Deserialize , Eq , Hash , JsonSchema , PartialEq , Serialize ,
109
+ ) ]
110
+ #[ serde( rename_all = "PascalCase" ) ]
111
+ pub enum CurrentlySupportedListenerClasses {
112
+ #[ default]
113
+ #[ serde( rename = "cluster-internal" ) ]
114
+ ClusterInternal ,
115
+ #[ serde( rename = "external-unstable" ) ]
116
+ ExternalUnstable ,
117
+ }
118
+
119
+ impl CurrentlySupportedListenerClasses {
120
+ pub fn k8s_service_type ( & self ) -> String {
121
+ match self {
122
+ CurrentlySupportedListenerClasses :: ClusterInternal => "ClusterIP" . to_string ( ) ,
123
+ CurrentlySupportedListenerClasses :: ExternalUnstable => "NodePort" . to_string ( ) ,
124
+ }
125
+ }
93
126
}
94
127
95
128
/// This is a shared trait for all role/role-group config structs to avoid duplication
@@ -433,9 +466,15 @@ impl HdfsCluster {
433
466
) ;
434
467
group_labels. insert ( String :: from ( "role" ) , rolegroup_ref. role . clone ( ) ) ;
435
468
group_labels. insert ( String :: from ( "group" ) , rolegroup_ref. role_group . clone ( ) ) ;
436
- // TODO: in a production environment, probably not all roles need to be exposed with one NodePort per Pod but it's
437
- // useful for development purposes.
438
- group_labels. insert ( LABEL_ENABLE . to_string ( ) , "true" . to_string ( ) ) ;
469
+
470
+ if self . spec . cluster_config . listener_class
471
+ == CurrentlySupportedListenerClasses :: ExternalUnstable
472
+ {
473
+ // TODO: in a production environment, probably not all roles need to be exposed with one NodePort per Pod but it's
474
+ // useful for development purposes.
475
+
476
+ group_labels. insert ( LABEL_ENABLE . to_string ( ) , "true" . to_string ( ) ) ;
477
+ }
439
478
440
479
group_labels
441
480
}
0 commit comments