-
Notifications
You must be signed in to change notification settings - Fork 521
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1955 from etungsten/registry-credentials
models, containerd, ecs-agent, host-ctr: support registry credentials
- Loading branch information
Showing
27 changed files
with
455 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[Unit] | ||
Description=Containerd Configuration Directory (/etc/containerd) | ||
DefaultDependencies=no | ||
Conflicts=umount.target | ||
Before=local-fs.target umount.target | ||
After=selinux-policy-files.service | ||
Wants=selinux-policy-files.service | ||
|
||
[Mount] | ||
What=tmpfs | ||
Where=/etc/containerd | ||
Type=tmpfs | ||
Options=nosuid,nodev,noexec,noatime,context=system_u:object_r:secret_t:s0 | ||
|
||
[Install] | ||
WantedBy=preconfigured.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,18 @@ | ||
ECS_LOGFILE=/var/log/ecs/ecs-agent.log | ||
ECS_LOGLEVEL="{{settings.ecs.loglevel}}" | ||
{{#if settings.container-registry.credentials~}} | ||
ECS_ENGINE_AUTH_TYPE=dockercfg | ||
ECS_ENGINE_AUTH_DATA='{ | ||
{{~#each settings.container-registry.credentials~}} | ||
{{~#unless @first~}},{{~/unless~}} | ||
{{~#if (eq registry "docker.io" )~}} | ||
"https://index.docker.io/v1/": | ||
{{~else~}} | ||
"{{registry}}": | ||
{{~/if~}} | ||
{"email": "." | ||
{{~#if auth~}},"auth": "{{{auth}}}"{{/if}} | ||
{{~#if username~}},"username": "{{{username}}}"{{/if}} | ||
{{~#if password~}},"password": "{{{password}}}"}{{/if}} | ||
{{~/each~}}}}' | ||
{{/if}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[Unit] | ||
Description=ECS agent Configuration Directory (/etc/ecs) | ||
DefaultDependencies=no | ||
Conflicts=umount.target | ||
Before=local-fs.target umount.target | ||
After=selinux-policy-files.service | ||
Wants=selinux-policy-files.service | ||
|
||
[Mount] | ||
What=tmpfs | ||
Where=/etc/ecs | ||
Type=tmpfs | ||
Options=nosuid,nodev,noexec,noatime,context=system_u:object_r:secret_t:s0 | ||
|
||
[Install] | ||
WantedBy=preconfigured.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[clarify."sigs.k8s.io/yaml"] | ||
expression = "MIT AND BSD-3-Clause" | ||
license-files = [ | ||
{ path = "LICENSE", hash = 0xcdf3ae00 }, | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[Unit] | ||
Description=Host containers Configuration Directory (/etc/host-containers) | ||
DefaultDependencies=no | ||
Conflicts=umount.target | ||
Before=local-fs.target umount.target | ||
After=selinux-policy-files.service | ||
Wants=selinux-policy-files.service | ||
|
||
[Mount] | ||
What=tmpfs | ||
Where=/etc/host-containers | ||
Type=tmpfs | ||
Options=nosuid,nodev,noexec,noatime,context=system_u:object_r:secret_t:s0 | ||
|
||
[Install] | ||
WantedBy=preconfigured.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
sources/api/migration/migrations/v1.6.2/container-registry-credentials-metadata/Cargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[package] | ||
name = "container-registry-credentials-metadata" | ||
version = "0.1.0" | ||
authors = ["Erikson Tung <etung@amazon.com>"] | ||
license = "Apache-2.0 OR MIT" | ||
edition = "2018" | ||
publish = false | ||
|
||
[dependencies] | ||
migration-helpers = { path = "../../../migration-helpers", version = "0.1.0"} |
31 changes: 31 additions & 0 deletions
31
sources/api/migration/migrations/v1.6.2/container-registry-credentials-metadata/src/main.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#![deny(rust_2018_idioms)] | ||
|
||
use migration_helpers::common_migrations::{AddMetadataMigration, SettingMetadata}; | ||
use migration_helpers::{migrate, Result}; | ||
use std::process; | ||
|
||
/// We added a new setting and `affected-services` metadata for `container-registry.credentials` | ||
/// We subdivided metadata for `container-registry` into `container-registry.mirrors` and `container-registry.credentials` | ||
/// This is for the docker variants where don't want to restart the docker daemon when credentials settings change. | ||
fn run() -> Result<()> { | ||
migrate(AddMetadataMigration(&[ | ||
SettingMetadata { | ||
metadata: &["affected-services"], | ||
setting: "settings.container-registry.credentials", | ||
}, | ||
SettingMetadata { | ||
metadata: &["affected-services"], | ||
setting: "settings.container-registry.mirrors", | ||
}, | ||
])) | ||
} | ||
|
||
// 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); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
sources/api/migration/migrations/v1.6.2/container-registry-credentials/Cargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[package] | ||
name = "container-registry-credentials" | ||
version = "0.1.0" | ||
authors = ["Erikson Tung <etung@amazon.com>"] | ||
license = "Apache-2.0 OR MIT" | ||
edition = "2018" | ||
publish = false | ||
|
||
[dependencies] | ||
migration-helpers = { path = "../../../migration-helpers", version = "0.1.0"} |
22 changes: 22 additions & 0 deletions
22
sources/api/migration/migrations/v1.6.2/container-registry-credentials/src/main.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#![deny(rust_2018_idioms)] | ||
|
||
use migration_helpers::common_migrations::AddPrefixesMigration; | ||
use migration_helpers::{migrate, Result}; | ||
use std::process; | ||
|
||
/// We added a new setting for configuring image credentials, `settings.container-registry.credentials` | ||
fn run() -> Result<()> { | ||
migrate(AddPrefixesMigration(vec![ | ||
"settings.container-registry.credentials", | ||
])) | ||
} | ||
|
||
// 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); | ||
} | ||
} |
Oops, something went wrong.