Skip to content

Commit

Permalink
Fixing host_gateway_ip to follow nerdctl standard
Browse files Browse the repository at this point in the history
Signed-off-by: TrungBui59 <[email protected]>
  • Loading branch information
TrungBui59 committed Sep 6, 2023
1 parent 65921b9 commit c540203
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ type Finch struct {
// Has no effect on systems where Rosetta 2 is not available (Intel/AMD64 macs, or macOS < 13.0).
// This setting will only be applied on vm init.
Rosetta *bool `yaml:"rosetta,omitempty"`
HostGatewayIp *string `yaml:"host_gateway_ip,omitempty"`
HostGatewayIP *string `yaml:"host_gateway_ip,omitempty"`
}

// Nerdctl is a copy from github.com/containerd/nerdctl/cmd/nerdctl/main.go
Expand Down
4 changes: 2 additions & 2 deletions pkg/config/nerdctl_config_applier.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ func updateNerdctlConfig(fc *Finch, fs afero.Fs, user string, rootless bool) err

cfg.Namespace = nerdctlNamespace
cfg.HostGatewayIP = "192.168.5.2"
if fc.HostGatewayIp != nil {
cfg.HostGatewayIP = *fc.HostGatewayIp
if fc.HostGatewayIP != nil {
cfg.HostGatewayIP = *fc.HostGatewayIP
}

updatedCfg, err := toml.Marshal(cfg)
Expand Down
2 changes: 1 addition & 1 deletion pkg/config/nerdctl_config_applier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ func Test_updateNerdctlConfig(t *testing.T) {
Memory: pointer.String("4GiB"),
VMType: pointer.String("qemu"),
Rosetta: pointer.Bool(false),
HostGatewayIp: pointer.String("192.168.31.1"),
HostGatewayIP: pointer.String("192.168.31.1"),
}
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
Expand Down

0 comments on commit c540203

Please sign in to comment.