Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ public Service generateService() {
labels,
ownerReference,
templateService,
List.of(ServiceUtils.createServicePort(REST_API_PORT_NAME, REST_API_PORT, REST_API_PORT, "TCP"))
List.of(ServiceUtils.createServicePort(REST_API_PORT_NAME, REST_API_PORT, REST_API_PORT_NAME, "TCP"))
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ public Service generateService() {
labels,
ownerReference,
templateService,
List.of(ServiceUtils.createServicePort(REST_API_PORT_NAME, port, port, "TCP")),
List.of(ServiceUtils.createServicePort(REST_API_PORT_NAME, port, REST_API_PORT_NAME, "TCP")),
labels.strimziSelectorLabels(),
ModelUtils.getCustomLabelsOrAnnotations(CO_ENV_VAR_CUSTOM_SERVICE_LABELS),
Util.mergeLabelsOrAnnotations(getDiscoveryAnnotation(port), ModelUtils.getCustomLabelsOrAnnotations(CO_ENV_VAR_CUSTOM_SERVICE_ANNOTATIONS))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -650,10 +650,10 @@ private List<ServicePort> getServicePorts() {
List<GenericKafkaListener> internalListeners = ListenersUtils.internalListeners(listeners);

List<ServicePort> ports = new ArrayList<>(internalListeners.size() + 1);
ports.add(ServiceUtils.createServicePort(REPLICATION_PORT_NAME, REPLICATION_PORT, REPLICATION_PORT, "TCP"));
ports.add(ServiceUtils.createServicePort(REPLICATION_PORT_NAME, REPLICATION_PORT, REPLICATION_PORT_NAME, "TCP"));

for (GenericKafkaListener listener : internalListeners) {
ports.add(ServiceUtils.createServicePort(ListenersUtils.backwardsCompatiblePortName(listener), listener.getPort(), listener.getPort(), "TCP"));
ports.add(ServiceUtils.createServicePort(ListenersUtils.backwardsCompatiblePortName(listener), listener.getPort(), ListenersUtils.backwardsCompatiblePortName(listener), "TCP"));
}

return ports;
Expand All @@ -669,12 +669,12 @@ private List<ServicePort> getHeadlessServicePorts() {
List<GenericKafkaListener> internalListeners = ListenersUtils.internalListeners(listeners);

List<ServicePort> ports = new ArrayList<>(internalListeners.size() + 3);
ports.add(ServiceUtils.createServicePort(CONTROLPLANE_PORT_NAME, CONTROLPLANE_PORT, CONTROLPLANE_PORT, "TCP"));
ports.add(ServiceUtils.createServicePort(REPLICATION_PORT_NAME, REPLICATION_PORT, REPLICATION_PORT, "TCP"));
ports.add(ServiceUtils.createServicePort(KAFKA_AGENT_PORT_NAME, KAFKA_AGENT_PORT, KAFKA_AGENT_PORT, "TCP"));
ports.add(ServiceUtils.createServicePort(CONTROLPLANE_PORT_NAME, CONTROLPLANE_PORT, CONTROLPLANE_PORT_NAME, "TCP"));
ports.add(ServiceUtils.createServicePort(REPLICATION_PORT_NAME, REPLICATION_PORT, REPLICATION_PORT_NAME, "TCP"));
ports.add(ServiceUtils.createServicePort(KAFKA_AGENT_PORT_NAME, KAFKA_AGENT_PORT, KAFKA_AGENT_PORT_NAME, "TCP"));

for (GenericKafkaListener listener : internalListeners) {
ports.add(ServiceUtils.createServicePort(ListenersUtils.backwardsCompatiblePortName(listener), listener.getPort(), listener.getPort(), "TCP"));
ports.add(ServiceUtils.createServicePort(ListenersUtils.backwardsCompatiblePortName(listener), listener.getPort(), ListenersUtils.backwardsCompatiblePortName(listener), "TCP"));
}

ports.addAll(jmx.servicePorts());
Expand Down Expand Up @@ -747,7 +747,7 @@ public List<Service> generateExternalBootstrapServices() {
List<ServicePort> ports = Collections.singletonList(
ServiceUtils.createServicePort(ListenersUtils.backwardsCompatiblePortName(listener),
listener.getPort(),
listener.getPort(),
ListenersUtils.backwardsCompatiblePortName(listener),
ListenersUtils.bootstrapNodePort(listener),
"TCP")
);
Expand Down Expand Up @@ -838,7 +838,7 @@ public List<Service> generatePerPodServices() {
ServiceUtils.createServicePort(
ListenersUtils.backwardsCompatiblePortName(listener),
listener.getPort(),
listener.getPort(),
ListenersUtils.backwardsCompatiblePortName(listener),
ListenersUtils.brokerNodePort(listener, node.nodeId()),
"TCP")
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ public String getServiceName() {
*/
public Service generateService() {
List<ServicePort> ports = new ArrayList<>(1);
ports.add(ServiceUtils.createServicePort(REST_API_PORT_NAME, REST_API_PORT, REST_API_PORT, "TCP"));
ports.add(ServiceUtils.createServicePort(REST_API_PORT_NAME, REST_API_PORT, REST_API_PORT_NAME, "TCP"));

ports.addAll(jmx.servicePorts());

Expand All @@ -362,7 +362,7 @@ public Service generateService() {
* @return The generated Service
*/
public Service generateHeadlessService() {
List<ServicePort> ports = List.of(ServiceUtils.createServicePort(REST_API_PORT_NAME, REST_API_PORT, REST_API_PORT, "TCP"));
List<ServicePort> ports = List.of(ServiceUtils.createServicePort(REST_API_PORT_NAME, REST_API_PORT, REST_API_PORT_NAME, "TCP"));

return ServiceUtils.createHeadlessService(
componentName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,32 +219,32 @@ private static List<IpFamily> ipFamilies(InternalServiceTemplate template) {
*
* @param name Name of the port
* @param port The port on the service which can be accessed by clients
* @param targetPort The port on the container / Pod where the connections will be routed
* @param targetPortName the name of the target port on the container / Pod where the connections will be routed
* @param protocol Protocol used by this port
*
* @return Created port
*/
public static ServicePort createServicePort(String name, int port, int targetPort, String protocol) {
return createServicePort(name, port, targetPort, null, protocol);
public static ServicePort createServicePort(String name, int port, String targetPortName, String protocol) {
return createServicePort(name, port, targetPortName, null, protocol);
}

/**
* Creates Service port with a specific node port
*
* @param name Name of the port
* @param port The port on the service which can be accessed by clients
* @param targetPort The port on the container / Pod where the connections will be routed
* @param targetPortName the name of the target port on the container / Pod where the connections will be routed
* @param nodePort The desired node port number
* @param protocol Protocol used by this port
*
* @return Created port
*/
public static ServicePort createServicePort(String name, int port, int targetPort, Integer nodePort, String protocol) {
public static ServicePort createServicePort(String name, int port, String targetPortName, Integer nodePort, String protocol) {
return new ServicePortBuilder()
.withName(name)
.withProtocol(protocol)
.withPort(port)
.withNewTargetPort(targetPort)
.withNewTargetPort(targetPortName)
.withNodePort(nodePort)
.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public String secretName() {
*/
public List<ServicePort> servicePorts() {
if (isEnabled) {
return List.of(ServiceUtils.createServicePort(JMX_PORT_NAME, JMX_PORT, JMX_PORT, "TCP"));
return List.of(ServiceUtils.createServicePort(JMX_PORT_NAME, JMX_PORT, JMX_PORT_NAME, "TCP"));
} else {
return List.of();
}
Expand Down
Loading
Loading