fix(service): Fixes naming service ports

- ports should be named "port-XXX" with XXX to be the port number if the
port name cannot be discovered
- it follows what we do in Deployment objects
- this should fix #132
This commit is contained in:
2025-07-13 15:02:26 +02:00
parent 89fd516b20
commit ce479629f6
2 changed files with 36 additions and 0 deletions

View File

@@ -1,6 +1,7 @@
package generator
import (
"fmt"
"katenary/utils"
"regexp"
"strings"
@@ -59,6 +60,7 @@ func (s *Service) AddPort(port types.ServicePortConfig, serviceName ...string) {
if targetPort := utils.GetServiceNameByPort(int(port.Target)); targetPort == "" {
finalport = intstr.FromInt(int(port.Target))
name = fmt.Sprintf("port-%d", port.Target)
} else {
finalport = intstr.FromString(targetPort)
name = targetPort