Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ func (h *SyncKvvmHandler) isVMUnschedulable(
func (h *SyncKvvmHandler) isPlacementPolicyChanged(allChanges vmchange.SpecChanges) bool {
for _, c := range allChanges.GetAll() {
switch c.Path {
case "affinity", "nodeSelector", "tolerations":
case "affinity", "nodeSelector", "tolerations", "virtualMachineClassName", "VirtualMachineClass:spec.nodeSelector", "VirtualMachineClass:spec.tolerations":
if !equality.Semantic.DeepEqual(c.CurrentValue, c.DesiredValue) {
return true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import (
"github.com/deckhouse/virtualization-controller/pkg/controller/reconciler"
vmservice "github.com/deckhouse/virtualization-controller/pkg/controller/vm/internal/service"
"github.com/deckhouse/virtualization-controller/pkg/controller/vm/internal/state"
"github.com/deckhouse/virtualization-controller/pkg/controller/vmchange"
"github.com/deckhouse/virtualization-controller/pkg/eventrecord"
"github.com/deckhouse/virtualization/api/core/v1alpha2"
"github.com/deckhouse/virtualization/api/core/v1alpha2/vmcondition"
Expand Down Expand Up @@ -319,4 +320,19 @@ var _ = Describe("SyncKvvmHandler", func() {
Entry("Pending phase with changes applied, condition should not exist", v1alpha2.MachinePending, false, metav1.ConditionUnknown, false),
Entry("Pending phase with changes not applied, condition should not exist", v1alpha2.MachinePending, true, metav1.ConditionUnknown, false),
)

DescribeTable("isPlacementPolicyChanged",
func(path string, expected bool) {
h := &SyncKvvmHandler{}
changes := vmchange.SpecChanges{}
changes.Add(vmchange.FieldChange{Path: path, CurrentValue: "old", DesiredValue: "new"})

Expect(h.isPlacementPolicyChanged(changes)).To(Equal(expected))
},
Entry("vm tolerations change", "tolerations", true),
Entry("vmclass tolerations change", "VirtualMachineClass:spec.tolerations", true),
Entry("vmclass nodeSelector change", "VirtualMachineClass:spec.nodeSelector", true),
Entry("vmclass name change", "virtualMachineClassName", true),
Entry("cpu change is not a placement policy", "cpu.cores", false),
)
})
Loading