mirror of
https://github.com/itzg/mc-router.git
synced 2024-11-24 11:55:24 +01:00
For k8s, look for mc-router named service port and use port value
This commit is contained in:
parent
351b61222e
commit
be0f2a8c56
@ -10,6 +10,7 @@ import (
|
|||||||
"k8s.io/client-go/tools/cache"
|
"k8s.io/client-go/tools/cache"
|
||||||
"k8s.io/client-go/tools/clientcmd"
|
"k8s.io/client-go/tools/clientcmd"
|
||||||
"net"
|
"net"
|
||||||
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -146,10 +147,8 @@ func buildDetails(service *v1.Service, externalServiceName string) *routableServ
|
|||||||
clusterIp := service.Spec.ClusterIP
|
clusterIp := service.Spec.ClusterIP
|
||||||
port := "25565"
|
port := "25565"
|
||||||
for _, p := range service.Spec.Ports {
|
for _, p := range service.Spec.Ports {
|
||||||
if p.Port == 25565 {
|
if p.Name == "mc-router" {
|
||||||
if p.TargetPort.String() != "" {
|
port = strconv.Itoa(int(p.Port))
|
||||||
port = p.TargetPort.String()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rs := &routableService{
|
rs := &routableService{
|
||||||
|
Loading…
Reference in New Issue
Block a user