Skip to content

Commit c776ff1

Browse files
committed
Put ipv6 behind a platform prop
1 parent f709751 commit c776ff1

File tree

4 files changed

+16
-3
lines changed

4 files changed

+16
-3
lines changed

enterprise/server/remote_execution/containers/firecracker/firecracker.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,7 @@ func (p *Provider) New(ctx context.Context, args *container.Init) (container.Com
589589
EnableDockerdTcp: args.Props.EnableDockerdTCP,
590590
HostCpuid: getCPUID(),
591591
EnableVfs: args.Props.EnableVFS,
592+
Ipv6Enabled: args.Props.NetworkEnableIPv6,
592593
}
593594
vmConfig.BootArgs = getBootArgs(vmConfig)
594595
opts := ContainerOpts{
@@ -1621,8 +1622,7 @@ func getBootArgs(vmConfig *fcpb.VMConfiguration) string {
16211622
"i8042.dumbkbd",
16221623
"tsc=reliable",
16231624
}
1624-
if runtime.GOARCH != "amd64" {
1625-
// TODO(bduffany): update arm64 image and enable ipv6 on arm64 as well.
1625+
if !vmConfig.GetIpv6Enabled() {
16261626
kernelArgs = append(kernelArgs, "ipv6.disable=1")
16271627
}
16281628
if networkingEnabled(vmConfig.NetworkMode) {

enterprise/server/remote_execution/containers/firecracker/firecracker_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2507,14 +2507,18 @@ func TestFirecrackerRunWithIPv6Enabled(t *testing.T) {
25072507
NumCpus: 1,
25082508
MemSizeMb: 2500,
25092509
NetworkMode: fcpb.NetworkMode_NETWORK_MODE_EXTERNAL,
2510+
Ipv6Enabled: true,
25102511
ScratchDiskSizeMb: 100,
25112512
},
25122513
ExecutorConfig: getExecutorConfig(t),
25132514
}
25142515
c, err := firecracker.NewContainer(ctx, env, &repb.ExecutionTask{}, opts)
25152516
require.NoError(t, err)
2517+
t.Cleanup(func() {
2518+
err := c.Remove(ctx)
2519+
require.NoError(t, err)
2520+
})
25162521

2517-
// Run will handle the full lifecycle: no need to call Remove() here.
25182522
res := c.Run(ctx, cmd, opts.ActionWorkingDirectory, oci.Credentials{})
25192523
require.NoError(t, res.Error)
25202524
assert.Equal(t, 0, res.ExitCode)

proto/firecracker.proto

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ message VMConfiguration {
3939
// Network mode for this VM.
4040
NetworkMode network_mode = 18;
4141

42+
// Whether IPv6 should be enabled in the guest.
43+
bool ipv6_enabled = 19;
44+
4245
bool init_dockerd = 5;
4346
bool debug_mode = 6;
4447
bool enable_dockerd_tcp = 7;

server/util/platform/platform.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,10 @@ const (
145145
// will have "external" network access (for backwards compatibility).
146146
networkPropertyName = "network"
147147

148+
// NetworkEnableIPv6PropertyName specifies whether Firecracker guests should
149+
// boot with IPv6 enabled.
150+
NetworkEnableIPv6PropertyName = "network-enable-ipv6"
151+
148152
// A BuildBuddy Compute Unit is defined as 1 cpu and 2.5GB of memory.
149153
EstimatedComputeUnitsPropertyName = "EstimatedComputeUnits"
150154

@@ -241,6 +245,7 @@ type Properties struct {
241245
DockerNetwork string
242246
ExecrootPath string
243247
Network string
248+
NetworkEnableIPv6 bool
244249
RecycleRunner bool
245250
RunnerRecyclingMaxWait time.Duration
246251

@@ -517,6 +522,7 @@ func ParseProperties(task *repb.ExecutionTask) (*Properties, error) {
517522
DockerNetwork: stringProp(m, dockerNetworkPropertyName, ""),
518523
ExecrootPath: stringProp(m, execrootPathPropertyName, ""),
519524
Network: stringProp(m, networkPropertyName, ""),
525+
NetworkEnableIPv6: boolProp(m, NetworkEnableIPv6PropertyName, false),
520526
RecycleRunner: recycleRunner,
521527
DefaultTimeout: timeout,
522528
TerminationGracePeriod: terminationGracePeriod,

0 commit comments

Comments
 (0)