Skip to content

Commit

Permalink
fix network interface agent config not propagating to agent (#2541)
Browse files Browse the repository at this point in the history
* fix network interface agent config not propagating to agent

* ..

* fix

* protocol bump
  • Loading branch information
aviramha authored Jun 20, 2024
1 parent 639d5e4 commit 156b800
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions changelog.d/2539.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix network interface configuration not propagating to agent
4 changes: 2 additions & 2 deletions mirrord/agent/src/cli.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![deny(missing_docs)]

use clap::{Parser, Subcommand};
use mirrord_protocol::{MeshVendor, AGENT_OPERATOR_CERT_ENV};
use mirrord_protocol::{MeshVendor, AGENT_NETWORK_INTERFACE_ENV, AGENT_OPERATOR_CERT_ENV};

const DEFAULT_RUNTIME: &str = "containerd";

Expand All @@ -23,7 +23,7 @@ pub struct Args {
pub communication_timeout: u16,

/// Interface to use
#[arg(short = 'i', long)]
#[arg(short = 'i', long, env = AGENT_NETWORK_INTERFACE_ENV)]
pub network_interface: Option<String>,

/// Return an error after accepting the first client connection, in order to test agent error
Expand Down
5 changes: 4 additions & 1 deletion mirrord/kube/src/api/container/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use futures::{AsyncBufReadExt, TryStreamExt};
use k8s_openapi::api::core::v1::{EnvVar, Pod, Toleration};
use kube::{api::LogParams, Api};
use mirrord_config::agent::{AgentConfig, LinuxCapability};
use mirrord_protocol::AGENT_OPERATOR_CERT_ENV;
use mirrord_protocol::{AGENT_NETWORK_INTERFACE_ENV, AGENT_OPERATOR_CERT_ENV};
use regex::Regex;
use tracing::warn;

Expand Down Expand Up @@ -56,6 +56,9 @@ pub(super) fn agent_env(agent: &AgentConfig, params: &&ContainerParams) -> Vec<E
));
}

if let Some(interface) = agent.network_interface.as_ref() {
env.push((AGENT_NETWORK_INTERFACE_ENV.to_string(), interface.into()));
}
if let Some(timeout) = agent.dns.timeout {
env.push(("MIRRORD_AGENT_DNS_TIMEOUT".to_string(), timeout.to_string()));
};
Expand Down
2 changes: 1 addition & 1 deletion mirrord/protocol/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mirrord-protocol"
version = "1.6.0"
version = "1.6.1"
authors.workspace = true
description.workspace = true
documentation.workspace = true
Expand Down
2 changes: 2 additions & 0 deletions mirrord/protocol/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,5 @@ impl FromStr for MeshVendor {
/// This may not be the best place to put this name, but this is the only crate shared by
/// `mirrord-kube` and `mirrord-agent`.
pub const AGENT_OPERATOR_CERT_ENV: &str = "MIRRORD_AGENT_OPERATOR_CERT";

pub const AGENT_NETWORK_INTERFACE_ENV: &str = "MIRRORD_AGENT_INTERFACE";

0 comments on commit 156b800

Please sign in to comment.