Skip to content

Commit

Permalink
Add option to run agent container as privileged (#1808)
Browse files Browse the repository at this point in the history
* Add option to run agent container as privileged

* fix test
  • Loading branch information
aviramha committed Aug 18, 2023
1 parent a89700c commit e6d422e
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 0 deletions.
2 changes: 2 additions & 0 deletions changelog.d/1806.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Add option to run agent container as privileged - `"agent" : {"privileged": true}`
Should help with Bottlerocket or other secured k8s environments.
8 changes: 8 additions & 0 deletions mirrord-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,14 @@
"null"
]
},
"privileged": {
"title": "agent.privileged {#agent-privileged}",
"description": "Run the mirror agent as privileged container. (Not applicable when using ephemeral) Defaults to `false`.\n\nMight be needed in strict environments such as Bottlerocket.",
"type": [
"boolean",
"null"
]
},
"startup_timeout": {
"title": "agent.startup_timeout {#agent-startup_timeout}",
"description": "Controls how long to wait for the agent to finish initialization.\n\nIf initialization takes longer than this value, mirrord exits.\n\nDefaults to `60`.",
Expand Down
9 changes: 9 additions & 0 deletions mirrord/config/src/agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,15 @@ pub struct AgentConfig {
#[config(default = true)]
pub check_out_of_pods: bool,

/// ### agent.privileged {#agent-privileged}
///
/// Run the mirror agent as privileged container. (Not applicable when using ephemeral)
/// Defaults to `false`.
///
/// Might be needed in strict environments such as Bottlerocket.
#[config(default = false)]
pub privileged: bool,

/// <!--${internal}-->
/// Create an agent that returns an error after accepting the first client. For testing
/// purposes. Only supported with job agents (not with ephemeral agents).
Expand Down
1 change: 1 addition & 0 deletions mirrord/config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,7 @@ mod tests {
skip_processes: None,
skip_build_tools: None,
agent: Some(AgentFileConfig {
privileged: None,
log_level: Some("info".to_owned()),
namespace: Some("default".to_owned()),
image: Some("".to_owned()),
Expand Down
1 change: 1 addition & 0 deletions mirrord/kube/src/api/container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ impl ContainerApi for JobContainer {
"securityContext": targeted.then(||
json!({
"runAsGroup": agent_gid,
"privileged": agent.privileged,
"capabilities": {
"add": get_capabilities(agent),
}
Expand Down

0 comments on commit e6d422e

Please sign in to comment.