Skip to content

Commit

Permalink
Add tolerations for targetless agent.
Browse files Browse the repository at this point in the history
  • Loading branch information
meowjesty committed Jan 22, 2025
1 parent 57bdab5 commit 74f80b7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion mirrord/config/src/agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ pub struct AgentConfig {
/// ```json
/// [
/// {
/// "operator": "Exists"
/// "key": "meow", "operator": "Exists", "effect": "NoSchedule"
/// }
/// ]
/// ```
Expand Down
3 changes: 3 additions & 0 deletions mirrord/kube/src/api/container/job.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ pub struct JobVariant<T> {

impl<'c> JobVariant<PodVariant<'c>> {
pub fn new(agent: &'c AgentConfig, params: &'c ContainerParams) -> Self {
// TODO(alex) [high]: Here we also have agent config, which has tolerations.
// So why doesn't it propagate?
JobVariant {
inner: PodVariant::new(agent, params),
}
Expand Down Expand Up @@ -199,6 +201,7 @@ impl<'c> JobTargetedVariant<'c> {
params: &'c ContainerParams,
runtime_data: &'c RuntimeData,
) -> Self {
// TODO(alex) [high]: Here we have agent config, which has tolerations.
let inner = PodTargetedVariant::new(agent, params, runtime_data);

JobTargetedVariant {
Expand Down
3 changes: 3 additions & 0 deletions mirrord/kube/src/api/container/pod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ impl ContainerVariant for PodTargetedVariant<'_> {
let agent = self.agent_config();
let params = self.params();

let tolerations = agent.tolerations.as_ref().unwrap_or(&DEFAULT_TOLERATIONS);

let env = self.runtime_data.mesh.map(|mesh_vendor| {
let mut env = vec![EnvVar {
name: "MIRRORD_AGENT_IN_SERVICE_MESH".into(),
Expand All @@ -214,6 +216,7 @@ impl ContainerVariant for PodTargetedVariant<'_> {
let update = Pod {
spec: Some(PodSpec {
restart_policy: Some("Never".to_string()),
tolerations: Some(tolerations.clone()),
host_pid: Some(true),
node_name: Some(runtime_data.node_name.clone()),
volumes: Some(vec![
Expand Down

0 comments on commit 74f80b7

Please sign in to comment.