mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-28 03:42:09 +00:00
agent: image: Set image-rs auth config
If the agent-config has a value for `image_registry_auth`, Then pass this to the image-rs client and enable auth mode too Fixes: #8122 Signed-off-by: Magnus Kulke <magnuskulke@microsoft.com> Signed-off-by: stevenhorsman <steven@uk.ibm.com>
This commit is contained in:
parent
265322990a
commit
7cc81ce867
@ -54,9 +54,16 @@ pub struct ImageService {
|
||||
|
||||
impl ImageService {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
image_client: ImageClient::new(PathBuf::from(KATA_IMAGE_WORK_DIR)),
|
||||
let mut image_client = ImageClient::new(PathBuf::from(KATA_IMAGE_WORK_DIR));
|
||||
#[cfg(feature = "guest-pull")]
|
||||
if !AGENT_CONFIG.image_registry_auth.is_empty() {
|
||||
let registry_auth = &AGENT_CONFIG.image_registry_auth;
|
||||
debug!(sl(), "Set registry auth file {:?}", registry_auth);
|
||||
image_client.config.file_paths.auth_file = registry_auth.clone();
|
||||
image_client.config.auth = true;
|
||||
}
|
||||
|
||||
Self { image_client }
|
||||
}
|
||||
|
||||
/// pause image is packaged in rootfs
|
||||
|
Loading…
Reference in New Issue
Block a user