Skip to content

Commit 03f222a

Browse files
authored
chore: remove -nodeport discovery configmap (#868)
* chore: remove -nodeport discovery configmap * remove -nodeport discovery configmap note * add changelog entry
1 parent 04ab1d8 commit 03f222a

File tree

4 files changed

+17
-63
lines changed

4 files changed

+17
-63
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ All notable changes to this project will be documented in this file.
3737

3838
- test: ZooKeeper 3.9.2 removed ([#853]).
3939
- Support for Kafka 3.7.1 and 3.8.0 removed ([#860]).
40+
- Remove the `-nodeport` discovery ConfigMap ([#868]).
4041

4142
[#840]: https://github.com/stackabletech/kafka-operator/pull/840
4243
[#844]: https://github.com/stackabletech/kafka-operator/pull/844
@@ -48,6 +49,7 @@ All notable changes to this project will be documented in this file.
4849
[#860]: https://github.com/stackabletech/kafka-operator/pull/860
4950
[#861]: https://github.com/stackabletech/kafka-operator/pull/861
5051
[#862]: https://github.com/stackabletech/kafka-operator/pull/862
52+
[#868]: https://github.com/stackabletech/kafka-operator/pull/868
5153

5254
## [25.3.0] - 2025-03-21
5355

docs/modules/kafka/pages/reference/discovery.adoc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ The Stackable Operator for Apache Kafka publishes a xref:concepts:service_discov
99

1010
The bundle includes a thrift connection string to access the Kafka broker service. This string may be used by other operators or tools to configure their products with access to Kafka. This is limited to internal cluster access.
1111

12-
NOTE: The operator also creates a deprecated secondary discovery ConfigMap named `\{clusterName\}-nodeport`. In 24.7 and older, this ConfigMap was used to access the Kafka installation from outside the Kubernetes cluster. In 24.11, this was replaced by xref:usage-guide/listenerclass.adoc[Listener-based exposition], and the `-nodeport` ConfigMap was made equivalent to the primary one. This behaviour is deprecated as of 25.3, and will be removed in the next release. Any existing uses of the `-nodeport` ConfigMap should be migrated to the primary. See https://github.com/stackabletech/kafka-operator/issues/765[the deprecation issue] for more details.
13-
1412
== Example
1513

1614
Given the following Kafka cluster:

rust/operator-binary/src/discovery.rs

Lines changed: 7 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -55,77 +55,33 @@ pub enum Error {
5555
},
5656
}
5757

58-
/// Builds discovery [`ConfigMap`]s for connecting to a [`v1alpha1::KafkaCluster`] for all expected
59-
/// scenarios.
60-
pub async fn build_discovery_configmaps(
58+
/// Build a discovery [`ConfigMap`] containing information about how to connect to a certain
59+
/// [`v1alpha1::KafkaCluster`].
60+
pub fn build_discovery_configmap(
6161
kafka: &v1alpha1::KafkaCluster,
6262
owner: &impl Resource<DynamicType = ()>,
6363
resolved_product_image: &ResolvedProductImage,
6464
kafka_security: &KafkaTlsSecurity,
6565
listeners: &[listener::v1alpha1::Listener],
66-
) -> Result<Vec<ConfigMap>, Error> {
67-
let name = owner.name_unchecked();
66+
) -> Result<ConfigMap, Error> {
6867
let port_name = if kafka_security.has_kerberos_enabled() {
6968
kafka_security.bootstrap_port_name()
7069
} else {
7170
kafka_security.client_port_name()
7271
};
73-
Ok(vec![
74-
build_discovery_configmap(
75-
kafka,
76-
owner,
77-
resolved_product_image,
78-
&name,
79-
listener_hosts(listeners, port_name)?,
80-
)?,
81-
{
82-
let mut nodeport = build_discovery_configmap(
83-
kafka,
84-
owner,
85-
resolved_product_image,
86-
&format!("{name}-nodeport"),
87-
listener_hosts(listeners, port_name)?,
88-
)?;
89-
nodeport
90-
.metadata
91-
.annotations
92-
.get_or_insert_with(Default::default)
93-
.insert(
94-
"stackable.tech/deprecated".to_string(),
95-
format!(
96-
"Deprecated in 25.3, and scheduled for removal in the next version. \
97-
Use {name:?} instead. \
98-
See https://github.com/stackabletech/kafka-operator/issues/765 for more."
99-
),
100-
);
101-
nodeport
102-
},
103-
])
104-
}
10572

106-
/// Build a discovery [`ConfigMap`] containing information about how to connect to a certain
107-
/// [`v1alpha1::KafkaCluster`].
108-
///
109-
/// `hosts` will usually come from [`listener_hosts`].
110-
fn build_discovery_configmap(
111-
kafka: &v1alpha1::KafkaCluster,
112-
owner: &impl Resource<DynamicType = ()>,
113-
resolved_product_image: &ResolvedProductImage,
114-
name: &str,
115-
hosts: impl IntoIterator<Item = (impl Into<String>, u16)>,
116-
) -> Result<ConfigMap, Error> {
11773
// Write a list of bootstrap servers in the format that Kafka clients:
11874
// "{host1}:{port1},{host2:port2},..."
119-
let bootstrap_servers = hosts
75+
let bootstrap_servers = listener_hosts(listeners, port_name)?
12076
.into_iter()
121-
.map(|(host, port)| format!("{}:{}", host.into(), port))
77+
.map(|(host, port)| format!("{}:{}", host, port))
12278
.collect::<Vec<_>>()
12379
.join(",");
12480
ConfigMapBuilder::new()
12581
.metadata(
12682
ObjectMetaBuilder::new()
12783
.name_and_namespace(kafka)
128-
.name(name)
84+
.name(owner.name_unchecked())
12985
.ownerreference_from_resource(owner, None, Some(true))
13086
.with_context(|_| ObjectMissingMetadataForOwnerRefSnafu {
13187
kafka: ObjectRef::from_obj(kafka),

rust/operator-binary/src/kafka_controller.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ use crate::{
8484
security::KafkaTlsSecurity,
8585
v1alpha1,
8686
},
87-
discovery::{self, build_discovery_configmaps},
87+
discovery::{self, build_discovery_configmap},
8888
kerberos::{self, add_kerberos_pod_config},
8989
operations::{
9090
graceful_shutdown::{add_graceful_shutdown_config, graceful_shutdown_config_properties},
@@ -596,21 +596,19 @@ pub async fn reconcile_kafka(
596596
.context(FailedToCreatePdbSnafu)?;
597597
}
598598

599-
for discovery_cm in build_discovery_configmaps(
599+
let discovery_cm = build_discovery_configmap(
600600
kafka,
601601
kafka,
602602
&resolved_product_image,
603603
&kafka_security,
604604
&bootstrap_listeners,
605605
)
606-
.await
607-
.context(BuildDiscoveryConfigSnafu)?
608-
{
609-
cluster_resources
610-
.add(client, discovery_cm)
611-
.await
612-
.context(ApplyDiscoveryConfigSnafu)?;
613-
}
606+
.context(BuildDiscoveryConfigSnafu)?;
607+
608+
cluster_resources
609+
.add(client, discovery_cm)
610+
.await
611+
.context(ApplyDiscoveryConfigSnafu)?;
614612

615613
let cluster_operation_cond_builder =
616614
ClusterOperationsConditionBuilder::new(&kafka.spec.cluster_operation);

0 commit comments

Comments
 (0)