Skip to content

Commit

Permalink
Merge pull request #3749 from arnaldo2792/ecs-settings
Browse files Browse the repository at this point in the history
Add additional ECS settings
  • Loading branch information
arnaldo2792 authored Jan 31, 2024
2 parents 14656bf + b6194cb commit 78cd27a
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 2 deletions.
3 changes: 3 additions & 0 deletions Release.toml
Original file line number Diff line number Diff line change
Expand Up @@ -261,3 +261,6 @@ version = "1.18.0"
"migrate_v1.18.0_aws-control-container-v0-7-7.lz4",
"migrate_v1.18.0_public-control-container-v0-7-7.lz4",
]
"(1.18.0, 1.19.0)" = [
"migrate_v1.19.0_add-additional-ecs-settings.lz4",
]
6 changes: 6 additions & 0 deletions packages/ecs-agent/ecs.config
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,9 @@ ECS_IMAGE_CLEANUP_INTERVAL="{{settings.ecs.image-cleanup-wait}}"
{{# if settings.ecs.image-cleanup-age}}
ECS_IMAGE_MINIMUM_CLEANUP_AGE="{{settings.ecs.image-cleanup-age}}"
{{/if}}
{{#if settings.ecs.backend-host}}
ECS_BACKEND_HOST="{{settings.ecs.backend-host}}"
{{/if}}
{{#if settings.ecs.awsvpc-block-imds}}
ECS_AWSVPC_BLOCK_IMDS="{{settings.ecs.awsvpc-block-imds}}"
{{/if}}
4 changes: 2 additions & 2 deletions packages/ecs-agent/ecs.service
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ Wants=network-online.target configured.target

[Service]
Type=simple
Restart=on-failure
Restart=always
RestartPreventExitStatus=5
RestartSec=1s
RestartSec=5
EnvironmentFile=-/etc/ecs/ecs.config
EnvironmentFile=/etc/network/proxy.env
Environment=ECS_CHECKPOINT=true
Expand Down
7 changes: 7 additions & 0 deletions sources/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 sources/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ members = [
"api/migration/migrations/v1.18.0/public-admin-container-v0-11-3",
"api/migration/migrations/v1.18.0/aws-control-container-v0-7-7",
"api/migration/migrations/v1.18.0/public-control-container-v0-7-7",
"api/migration/migrations/v1.19.0/add-additional-ecs-settings",

"bloodhound",

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[package]
name = "add-additional-ecs-settings"
version = "0.1.0"
authors = ["Arnaldo Garcia Rincon <[email protected]>"]
license = "Apache-2.0 OR MIT"
edition = "2021"
publish = false
# Don't rebuild crate just because of changes to README.
exclude = ["README.md"]

[dependencies]
migration-helpers = { path = "../../../migration-helpers", version = "0.1.0"}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
use migration_helpers::common_migrations::AddSettingsMigration;
use migration_helpers::{migrate, Result};
use std::process;

/// We added additional configurations for the ECS agent
fn run() -> Result<()> {
migrate(AddSettingsMigration(&[
"settings.ecs.backend-host",
"settings.ecs.awsvpc-block-imds",
]))
}

// Returning a Result from main makes it print a Debug representation of the error, but with Snafu
// we have nice Display representations of the error, so we wrap "main" (run) and print any error.
// https://github.com/shepmaster/snafu/issues/110
fn main() {
if let Err(e) = run() {
eprintln!("{}", e);
process::exit(1);
}
}
2 changes: 2 additions & 0 deletions sources/models/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,8 @@ struct ECSSettings {
image_cleanup_delete_per_cycle: i64,
image_cleanup_enabled: bool,
image_cleanup_age: ECSDurationValue,
backend_host: String,
awsvpc_block_imds: bool,
}

#[model]
Expand Down

0 comments on commit 78cd27a

Please sign in to comment.