-
Notifications
You must be signed in to change notification settings - Fork 21
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
neonvm: prevent migrating VMs to the nodes with non-matching architecture #1123
base: main
Are you sure you want to change the base?
Conversation
No changes to the coverage.
HTML Report |
5446383
to
a036d85
Compare
893c635
to
8e751ea
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments
if vm.Spec.Affinity != nil && vm.Spec.Affinity.NodeAffinity != nil && vm.Spec.Affinity.NodeAffinity.RequiredDuringSchedulingIgnoredDuringExecution != nil { | ||
for _, term := range vm.Spec.Affinity.NodeAffinity.RequiredDuringSchedulingIgnoredDuringExecution.NodeSelectorTerms { | ||
for _, expr := range term.MatchExpressions { | ||
if expr.Key == "kubernetes.io/arch" && expr.Operator == corev1.NodeSelectorOpIn && len(expr.Values) > 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: does len(expr.Values) > 0
mean that this function will return true for VMs that have an architecture affinity for e.g. "either amd64 or arm64" ? IIUC, would that mean that we could accidentally migrate between x86 and ARM?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Values are checked in the loop body, if I understand correctly your question
if err := addArchitectureAffinity(vm, sourceNode); err != nil { | ||
log.Error(err, "Failed to add architecture affinity to VM", "sourceNodeStatus", sourceNode.Status) | ||
} | ||
if err = r.Update(ctx, vm); err != nil { | ||
log.Error(err, "Failed to update node affinity of the source vm") | ||
return ctrl.Result{RequeueAfter: time.Second}, err | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: IIUC, does this mean that the VM will permanently get affinity for the node it starts with?
Is there a reason we can't just do it on the target pod for the migration? (I guess, potential race conditions?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think there is a particular reason, I just feel it is a bit safer to make the guard on the very first step of the migration.
Plus if we going to have multiarch clusters it is a bit unsafe to even have VM without architecture affinity, may be in later it should be even added during the VM creation, in the vmcontroller?
Signed-off-by: Misha Sakhnov <[email protected]>
a0219ef
to
c5ba550
Compare
Signed-off-by: Misha Sakhnov <[email protected]>
c5ba550
to
f5246f7
Compare
Add node affinity to the VM spec during the live migration pending state, if it doesn't have.
#1083