Skip to content

Commit

Permalink
feat(container): add NetworkAlias= Quadlet option
Browse files Browse the repository at this point in the history
Fixes: #98
Signed-off-by: Paul Nettleton <[email protected]>
  • Loading branch information
k9withabone committed Oct 16, 2024
1 parent 5659375 commit 4f1096f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
4 changes: 0 additions & 4 deletions src/cli/container/podman.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,10 +241,6 @@ pub struct PodmanArgs {
#[arg(long, value_name = "NUMBER")]
memory_swappiness: Option<u8>,

/// Add a network-scoped alias for the container
#[arg(long, value_name = "ALIAS")]
network_alias: Option<String>,

/// Disable healthchecks on the container
#[arg(long)]
#[serde(skip_serializing_if = "Not::not")]
Expand Down
10 changes: 10 additions & 0 deletions src/cli/container/quadlet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,14 @@ pub struct QuadletOptions {
#[arg(long, visible_alias = "net", value_name = "MODE")]
network: Vec<String>,

/// Add a network-scoped alias for the container
///
/// Converts to "NetworkAlias=ALIAS"
///
/// Can be specified multiple times
#[arg(long, value_name = "ALIAS")]
network_alias: Vec<String>,

/// Control sd-notify behavior
///
/// If `container`, converts to "Notify=true"
Expand Down Expand Up @@ -507,6 +515,7 @@ impl From<QuadletOptions> for crate::quadlet::Container {
log_opt,
mount,
network,
network_alias,
sdnotify: notify,
pids_limit,
publish: publish_port,
Expand Down Expand Up @@ -580,6 +589,7 @@ impl From<QuadletOptions> for crate::quadlet::Container {
log_opt,
mount,
network,
network_alias,
notify,
pids_limit,
publish_port,
Expand Down
5 changes: 5 additions & 0 deletions src/quadlet/container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,9 @@ pub struct Container {
/// Specify a custom network for the container.
pub network: Vec<String>,

/// Add a network-scoped alias for the container.
pub network_alias: Vec<String>,

/// If enabled, this disables the container processes from gaining additional
/// privileges via things like setuid and file capabilities.
#[serde(skip_serializing_if = "Not::not")]
Expand Down Expand Up @@ -383,6 +386,7 @@ impl Container {
OptionsV5_2 {
log_opt,
stop_signal,
network_alias,
}
);

Expand Down Expand Up @@ -547,6 +551,7 @@ impl Container {
struct OptionsV5_2 {
log_opt: Vec<String>,
stop_signal: Option<String>,
network_alias: Vec<String>,
}

/// Container Quadlet options added in Podman v5.1.0
Expand Down

0 comments on commit 4f1096f

Please sign in to comment.