diff options
author | baude <bbaude@redhat.com> | 2020-10-29 15:54:33 -0500 |
---|---|---|
committer | baude <bbaude@redhat.com> | 2020-11-09 15:08:58 -0600 |
commit | b7b5b6f8e3072530f4c3fc07e5960e54c90729b5 (patch) | |
tree | 01352a9b52f5e6cc3b0c78390036010088e3097a /pkg/specgen | |
parent | 110a1d8f25c87739afe790ac2bc461937f17222a (diff) | |
download | podman-b7b5b6f8e3072530f4c3fc07e5960e54c90729b5.tar.gz podman-b7b5b6f8e3072530f4c3fc07e5960e54c90729b5.tar.bz2 podman-b7b5b6f8e3072530f4c3fc07e5960e54c90729b5.zip |
network aliases for container creation
podman can now support adding network aliases when running containers
(--network-alias). It requires an updated dnsname plugin as well as an
updated ocicni to work properly.
Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'pkg/specgen')
-rw-r--r-- | pkg/specgen/generate/container_create.go | 4 | ||||
-rw-r--r-- | pkg/specgen/specgen.go | 3 |
2 files changed, 7 insertions, 0 deletions
diff --git a/pkg/specgen/generate/container_create.go b/pkg/specgen/generate/container_create.go index 53dc35df1..c049e64cf 100644 --- a/pkg/specgen/generate/container_create.go +++ b/pkg/specgen/generate/container_create.go @@ -133,6 +133,10 @@ func MakeContainer(ctx context.Context, rt *libpod.Runtime, s *specgen.SpecGener } options = append(options, libpod.WithExitCommand(exitCommandArgs)) + if len(s.Aliases) > 0 { + options = append(options, libpod.WithNetworkAliases(s.Aliases)) + } + runtimeSpec, err := SpecGenToOCI(ctx, s, rt, rtc, newImage, finalMounts, pod, command) if err != nil { return nil, err diff --git a/pkg/specgen/specgen.go b/pkg/specgen/specgen.go index d68f55402..0a9a16ea7 100644 --- a/pkg/specgen/specgen.go +++ b/pkg/specgen/specgen.go @@ -328,6 +328,9 @@ type ContainerCgroupConfig struct { // ContainerNetworkConfig contains information on a container's network // configuration. type ContainerNetworkConfig struct { + // Aliases are a list of network-scoped aliases for container + // Optional + Aliases map[string][]string `json:"aliases"` // NetNS is the configuration to use for the container's network // namespace. // Mandatory. |