@@ -61,7 +61,7 @@ type Config struct {
6161 TotalDiskSizeMB int64
6262 HugePages bool
6363
64- AllowInternetAccess * bool
64+ Firewall * orchestrator. SandboxFirewallConfig
6565
6666 Envd EnvdMetadata
6767}
@@ -185,13 +185,7 @@ func (f *Factory) CreateSandbox(
185185 }
186186 }()
187187
188- // TODO: Temporarily set this based on global config, should be removed later (it should be passed as a parameter in build)
189- allowInternet := f .config .AllowSandboxInternet
190- if config .AllowInternetAccess != nil {
191- allowInternet = * config .AllowInternetAccess
192- }
193-
194- ipsCh := getNetworkSlotAsync (ctx , f .networkPool , cleanup , allowInternet )
188+ ipsCh := getNetworkSlotAsync (ctx , f .networkPool , cleanup , config .Firewall )
195189 defer func () {
196190 // Ensure the slot is received from chan so the slot is cleaned up properly in cleanup
197191 <- ipsCh
@@ -373,14 +367,7 @@ func (f *Factory) ResumeSandbox(
373367 }
374368 }()
375369
376- // TODO: Temporarily set this based on global config, should be removed later
377- // (it should be passed as a non nil parameter from API)
378- allowInternet := f .config .AllowSandboxInternet
379- if config .AllowInternetAccess != nil {
380- allowInternet = * config .AllowInternetAccess
381- }
382-
383- ipsCh := getNetworkSlotAsync (ctx , f .networkPool , cleanup , allowInternet )
370+ ipsCh := getNetworkSlotAsync (ctx , f .networkPool , cleanup , config .Firewall )
384371 defer func () {
385372 // Ensure the slot is received from chan before ResumeSandbox returns so the slot is cleaned up properly in cleanup
386373 <- ipsCh
@@ -915,7 +902,7 @@ func getNetworkSlotAsync(
915902 ctx context.Context ,
916903 networkPool * network.Pool ,
917904 cleanup * Cleanup ,
918- allowInternet bool ,
905+ firewall * orchestrator. SandboxFirewallConfig ,
919906) chan networkSlotRes {
920907 ctx , span := tracer .Start (ctx , "get-network-slot" )
921908 defer span .End ()
@@ -925,7 +912,7 @@ func getNetworkSlotAsync(
925912 go func () {
926913 defer close (r )
927914
928- ips , err := networkPool .Get (ctx , allowInternet )
915+ ips , err := networkPool .Get (ctx , firewall )
929916 if err != nil {
930917 r <- networkSlotRes {nil , fmt .Errorf ("failed to get network slot: %w" , err )}
931918
0 commit comments