Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions images/virtualization-artifact/pkg/common/network/spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,17 @@ func CreateNetworkSpec(vm *v1alpha2.VirtualMachine, vmmacs []*v1alpha2.VirtualMa
return specs
}

const deckhouseUID = 64535

func createMainInterfaceSpec(net v1alpha2.NetworksSpec) InterfaceSpec {
return InterfaceSpec{
ID: ptr.Deref(net.ID, 0),
Type: net.Type,
Name: net.Name,
InterfaceName: NameDefaultInterface,
MAC: "",
UID: deckhouseUID,
GID: deckhouseUID,
}
}

Expand All @@ -62,6 +66,8 @@ func createAdditionalInterfaceSpec(net v1alpha2.NetworksSpec, mac string) Interf
Name: net.Name,
InterfaceName: generateInterfaceName(mac, net.Type),
MAC: mac,
UID: deckhouseUID,
GID: deckhouseUID,
}
}

Expand Down
2 changes: 2 additions & 0 deletions images/virtualization-artifact/pkg/common/network/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ type InterfaceSpec struct {
Name string `json:"name"`
InterfaceName string `json:"ifName"`
MAC string `json:"-"`
UID int `json:"uid"`
GID int `json:"gid"`
}

type InterfaceStatus struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ var _ = Describe("Network types helpers", func() {
out, err := list.ToString()

Expect(err).ToNot(HaveOccurred())
Expect(out).To(Equal(`[{"id":2,"type":"Network","name":"n1","ifName":"veth_n12345678"}]`))
Expect(out).To(Equal(`[{"id":2,"type":"Network","name":"n1","ifName":"veth_n12345678","uid":0,"gid":0}]`))
})
})
})
Loading