From 62eb27a0a86da3cb87741cf03d57741f1c168a1b Mon Sep 17 00:00:00 2001 From: Marc Cataford Date: Sat, 9 Nov 2024 18:08:32 -0500 Subject: [PATCH] feat: allow network, pid in container definitions --- podman/main.go | 8 ++++++++ service_definition/main.go | 12 +++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/podman/main.go b/podman/main.go index 76f4cdb..4752a00 100644 --- a/podman/main.go +++ b/podman/main.go @@ -96,6 +96,14 @@ func CreateContainer(definition service_definition.ContainerDefinition, knownVol "--replace", } + if definition.Network != "" { + args = append(args, []string{"--network", definition.Network}...) + } + + if definition.PIDNamespace != "" { + args = append(args, []string{"--pid", definition.PIDNamespace}...) + } + if definition.EnvFile != "" { args = append(args, []string{"--env-file", definition.EnvFile}...) } diff --git a/service_definition/main.go b/service_definition/main.go index 5a2bae1..1557f16 100644 --- a/service_definition/main.go +++ b/service_definition/main.go @@ -33,11 +33,13 @@ type VolumeConfiguration struct { } type ContainerDefinition struct { - Name string `yaml:"name"` - Image string `yaml:"image"` - Volumes []VolumeConfiguration `yaml:"volumes"` - EnvFile string `yaml:"env-file"` - ExtraArgs []string `yaml:"extra-args"` + Name string `yaml:"name"` + Image string `yaml:"image"` + Volumes []VolumeConfiguration `yaml:"volumes"` + EnvFile string `yaml:"env-file"` + Network string `yaml:"network"` + PIDNamespace string `yaml:"pid-namespace"` + ExtraArgs []string `yaml:"extra-args"` } type ServiceDefinition struct {