aboutsummaryrefslogtreecommitdiff
path: root/libpod/define
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@pm.me>2020-10-26 17:17:45 -0400
committerMatthew Heon <matthew.heon@pm.me>2020-10-27 14:17:41 -0400
commit6af7e544636ae66ce237489ce6948123e1b3249d (patch)
treeb95ead53ec2419d750c56ca008ed0965457d6d10 /libpod/define
parent51fa8ded9ffb7924288a2728ce92af7f6cc66d34 (diff)
downloadpodman-6af7e544636ae66ce237489ce6948123e1b3249d.tar.gz
podman-6af7e544636ae66ce237489ce6948123e1b3249d.tar.bz2
podman-6af7e544636ae66ce237489ce6948123e1b3249d.zip
Add network aliases for containers to DB
This adds the database backend for network aliases. Aliases are additional names for a container that are used with the CNI dnsname plugin - the container will be accessible by these names in addition to its name. Aliases are allowed to change over time as the container connects to and disconnects from networks. Aliases are implemented as another bucket in the database to register all aliases, plus two buckets for each container (one to hold connected CNI networks, a second to hold its aliases). The aliases are only unique per-network, to the global and per-container aliases buckets have a sub-bucket for each CNI network that has aliases, and the aliases are stored within that sub-bucket. Aliases are formatted as alias (key) to container ID (value) in both cases. Three DB functions are defined for aliases: retrieving current aliases for a given network, setting aliases for a given network, and removing all aliases for a given network. Signed-off-by: Matthew Heon <matthew.heon@pm.me>
Diffstat (limited to 'libpod/define')
-rw-r--r--libpod/define/errors.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/libpod/define/errors.go b/libpod/define/errors.go
index 627928ef7..36a919cf6 100644
--- a/libpod/define/errors.go
+++ b/libpod/define/errors.go
@@ -27,6 +27,13 @@ var (
// not exist.
ErrNoSuchExecSession = errors.New("no such exec session")
+ // ErrNoAliases indicates that the container does not have any network
+ // aliases.
+ ErrNoAliases = errors.New("no aliases for container")
+ // ErrNoAliasesForNetwork indicates that the container has no aliases
+ // for a specific network.
+ ErrNoAliasesForNetwork = errors.New("no aliases for network")
+
// ErrCtrExists indicates a container with the same name or ID already
// exists
ErrCtrExists = errors.New("container already exists")
@@ -39,6 +46,9 @@ var (
// ErrExecSessionExists indicates an exec session with the same ID
// already exists.
ErrExecSessionExists = errors.New("exec session already exists")
+ // ErrAliasExists indicates that a network alias with the same name
+ // already exists in the network.
+ ErrAliasExists = errors.New("alias already exists")
// ErrCtrStateInvalid indicates a container is in an improper state for
// the requested operation