Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion api/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion hack/boilerplate/header.generated.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2024 Cisco Systems, Inc. and/or its affiliates
Copyright 2025 Cisco Systems, Inc. and/or its affiliates

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion hack/boilerplate/header.go.generated.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2024 Cisco Systems, Inc. and/or its affiliates
Copyright 2025 Cisco Systems, Inc. and/or its affiliates

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
20 changes: 12 additions & 8 deletions pkg/util/kafka/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,12 @@ func GetBootstrapServersService(cluster *v1beta1.KafkaCluster) (string, error) {

// GetBrokerContainerPort return broker container port
func GetBrokerContainerPort(cluster *v1beta1.KafkaCluster) (int32, error) {
usedForKafkaAdminSet := false
containerPort := int32(0)
for _, lc := range cluster.Spec.ListenersConfig.InternalListeners {
if lc.UsedForKafkaAdminCommunication { // Optional override to return a port from a different listener. Needed if b2b communication is on an external listener and and you want the koperator to interact with kafka over a different port.
containerPort = lc.ContainerPort
usedForKafkaAdminSet = true
break
}
if lc.UsedForInnerBrokerCommunication && !lc.UsedForControllerCommunication {
Expand All @@ -203,14 +205,16 @@ func GetBrokerContainerPort(cluster *v1beta1.KafkaCluster) (int32, error) {
}
}

for _, lc := range cluster.Spec.ListenersConfig.ExternalListeners {
if lc.UsedForKafkaAdminCommunication {
containerPort = lc.ContainerPort
break
}
if lc.UsedForInnerBrokerCommunication {
containerPort = lc.ContainerPort
break
if !usedForKafkaAdminSet {
for _, lc := range cluster.Spec.ListenersConfig.ExternalListeners {
if lc.UsedForKafkaAdminCommunication {
containerPort = lc.ContainerPort
break
}
if lc.UsedForInnerBrokerCommunication {
containerPort = lc.ContainerPort
break
}
}
}

Expand Down
Loading