Skip to content

Commit 00e923a

Browse files
committed
Support specifying Service type
1 parent 55e9bc8 commit 00e923a

File tree

4 files changed

+41
-0
lines changed

4 files changed

+41
-0
lines changed

CHANGELOG.md

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

1313
### Changed
1414

15+
- Support specifying Service type.
16+
This enables us to later switch non-breaking to using `ListenerClasses` for the exposure of Services.
17+
So far only `external-unstable` is supported, which re-uses the current code to create NodePorts
18+
and calculate the reachable address to advertise ([#XXX]).
1519
- `operator-rs` `0.30.1` -> `0.39.0` ([#545], [#574]).
1620
- Bumped stackable versions to "23.4.0-rc1" ([#545]).
1721
- Bumped kafka stackable versions to "23.4.0-rc2" ([#547]).

deploy/helm/kafka-operator/crds/crds.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1423,6 +1423,15 @@ spec:
14231423
- configMapName
14241424
type: object
14251425
type: object
1426+
listenerClass:
1427+
default: external-unstable
1428+
description: |-
1429+
In the future this setting will control, which ListenerClass <https://docs.stackable.tech/home/stable/listener-operator/listenerclass.html> will be used to expose the service. Currently only a subset of the ListenerClasses are supported by choosing the type of the created Services by looking at the ListenerClass name specified, In a future release support for custom ListenerClasses will be introduced without a breaking change:
1430+
1431+
* external-unstable: Use a NodePort service
1432+
enum:
1433+
- external-unstable
1434+
type: string
14261435
tls:
14271436
default:
14281437
internalSecretClass: tls

rust/crd/src/lib.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,32 @@ pub struct KafkaClusterConfig {
116116
pub vector_aggregator_config_map_name: Option<String>,
117117
/// ZooKeeper discovery config map name.
118118
pub zookeeper_config_map_name: String,
119+
/// In the future this setting will control, which ListenerClass <https://docs.stackable.tech/home/stable/listener-operator/listenerclass.html>
120+
/// will be used to expose the service.
121+
/// Currently only a subset of the ListenerClasses are supported by choosing the type of the created Services
122+
/// by looking at the ListenerClass name specified,
123+
/// In a future release support for custom ListenerClasses will be introduced without a breaking change:
124+
///
125+
/// * external-unstable: Use a NodePort service
126+
#[serde(default)]
127+
pub listener_class: CurrentlySupportedListenerClasses,
128+
}
129+
130+
// TODO: Temporary solution until listener-operator is finished
131+
#[derive(Clone, Debug, Default, Display, Deserialize, Eq, JsonSchema, PartialEq, Serialize)]
132+
#[serde(rename_all = "PascalCase")]
133+
pub enum CurrentlySupportedListenerClasses {
134+
#[default]
135+
#[serde(rename = "external-unstable")]
136+
ExternalUnstable,
137+
}
138+
139+
impl CurrentlySupportedListenerClasses {
140+
pub fn k8s_service_type(&self) -> String {
141+
match self {
142+
CurrentlySupportedListenerClasses::ExternalUnstable => "NodePort".to_string(),
143+
}
144+
}
119145
}
120146

121147
impl KafkaCluster {

rust/operator/src/kafka_controller.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -598,6 +598,8 @@ fn build_broker_rolegroup_service(
598598
.with_label("prometheus.io/scrape", "true")
599599
.build(),
600600
spec: Some(ServiceSpec {
601+
// Internal communication does not need to be exposed
602+
type_: Some("ClusterIP".to_string()),
601603
cluster_ip: Some("None".to_string()),
602604
ports: Some(service_ports(kafka_security)),
603605
selector: Some(role_group_selector_labels(

0 commit comments

Comments
 (0)