Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix network interface agent config not propagating to agent #2541

Merged
merged 4 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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";
Loading