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

Add serviceAccount option to agent config #2877

Merged
merged 4 commits into from
Oct 28, 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
1 change: 1 addition & 0 deletions changelog.d/2876.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added serviceAccount option to agent config
8 changes: 8 additions & 0 deletions mirrord-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,14 @@
}
]
},
"service_account": {
"title": "agent.service_account {#agent-service_account}",
"description": "Allows setting up custom Service Account for the agent Job and Pod.\\\n\n```json { \"service_account\": \"my-service-account\" } ```",
"type": [
"string",
"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
4 changes: 4 additions & 0 deletions mirrord/config/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,10 @@ as targeted agent always runs on the same node as its target container.
}
```

### agent.service_account {#agent-service_account}

Allows setting up custom Service Account for the agent Job and Pod.

### agent.privileged {#agent-privileged}

Run the mirror agent as privileged container.
Expand Down
11 changes: 11 additions & 0 deletions mirrord/config/src/agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,17 @@ pub struct AgentConfig {
/// ```
pub node_selector: Option<HashMap<String, String>>,

/// ### agent.service_account {#agent-service_account}
///
/// Allows setting up custom Service Account for the agent Job and Pod.\
///
/// ```json
/// {
/// "service_account": "my-service-account"
/// }
/// ```
pub service_account: Option<String>,

/// <!--${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
2 changes: 2 additions & 0 deletions mirrord/kube/src/api/container/job.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ mod test {
"imagePullSecrets": agent.image_pull_secrets,
"nodeSelector": {},
"tolerations": *DEFAULT_TOLERATIONS,
"serviceAccountName": agent.service_account,
"containers": [
{
"name": "mirrord-agent",
Expand Down Expand Up @@ -403,6 +404,7 @@ mod test {
"imagePullSecrets": agent.image_pull_secrets,
"nodeSelector": {},
"tolerations": *DEFAULT_TOLERATIONS,
"serviceAccountName": agent.service_account,
"containers": [
{
"name": "mirrord-agent",
Expand Down
1 change: 1 addition & 0 deletions mirrord/kube/src/api/container/pod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ impl ContainerVariant for PodVariant<'_> {
image_pull_secrets,
tolerations: Some(tolerations.clone()),
node_selector: Some(node_selector),
service_account_name: agent.service_account.clone(),
containers: vec![Container {
name: "mirrord-agent".to_string(),
image: Some(agent.image().to_string()),
Expand Down
Loading