Skip to content

Commit

Permalink
Add static up support for KubeVirt in KubeOVN (#1851)
Browse files Browse the repository at this point in the history
* add static up support for KubeVirt in KubeOVN

* fix unit tests

Signed-off-by: moadqassem <moad.qassem@gmail.com>

---------

Signed-off-by: moadqassem <moad.qassem@gmail.com>
  • Loading branch information
moadqassem authored Aug 28, 2024
1 parent 62bda97 commit 24e281f
Show file tree
Hide file tree
Showing 13 changed files with 28 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/cloudprovider/provider/kubevirt/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -637,17 +637,17 @@ func (p *provider) newVirtualMachine(_ context.Context, c *Config, pc *providerc

var (
dataVolumeName = machine.Name
annotations map[string]string
annotations = map[string]string{}
)
// Add machineName as prefix to secondaryDisks.
addPrefixToSecondaryDisk(c.SecondaryDisks, dataVolumeName)

if pc.OperatingSystem == providerconfigtypes.OperatingSystemFlatcar {
annotations = map[string]string{
"kubevirt.io/ignitiondata": userdata,
}
annotations["kubevirt.io/ignitiondata"] = userdata
}

annotations["ovn.kubernetes.io/allow_live_migration"] = "true"

defaultBridgeNetwork, err := defaultBridgeNetwork(macAddressGetter)
if err != nil {
return nil, fmt.Errorf("could not compute a random MAC address")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ spec:
runStrategy: Once
template:
metadata:
annotations:
"ovn.kubernetes.io/allow_live_migration": "true"
labels:
cluster.x-k8s.io/cluster-name: cluster-name
cluster.x-k8s.io/role: worker
Expand Down
2 changes: 2 additions & 0 deletions pkg/cloudprovider/provider/kubevirt/testdata/affinity.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ spec:
runStrategy: Once
template:
metadata:
annotations:
"ovn.kubernetes.io/allow_live_migration": "true"
labels:
cluster.x-k8s.io/cluster-name: cluster-name
cluster.x-k8s.io/role: worker
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ spec:
template:
metadata:
creationTimestamp: null
annotations:
"ovn.kubernetes.io/allow_live_migration": "true"
labels:
cluster.x-k8s.io/cluster-name: cluster-name
cluster.x-k8s.io/role: worker
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ spec:
template:
metadata:
creationTimestamp: null
annotations:
"ovn.kubernetes.io/allow_live_migration": "true"
labels:
kubevirt.io/vm: http-image-source
cluster.x-k8s.io/cluster-name: cluster-name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ spec:
name: custom-pref
template:
metadata:
annotations:
"ovn.kubernetes.io/allow_live_migration": "true"
labels:
cluster.x-k8s.io/cluster-name: cluster-name
cluster.x-k8s.io/role: worker
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ spec:
template:
metadata:
creationTimestamp: null
annotations:
"ovn.kubernetes.io/allow_live_migration": "true"
labels:
cluster.x-k8s.io/cluster-name: cluster-name
cluster.x-k8s.io/role: worker
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ spec:
template:
metadata:
creationTimestamp: null
annotations:
"ovn.kubernetes.io/allow_live_migration": "true"
labels:
cluster.x-k8s.io/cluster-name: cluster-name
cluster.x-k8s.io/role: worker
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ spec:
template:
metadata:
creationTimestamp: null
annotations:
"ovn.kubernetes.io/allow_live_migration": "true"
labels:
kubevirt.io/vm: pvc-image-source
cluster.x-k8s.io/cluster-name: cluster-name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ spec:
template:
metadata:
creationTimestamp: null
annotations:
"ovn.kubernetes.io/allow_live_migration": "true"
labels:
kubevirt.io/vm: registry-image-source-pod
cluster.x-k8s.io/cluster-name: cluster-name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ spec:
template:
metadata:
creationTimestamp: null
annotations:
"ovn.kubernetes.io/allow_live_migration": "true"
labels:
kubevirt.io/vm: registry-image-source
cluster.x-k8s.io/cluster-name: cluster-name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ spec:
template:
metadata:
creationTimestamp: null
annotations:
"ovn.kubernetes.io/allow_live_migration": "true"
labels:
cluster.x-k8s.io/cluster-name: cluster-name
cluster.x-k8s.io/role: worker
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ spec:
template:
metadata:
creationTimestamp: null
annotations:
"ovn.kubernetes.io/allow_live_migration": "true"
labels:
cluster.x-k8s.io/cluster-name: cluster-name
cluster.x-k8s.io/role: worker
Expand Down

0 comments on commit 24e281f

Please sign in to comment.