mirror of
https://github.com/psviderski/uncloud.git
synced 2026-08-26 11:03:34 +00:00
define PortSpec type for publishing ports
This commit is contained in:
@@ -4,6 +4,8 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/distribution/reference"
|
"github.com/distribution/reference"
|
||||||
|
"net/netip"
|
||||||
|
|
||||||
"uncloud/internal/machine/api/pb"
|
"uncloud/internal/machine/api/pb"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -38,6 +40,8 @@ type ContainerSpec struct {
|
|||||||
Image string
|
Image string
|
||||||
// Run a custom init inside the container. If nil, use the daemon's configured settings.
|
// Run a custom init inside the container. If nil, use the daemon's configured settings.
|
||||||
Init *bool
|
Init *bool
|
||||||
|
// Ports to publish from the container.
|
||||||
|
Ports []PortSpec
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *ContainerSpec) Validate() error {
|
func (s *ContainerSpec) Validate() error {
|
||||||
@@ -49,6 +53,15 @@ func (s *ContainerSpec) Validate() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type PortSpec struct {
|
||||||
|
Hostname string
|
||||||
|
HostIP netip.Addr
|
||||||
|
PublishedPort uint16
|
||||||
|
ContainerPort uint16
|
||||||
|
Protocol string
|
||||||
|
Mode string
|
||||||
|
}
|
||||||
|
|
||||||
type Service struct {
|
type Service struct {
|
||||||
ID string
|
ID string
|
||||||
Name string
|
Name string
|
||||||
|
|||||||
Reference in New Issue
Block a user