Skip to content

Commit 06c1bab

Browse files
committed
feat: support multiple network interfaces
* support zero or more NICs with configurable driver and network name * assume network already exists * update examples * network is no longer a mandatory parameter in machine class * bump all dependencies * closes: #17 Signed-off-by: Fritz Schaal <[email protected]>
1 parent e0852f6 commit 06c1bab

File tree

7 files changed

+242
-45
lines changed

7 files changed

+242
-45
lines changed

api/specs/specs.proto

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,19 @@ message AdditionalDisk {
88
string volName = 3;
99
}
1010

11+
message NetworkInterfaces {
12+
string driver = 1;
13+
string network = 2;
14+
}
15+
1116
// MachineSpec is stored in Omni in the infra provisioner state.
1217
message MachineSpec {
1318
string uuid = 1; // required?
1419
string schematic_id = 2;
1520
string talos_version = 3;
1621
string vm_vol_name = 10;
1722
repeated AdditionalDisk additional_disks = 11;
23+
repeated NetworkInterfaces network_interfaces = 12;
1824
string pool_name = 20;
1925
string vm_name = 21;
2026
}

cmd/omni-infra-provider-libvirt/data/schema.json

Lines changed: 43 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,22 @@
1010
"type": "integer",
1111
"minimum": 2048,
1212
"default": 4096,
13-
"description": "In MiB"
13+
"description": "Memory size MiB"
1414
},
1515
"disk_size": {
1616
"type": "integer",
1717
"minimum": 10,
1818
"default": 20,
19-
"description": "In GiB"
19+
"description": "Disk size in GiB"
2020
},
2121
"storage_pool": {
2222
"type": "string",
2323
"default": "default",
2424
"description": "libvirt storage pool name"
2525
},
26-
"network": {
27-
"type": "string",
28-
"default": "default",
29-
"description": "libvirt network name"
30-
},
3126
"additional_disks": {
3227
"type": "array",
33-
"description": "YAML format, list of {type: string, size: uint64}. type is either sata or nvme, size is GiB.",
28+
"description": "List of secondary disks.",
3429
"items": {
3530
"type": "object",
3631
"properties": {
@@ -46,21 +41,58 @@
4641
"type": "integer",
4742
"format": "uint64",
4843
"minimum": 10,
49-
"default": 20
44+
"default": 20,
45+
"description": "Disk size in GiB"
5046
}
5147
},
5248
"required": [
5349
"type",
5450
"size"
5551
]
5652
}
53+
},
54+
"network_interfaces": {
55+
"type": "array",
56+
"description": "List of network interfaces.",
57+
"default": [
58+
{
59+
"driver": "virtio",
60+
"network_name": "default",
61+
"physical_address": ""
62+
}
63+
],
64+
"items": {
65+
"type": "object",
66+
"properties": {
67+
"driver": {
68+
"type": "string",
69+
"enum": [
70+
"virtio",
71+
"e1000e"
72+
],
73+
"default": "virtio"
74+
},
75+
"physical_address": {
76+
"type": "string",
77+
"description": "MAC address. If empty or omitted, libvirt will assign one."
78+
},
79+
"network_name": {
80+
"type": "string",
81+
"description": "libvirt network name. Must exist, the provider will not create it.",
82+
"default": "default"
83+
}
84+
},
85+
"required": [
86+
"driver",
87+
"network_name"
88+
]
89+
}
5790
}
5891
},
5992
"required": [
6093
"cores",
6194
"memory",
6295
"disk_size",
63-
"storage_pool",
64-
"network"
96+
"storage_pool"
6597
]
6698
}

go.mod

Lines changed: 46 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/siderolabs/omni-infra-provider-libvirt
22

3-
go 1.25.3
3+
go 1.25.4
44

55
// forked go-yaml that introduces RawYAML interface, which can be used to populate YAML fields using bytes
66
// which are then encoded as a valid YAML blocks with proper indentation
@@ -21,67 +21,108 @@ require (
2121

2222
require (
2323
cel.dev/expr v0.25.1 // indirect
24+
cloud.google.com/go/compute/metadata v0.9.0 // indirect
25+
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.20.0 // indirect
26+
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.13.1 // indirect
27+
github.com/Azure/azure-sdk-for-go/sdk/internal v1.11.2 // indirect
28+
github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azcertificates v1.4.0 // indirect
29+
github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azkeys v1.4.0 // indirect
30+
github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.2.0 // indirect
31+
github.com/AzureAD/microsoft-authentication-library-for-go v1.6.0 // indirect
2432
github.com/ProtonMail/go-crypto v1.3.0 // indirect
2533
github.com/ProtonMail/go-mime v0.0.0-20230322103455-7d82a3887f2f // indirect
2634
github.com/ProtonMail/gopenpgp/v2 v2.9.0 // indirect
2735
github.com/adrg/xdg v0.5.3 // indirect
2836
github.com/antlr4-go/antlr/v4 v4.13.1 // indirect
37+
github.com/aws/aws-sdk-go-v2 v1.40.0 // indirect
38+
github.com/aws/aws-sdk-go-v2/config v1.32.2 // indirect
39+
github.com/aws/aws-sdk-go-v2/credentials v1.19.2 // indirect
40+
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.14 // indirect
41+
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.14 // indirect
42+
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.14 // indirect
43+
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4 // indirect
44+
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.3 // indirect
45+
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.14 // indirect
46+
github.com/aws/aws-sdk-go-v2/service/kms v1.49.1 // indirect
47+
github.com/aws/aws-sdk-go-v2/service/signin v1.0.2 // indirect
48+
github.com/aws/aws-sdk-go-v2/service/sso v1.30.5 // indirect
49+
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.10 // indirect
50+
github.com/aws/aws-sdk-go-v2/service/sts v1.41.2 // indirect
51+
github.com/aws/smithy-go v1.23.2 // indirect
2952
github.com/blang/semver/v4 v4.0.0 // indirect
3053
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
3154
github.com/cloudflare/circl v1.6.1 // indirect
3255
github.com/containerd/go-cni v1.1.13 // indirect
56+
github.com/containerd/stargz-snapshotter/estargz v0.18.1 // indirect
3357
github.com/containernetworking/cni v1.3.0 // indirect
58+
github.com/docker/cli v29.1.0+incompatible // indirect
59+
github.com/docker/distribution v2.8.3+incompatible // indirect
60+
github.com/docker/docker-credential-helpers v0.9.4 // indirect
3461
github.com/dustin/go-humanize v1.0.1 // indirect
62+
github.com/foxboron/go-uefi v0.0.0-20251010190908-d29549a44f29 // indirect
3563
github.com/gertd/go-pluralize v0.2.1 // indirect
64+
github.com/golang-jwt/jwt/v5 v5.3.0 // indirect
3665
github.com/google/btree v1.1.3 // indirect
3766
github.com/google/cel-go v0.26.1 // indirect
3867
github.com/google/go-cmp v0.7.0 // indirect
68+
github.com/google/go-containerregistry v0.20.7 // indirect
69+
github.com/google/go-tpm v0.9.7 // indirect
3970
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.3 // indirect
4071
github.com/hashicorp/errwrap v1.1.0 // indirect
4172
github.com/hashicorp/go-multierror v1.1.1 // indirect
4273
github.com/inconshreveable/mousetrap v1.1.0 // indirect
4374
github.com/jsimonetti/rtnetlink/v2 v2.1.0 // indirect
4475
github.com/jxskiss/base62 v1.1.0 // indirect
4576
github.com/klauspost/compress v1.18.1 // indirect
77+
github.com/kylelemons/godebug v1.1.0 // indirect
4678
github.com/mdlayher/ethtool v0.5.0 // indirect
4779
github.com/mdlayher/genetlink v1.3.2 // indirect
4880
github.com/mdlayher/netlink v1.8.0 // indirect
4981
github.com/mdlayher/socket v0.5.1 // indirect
82+
github.com/mitchellh/go-homedir v1.1.0 // indirect
5083
github.com/onsi/ginkgo/v2 v2.22.0 // indirect
5184
github.com/onsi/gomega v1.36.1 // indirect
85+
github.com/opencontainers/go-digest v1.0.0 // indirect
86+
github.com/opencontainers/image-spec v1.1.1 // indirect
5287
github.com/opencontainers/runtime-spec v1.3.0 // indirect
5388
github.com/petermattis/goid v0.0.0-20251121121749-a11dd1a45f9a // indirect
5489
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
5590
github.com/pkg/errors v0.9.1 // indirect
91+
github.com/pkg/xattr v0.4.12 // indirect
5692
github.com/ryanuber/go-glob v1.0.0 // indirect
5793
github.com/sasha-s/go-deadlock v0.3.6 // indirect
5894
github.com/siderolabs/crypto v0.6.4 // indirect
5995
github.com/siderolabs/gen v0.8.6 // indirect
6096
github.com/siderolabs/go-api-signature v0.3.12 // indirect
6197
github.com/siderolabs/go-pointer v1.0.1 // indirect
62-
github.com/siderolabs/image-factory v0.8.4 // indirect
98+
github.com/siderolabs/image-factory v0.9.0 // indirect
6399
github.com/siderolabs/net v0.4.0 // indirect
64100
github.com/siderolabs/proto-codec v0.1.2 // indirect
65101
github.com/siderolabs/protoenc v0.2.4 // indirect
66102
github.com/siderolabs/siderolink v0.3.15 // indirect
103+
github.com/siderolabs/talos v1.12.0-beta.0 // indirect
67104
github.com/siderolabs/talos/pkg/machinery v1.12.0-beta.0 // indirect
105+
github.com/sirupsen/logrus v1.9.4-0.20230606125235-dd1b4c2e81af // indirect
106+
github.com/spf13/afero v1.15.0 // indirect
68107
github.com/spf13/pflag v1.0.10 // indirect
69108
github.com/stoewer/go-strcase v1.3.1 // indirect
70109
github.com/stretchr/objx v0.5.2 // indirect
110+
github.com/vbatts/tar-split v0.12.2 // indirect
71111
go.uber.org/multierr v1.11.0 // indirect
72112
go.yaml.in/yaml/v4 v4.0.0-rc.3 // indirect
73113
go4.org/netipx v0.0.0-20231129151722-fdeea329fbba // indirect
74114
golang.org/x/crypto v0.45.0 // indirect
75-
golang.org/x/exp v0.0.0-20251113190631-e25ba8c21ef6 // indirect
115+
golang.org/x/exp v0.0.0-20251125195548-87e1e737ad39 // indirect
76116
golang.org/x/net v0.47.0 // indirect
117+
golang.org/x/oauth2 v0.33.0 // indirect
77118
golang.org/x/sync v0.18.0 // indirect
78119
golang.org/x/sys v0.38.0 // indirect
79120
golang.org/x/text v0.31.0 // indirect
80121
golang.org/x/time v0.14.0 // indirect
81122
golang.zx2c4.com/wintun v0.0.0-20230126152724-0fa3db229ce2 // indirect
82123
golang.zx2c4.com/wireguard v0.0.0-20250521234502-f333402bd9cb // indirect
83124
golang.zx2c4.com/wireguard/wgctrl v0.0.0-20241231184526-a9ab2273dd10 // indirect
84-
google.golang.org/genproto/googleapis/api v0.0.0-20251111163417-95abcf5c77ba // indirect
85-
google.golang.org/genproto/googleapis/rpc v0.0.0-20251111163417-95abcf5c77ba // indirect
125+
google.golang.org/genproto/googleapis/api v0.0.0-20251124214823-79d6a2a48846 // indirect
126+
google.golang.org/genproto/googleapis/rpc v0.0.0-20251124214823-79d6a2a48846 // indirect
86127
google.golang.org/grpc v1.77.0 // indirect
87128
)

0 commit comments

Comments
 (0)