@@ -100,13 +100,21 @@ pub struct ImageConfig {
100
100
#[ serde( default = "default_max_concurrent_layer_downloads_per_image" ) ]
101
101
pub max_concurrent_layer_downloads_per_image : usize ,
102
102
103
- /// Proxy that will be used to pull image
103
+ /// HTTPS proxy that will be used to pull image
104
104
///
105
105
/// If a registry is not accessible to the guest, you can try
106
106
/// pulling an image through a proxy specified here.
107
107
///
108
108
/// This value defaults to `None`.
109
- pub image_pull_proxy : Option < String > ,
109
+ pub https_proxy : Option < String > ,
110
+
111
+ /// HTTP proxy that will be used to pull image
112
+ ///
113
+ /// If a registry is not accessible to the guest, you can try
114
+ /// pulling an image through a proxy specified here.
115
+ ///
116
+ /// This value defaults to `None`.
117
+ pub http_proxy : Option < String > ,
110
118
111
119
/// If the above proxy is enabled, this field can be used to list IPs
112
120
/// that will bypass the proxy.
@@ -117,7 +125,7 @@ pub struct ImageConfig {
117
125
/// If `image_pull_proxy` is not set, this field will do nothing.
118
126
///
119
127
/// This value defaults to `None`.
120
- pub skip_proxy_ips : Option < String > ,
128
+ pub no_proxy : Option < String > ,
121
129
122
130
/// To pull an image from a registry with a self-signed ceritifcate,
123
131
/// supply the corresponding trusted root cert (in PEM format) here.
@@ -174,8 +182,9 @@ impl Default for ImageConfig {
174
182
sigstore_config_uri : None ,
175
183
authenticated_registry_credentials_uri : None ,
176
184
registry_configuration_uri : None ,
177
- image_pull_proxy : None ,
178
- skip_proxy_ips : None ,
185
+ http_proxy : None ,
186
+ https_proxy : None ,
187
+ no_proxy : None ,
179
188
extra_root_certificates : Vec :: new ( ) ,
180
189
181
190
#[ cfg( feature = "keywrap-native" ) ]
@@ -190,6 +199,7 @@ impl Default for ImageConfig {
190
199
#[ derive( PartialEq , Debug ) ]
191
200
struct KernelParameterConfigs {
192
201
https_proxy : Option < String > ,
202
+ http_proxy : Option < String > ,
193
203
no_proxy : Option < String > ,
194
204
authenticated_registry_credentials_uri : Option < String > ,
195
205
image_security_policy_uri : Option < String > ,
@@ -205,6 +215,7 @@ impl KernelParameterConfigs {
205
215
206
216
Self {
207
217
https_proxy : cmdline. get ( "agent.https_proxy" ) . map ( |s| s. to_string ( ) ) ,
218
+ http_proxy : cmdline. get ( "agent.http_proxy" ) . map ( |s| s. to_string ( ) ) ,
208
219
no_proxy : cmdline. get ( "agent.no_proxy" ) . map ( |s| s. to_string ( ) ) ,
209
220
authenticated_registry_credentials_uri : cmdline
210
221
. get ( "agent.image_registry_auth" )
@@ -259,8 +270,9 @@ impl ImageConfig {
259
270
sigstore_config_uri : None ,
260
271
authenticated_registry_credentials_uri : None ,
261
272
registry_configuration_uri : None ,
262
- image_pull_proxy : None ,
263
- skip_proxy_ips : None ,
273
+ http_proxy : None ,
274
+ https_proxy : None ,
275
+ no_proxy : None ,
264
276
extra_root_certificates : Vec :: new ( ) ,
265
277
266
278
#[ cfg( feature = "keywrap-native" ) ]
@@ -273,8 +285,9 @@ impl ImageConfig {
273
285
if let Ok ( kernel_cmdline) = fs:: read_to_string ( "/proc/cmdline" ) {
274
286
debug ! ( "Try read image pull parameters from kernel cmdline" ) ;
275
287
let parameters_from_kernel = KernelParameterConfigs :: new ( & kernel_cmdline) ;
276
- res. image_pull_proxy = parameters_from_kernel. https_proxy ;
277
- res. skip_proxy_ips = parameters_from_kernel. no_proxy ;
288
+ res. https_proxy = parameters_from_kernel. https_proxy ;
289
+ res. http_proxy = parameters_from_kernel. http_proxy ;
290
+ res. no_proxy = parameters_from_kernel. no_proxy ;
278
291
res. authenticated_registry_credentials_uri =
279
292
parameters_from_kernel. authenticated_registry_credentials_uri ;
280
293
if parameters_from_kernel. enable_signature_verification {
@@ -449,6 +462,7 @@ mod tests {
449
462
"BOOT_IMAGE=/boot/vmlinuz-6.2.0-060200-generic root=UUID=f601123 ro vga=792 console=tty0 console=ttyS0,115200n8 agent.https_proxy=http://1.2.3.4:1234" ,
450
463
KernelParameterConfigs {
451
464
https_proxy: Some ( "http://1.2.3.4:1234" . into( ) ) ,
465
+ http_proxy: None ,
452
466
no_proxy: None ,
453
467
authenticated_registry_credentials_uri: None ,
454
468
image_security_policy_uri: None ,
@@ -459,6 +473,7 @@ mod tests {
459
473
BOOT_IMAGE=/boot/vmlinuz-6.2.0-060200-generic agent.no_proxy=localhost root=UUID=f601123 ro vga=792 console=tty0 console=ttyS0,115200n8 agent.https_proxy=http://1.2.3.4:1234" ,
460
474
KernelParameterConfigs {
461
475
https_proxy: Some ( "http://1.2.3.4:1234" . into( ) ) ,
476
+ http_proxy: None ,
462
477
no_proxy: Some ( "localhost" . into( ) ) ,
463
478
authenticated_registry_credentials_uri: None ,
464
479
image_security_policy_uri: None ,
@@ -469,6 +484,7 @@ mod tests {
469
484
BOOT_IMAGE=/boot/vmlinuz-6.2.0-060200-generic agent.no_proxy=localhost \n agent.image_registry_auth=kbs:///default/credentials/test root=UUID=f601123 ro vga=792 console=tty0 console=ttyS0,115200n8 agent.https_proxy=http://1.2.3.4:1234" ,
470
485
KernelParameterConfigs {
471
486
https_proxy: Some ( "http://1.2.3.4:1234" . into( ) ) ,
487
+ http_proxy: None ,
472
488
no_proxy: Some ( "localhost" . into( ) ) ,
473
489
authenticated_registry_credentials_uri: Some ( "kbs:///default/credentials/test" . into( ) ) ,
474
490
image_security_policy_uri: None ,
@@ -479,6 +495,7 @@ mod tests {
479
495
agent.no_proxy=localhost \n agent.image_registry_auth=file:///root/.docker/config.json agent.https_proxy=http://1.2.3.4:1234" ,
480
496
KernelParameterConfigs {
481
497
https_proxy: Some ( "http://1.2.3.4:1234" . into( ) ) ,
498
+ http_proxy: None ,
482
499
no_proxy: Some ( "localhost" . into( ) ) ,
483
500
authenticated_registry_credentials_uri: Some ( "file:///root/.docker/config.json" . into( ) ) ,
484
501
image_security_policy_uri: None ,
@@ -489,6 +506,7 @@ mod tests {
489
506
BOOT_IMAGE=/boot/vmlinuz-6.2.0-060200-generic agent.no_proxy=localhost agent.image_policy_file=kbs:///default/image-policy/test \n agent.image_registry_auth=kbs:///a/b/c root=UUID=f601123 ro vga=792 console=tty0 console=ttyS0,115200n8 agent.https_proxy=http://1.2.3.4:1234" ,
490
507
KernelParameterConfigs {
491
508
https_proxy: Some ( "http://1.2.3.4:1234" . into( ) ) ,
509
+ http_proxy: None ,
492
510
no_proxy: Some ( "localhost" . into( ) ) ,
493
511
authenticated_registry_credentials_uri: Some ( "kbs:///a/b/c" . into( ) ) ,
494
512
image_security_policy_uri: Some ( "kbs:///default/image-policy/test" . into( ) ) ,
@@ -499,6 +517,7 @@ mod tests {
499
517
BOOT_IMAGE=/boot/vmlinuz-6.2.0-060200-generic agent.no_proxy=localhost agent.image_policy_file=file:///etc/image-policy.json \n agent.image_registry_auth=kbs:///a/b/c root=UUID=f601123 ro vga=792 console=tty0 console=ttyS0,115200n8 agent.https_proxy=http://1.2.3.4:1234" ,
500
518
KernelParameterConfigs {
501
519
https_proxy: Some ( "http://1.2.3.4:1234" . into( ) ) ,
520
+ http_proxy: None ,
502
521
no_proxy: Some ( "localhost" . into( ) ) ,
503
522
authenticated_registry_credentials_uri: Some ( "kbs:///a/b/c" . into( ) ) ,
504
523
image_security_policy_uri: Some ( "file:///etc/image-policy.json" . into( ) ) ,
@@ -509,6 +528,18 @@ mod tests {
509
528
agent.enable_signature_verification=true agent.no_proxy=localhost agent.image_policy_file=file:///etc/image-policy.json \n agent.image_registry_auth=kbs:///a/b/c agent.https_proxy=http://1.2.3.4:1234" ,
510
529
KernelParameterConfigs {
511
530
https_proxy: Some ( "http://1.2.3.4:1234" . into( ) ) ,
531
+ http_proxy: None ,
532
+ no_proxy: Some ( "localhost" . into( ) ) ,
533
+ authenticated_registry_credentials_uri: Some ( "kbs:///a/b/c" . into( ) ) ,
534
+ image_security_policy_uri: Some ( "file:///etc/image-policy.json" . into( ) ) ,
535
+ enable_signature_verification: true
536
+ }
537
+ ) ]
538
+ #[ case( "
539
+ agent.enable_signature_verification=true agent.no_proxy=localhost agent.image_policy_file=file:///etc/image-policy.json \n agent.image_registry_auth=kbs:///a/b/c agent.https_proxy=http://1.2.3.4:1234 agent.http_proxy=http://1.2.3.4:1234" ,
540
+ KernelParameterConfigs {
541
+ https_proxy: Some ( "http://1.2.3.4:1234" . into( ) ) ,
542
+ http_proxy: Some ( "http://1.2.3.4:1234" . into( ) ) ,
512
543
no_proxy: Some ( "localhost" . into( ) ) ,
513
544
authenticated_registry_credentials_uri: Some ( "kbs:///a/b/c" . into( ) ) ,
514
545
image_security_policy_uri: Some ( "file:///etc/image-policy.json" . into( ) ) ,
0 commit comments