Skip to content

Commit

Permalink
aws-ecs-1: add configurable logging drivers
Browse files Browse the repository at this point in the history
The new ecs.logging-drivers setting controls the list of logging drivers
available for use with ECS.  The defaults are "json-file", "awslogs", and
"none".  Other logging drivers (such as those installed via a plugin) can be
enabled.  The default set of logging drivers can be reduced or removed to
implement policy for allowable logging drivers in a cluster.
  • Loading branch information
samuelkarp committed Jul 30, 2020
1 parent 03d5622 commit 9b7955a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
9 changes: 9 additions & 0 deletions sources/api/ecs-settings-applier/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ struct ECSConfig {

#[serde(skip_serializing_if = "Option::is_none")]
privileged_disabled: Option<bool>,

#[serde(skip_serializing_if = "std::vec::Vec::is_empty")]
available_logging_drivers: Vec<String>,
}

// Returning a Result from main makes it print a Debug representation of the error, but with Snafu
Expand Down Expand Up @@ -58,6 +61,12 @@ fn run() -> Result<()> {
let mut config = ECSConfig {
cluster: ecs.cluster,
privileged_disabled: ecs.allow_privileged_containers.map(|s| !s),
available_logging_drivers: ecs
.logging_drivers
.unwrap_or_default()
.iter()
.map(|s| s.to_string())
.collect(),
..Default::default()
};
if let Some(os) = settings.os {
Expand Down
1 change: 1 addition & 0 deletions sources/models/src/aws-ecs-1/override-defaults.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ affected-services = ["ecs"]

[settings.ecs]
allow-privileged-containers = false
logging-drivers = ["json-file", "awslogs", "none"]
1 change: 1 addition & 0 deletions sources/models/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ struct ECSSettings {
cluster: String,
instance_attributes: HashMap<ECSAttributeKey, ECSAttributeValue>,
allow_privileged_containers: bool,
logging_drivers: Vec<SingleLineString>,
}

// Update settings. Taken from userdata. The 'seed' setting is generated
Expand Down

0 comments on commit 9b7955a

Please sign in to comment.