Skip to content

Commit

Permalink
Set receiver port's protocol prior to appending to the list of ports
Browse files Browse the repository at this point in the history
Reduces code duplication by setting the port's protocol consistently, rather than conditionally based the supplied configuration.
  • Loading branch information
KingJ committed Nov 28, 2020
1 parent f044a5c commit 7feb1d8
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions pkg/collector/parser/receiver_jaeger.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,14 @@ func (j *JaegerReceiverParser) Ports() ([]corev1.ServicePort, error) {
// if not, we use the default port
if protocolPort == nil {
protocolPort = &corev1.ServicePort{
Name: portName(nameWithProtocol, protocol.defaultPort),
Port: protocol.defaultPort,
Protocol: protocol.protocol,
Name: portName(nameWithProtocol, protocol.defaultPort),
Port: protocol.defaultPort,
}
} else {
// port from configuration block has been used, but protocol needs to be set
protocolPort.Protocol = protocol.protocol
}

// set the appropriate TCP/UDP protocol for this kind of receiver protocol
protocolPort.Protocol = protocol.protocol

// at this point, we *have* a port specified, add it to the list of ports
ports = append(ports, *protocolPort)
}
Expand Down

0 comments on commit 7feb1d8

Please sign in to comment.