From 26df6740e32433808d67c62faa6b03b4f729cd0d Mon Sep 17 00:00:00 2001 From: Pavel Sviderski Date: Mon, 9 Dec 2024 20:25:34 +1000 Subject: [PATCH] define PortSpec type for publishing ports --- internal/api/service.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/internal/api/service.go b/internal/api/service.go index 0c8c98a0..22fa2d17 100644 --- a/internal/api/service.go +++ b/internal/api/service.go @@ -4,6 +4,8 @@ import ( "encoding/json" "fmt" "github.com/distribution/reference" + "net/netip" + "uncloud/internal/machine/api/pb" ) @@ -38,6 +40,8 @@ type ContainerSpec struct { Image string // Run a custom init inside the container. If nil, use the daemon's configured settings. Init *bool + // Ports to publish from the container. + Ports []PortSpec } func (s *ContainerSpec) Validate() error { @@ -49,6 +53,15 @@ func (s *ContainerSpec) Validate() error { return nil } +type PortSpec struct { + Hostname string + HostIP netip.Addr + PublishedPort uint16 + ContainerPort uint16 + Protocol string + Mode string +} + type Service struct { ID string Name string