-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat(vmip): add new events #645
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Valeriy Khorunzhin <[email protected]>
6cf5250
to
8cddac6
Compare
@@ -144,14 +144,18 @@ func (h IPLeaseHandler) createNewLease(ctx context.Context, state state.VMIPStat | |||
Reason(vmipcondition.VirtualMachineIPAddressIsOutOfTheValidRange). | |||
Message(fmt.Sprintf("The requested address %s is out of the valid range", | |||
vmip.Spec.StaticIP)) | |||
h.recorder.Event(vmip, corev1.EventTypeWarning, vmipcondition.VirtualMachineIPAddressIsOutOfTheValidRange.String(), msg) | |||
h.recorder.Eventf(vmip, corev1.EventTypeWarning, virtv2.ReasonVMIPLeaseBoundFailed, "The requested address %s is out of the valid range", vmip.Spec.StaticIP) |
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.
we should use variable "msg" because this message is identical with text in the "Message" from line 145.
h.recorder.Event(vmip, corev1.EventTypeWarning, vmipcondition.VirtualMachineIPAddressLeaseAlreadyExists.String(), msg) | ||
h.recorder.Eventf( | ||
vmip, corev1.EventTypeWarning, virtv2.ReasonVMIPLeaseBoundFailed, | ||
"VirtualMachineIPAddressLease %s is bound to another VirtualMachineIPAddress", |
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.
same situation with identical message.
// ReasonVMIPVMAttached is event reason that VMIP attached to VM | ||
ReasonVMIPVMAttached = "VMIPVMAttached" | ||
// ReasonVMIPVMDetached is event reason that VMIP not attached to VM | ||
ReasonVMIPVMDetached = "VMIPVMDetached" |
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 think "NotAttached" seems better. "Detached" sounds like VMIP was attached to VM and now is detached.
@@ -104,6 +111,7 @@ func (h *LifecycleHandler) Handle(ctx context.Context, state state.VMIPState) (r | |||
vmipStatus.VirtualMachine = vm.Name | |||
conditionAttach.Status(metav1.ConditionTrue). | |||
Reason(vmipcondition.Attached) | |||
h.recorder.Eventf(vmip, corev1.EventTypeNormal, virtv2.ReasonVMIPVMAttached, "VMIP is attached to %q/%q", vm.Namespace, vm.Name) |
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.
Don't use abbreviations in messages for user
Description
Why do we need it, and what problem does it solve?
What is the expected result?
Checklist