From efe646f54cddcd0c54210a2dd5188892e2a15a83 Mon Sep 17 00:00:00 2001 From: Pavel Sviderski Date: Sat, 8 Mar 2025 19:07:51 +1000 Subject: [PATCH] chore: validate unsupported tcp/udp protocols for ingress port --- internal/api/service.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/internal/api/service.go b/internal/api/service.go index 940612b0..9c2480dc 100644 --- a/internal/api/service.go +++ b/internal/api/service.go @@ -38,8 +38,14 @@ func (s *ServiceSpec) Validate() error { return fmt.Errorf("invalid mode: %q", s.Mode) } + for _, p := range s.Ports { + if (p.Mode == "" || p.Mode == PortModeIngress) && + p.Protocol != ProtocolHTTP && p.Protocol != ProtocolHTTPS { + return fmt.Errorf("unsupported protocol for ingress port %d: %s", p.ContainerPort, p.Protocol) + } + } + // TODO: validate there is no conflict between ports. - // TODO: return error if there are non-HTTP/HTTPS ingress ports that we don't support yet. return nil }