Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Passt Network Binding Plugin for IPv6 environments. #3

Closed
wants to merge 3 commits into from
Closed
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
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,23 @@ Note: Store the service account key securely, it will not be displayed again
Create a service account kubeconfig for your KubeVirt cluster.
Store it in `kubeconfig` file.

If you are using `--data-volume-mode=Filesystem` (which is the default), make sure to enable the `ExpandDisks` featuregate in KubeVirt, e.g.:
```yaml
apiVersion: kubevirt.io/v1
kind: KubeVirt
spec:
configuration:
developerConfiguration:
featureGates:
- ExpandDisks
```

By default VMs will use the bridge network binding mode. In IPv6 environments you might want to use [passt](https://kubevirt.io/user-guide/network/net_binding_plugins/passt/) instead. Make sure to set the provider configuration in your MachineClass accordingly.

### Using Docker

```bash
docker run -it -d -v ./kubeconfig:/kubeconfig ghcr.io/siderolabs/omni-infra-provider-kubevirt --kubeconfig /kubeconfig --kubeconfig kubeconfig --omni-api-endpoint https://<account-name>.omni.siderolabs.io/ --key <service-account-key>
docker run -it -d -v ./kubeconfig:/kubeconfig ghcr.io/siderolabs/omni-infra-provider-kubevirt --kubeconfig-file /kubeconfig --omni-api-endpoint https://<account-name>.omni.siderolabs.io/ --omni-service-account-key <service-account-key> --data-volume-mode=Filesystem
```

### Using Executable
Expand All @@ -36,5 +49,5 @@ make omni-infra-provider-linux-amd64
Run the executable:

```bash
_out/omni-infra-provider-linux-amd64 --kubeconfig kubeconfig --omni-api-endpoint https://<account-name>.omni.siderolabs.io/ --key <service-account-key>
_out/omni-infra-provider-linux-amd64 --kubeconfig kubeconfig-file --omni-api-endpoint https://<account-name>.omni.siderolabs.io/ --omni-service-account-key <service-account-key> --data-volume-mode=Filesystem
```
4 changes: 4 additions & 0 deletions cmd/omni-infra-provider-kubevirt/data/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
"type": "integer",
"minimum": 5,
"description": "In GB"
},
"network_binding": {
"enum": ["bridge", "passt"],
"default": "bridge"
}
},
"required": [
Expand Down
9 changes: 5 additions & 4 deletions internal/pkg/provider/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ package provider

// Data is the provider custom machine config.
type Data struct {
Architecture string `yaml:"architecture"`
Cores int `yaml:"cores"`
DiskSize int `yaml:"disk_size"`
Memory uint64 `yaml:"memory"`
Architecture string `yaml:"architecture"`
Cores int `yaml:"cores"`
DiskSize int `yaml:"disk_size"`
Memory uint64 `yaml:"memory"`
NetworkBinding string `yaml:"network_binding,omitempty"`
}
17 changes: 17 additions & 0 deletions internal/pkg/provider/provision.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,20 @@ func (p *Provisioner) ProvisionSteps() []provision.Step[*resources.Machine] {

vm.Spec.Template.Spec.Domain.Resources.Requests[v1.ResourceMemory] = *resource.NewQuantity(int64(data.Memory)*1024*1024, resource.DecimalSI)

vm.Spec.Template.Spec.Networks = []kvv1.Network{
*kvv1.DefaultPodNetwork(),
}

networkInterface := *kvv1.DefaultBridgeNetworkInterface()
if data.NetworkBinding == "passt" {
networkInterface = kvv1.Interface{
Name: networkInterface.Name,
Binding: &kvv1.PluginBinding{
Name: "passt",
},
}
}

vm.Spec.Template.Spec.Domain.Devices = kvv1.Devices{
Disks: []kvv1.Disk{
{
Expand All @@ -229,6 +243,9 @@ func (p *Provisioner) ProvisionSteps() []provision.Step[*resources.Machine] {
},
},
},
Interfaces: []kvv1.Interface{
networkInterface,
},
}

vm.Spec.Template.Spec.Volumes = []kvv1.Volume{
Expand Down