mirror of
https://github.com/psviderski/uncloud.git
synced 2026-08-26 11:03:34 +00:00
fix: import cycle in pkg/api
This commit is contained in:
@@ -9,10 +9,12 @@ import (
|
|||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
"github.com/docker/go-units"
|
"github.com/docker/go-units"
|
||||||
"github.com/psviderski/uncloud/internal/machine/docker"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
// DockerNetworkName is the name of the Docker network used by uncloud. Keep the value in sync with NetworkName
|
||||||
|
// in internal/machine/docker/manager.go.
|
||||||
|
DockerNetworkName = "uncloud"
|
||||||
LabelManaged = "uncloud.managed"
|
LabelManaged = "uncloud.managed"
|
||||||
LabelServiceID = "uncloud.service.id"
|
LabelServiceID = "uncloud.service.id"
|
||||||
LabelServiceName = "uncloud.service.name"
|
LabelServiceName = "uncloud.service.name"
|
||||||
@@ -94,7 +96,7 @@ func (c *Container) HumanState() (string, error) {
|
|||||||
|
|
||||||
// UncloudNetworkIP returns the IP address of the container in the uncloud Docker network.
|
// UncloudNetworkIP returns the IP address of the container in the uncloud Docker network.
|
||||||
func (c *Container) UncloudNetworkIP() netip.Addr {
|
func (c *Container) UncloudNetworkIP() netip.Addr {
|
||||||
network, ok := c.NetworkSettings.Networks[docker.NetworkName]
|
network, ok := c.NetworkSettings.Networks[DockerNetworkName]
|
||||||
if !ok {
|
if !ok {
|
||||||
// Container is not connected to the uncloud Docker network (could be host network).
|
// Container is not connected to the uncloud Docker network (could be host network).
|
||||||
return netip.Addr{}
|
return netip.Addr{}
|
||||||
|
|||||||
Reference in New Issue
Block a user