-
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(vmclass): add events about available nodes and sizing policies changed #606
base: main
Are you sure you want to change the base?
Conversation
40ac6c9
to
7dd0311
Compare
7dd0311
to
2599df7
Compare
images/virtualization-artifact/pkg/controller/vmclass/internal/discovery.go
Outdated
Show resolved
Hide resolved
57f3f1a
to
ea2db1c
Compare
9d7eafe
to
1afff48
Compare
Signed-off-by: Valeriy Khorunzhin <valeriy.khorunzhin@flant.com>
Signed-off-by: Valeriy Khorunzhin <valeriy.khorunzhin@flant.com>
Signed-off-by: Valeriy Khorunzhin <valeriy.khorunzhin@flant.com>
1afff48
to
bdc28ef
Compare
cb. | ||
Status(metav1.ConditionFalse). | ||
Reason(vmclasscondition.ReasonVMClassFree). | ||
Message("") |
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.
No need to add a separate condition "VMClassFree", vmclass is in a deletion state at this point, it will be deleted almost immediately after removing finalizers.
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.
+1
@@ -95,4 +92,13 @@ const ( | |||
|
|||
// ReasonDataSourceDiskProvisioningFailed is event reason that DataSource disk provisioning is failed. | |||
ReasonDataSourceDiskProvisioningFailed = "DataSourceImportDiskProvisioningFailed" | |||
|
|||
// ReasonVMClassSizingPoliciesWasChanged is event reason that VMClass sizing policies was changed. |
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.
were changed
|
||
func (v *PolicyChangesValidator) ValidateUpdate(_ context.Context, oldVMClass, newVMClass *v1alpha2.VirtualMachineClass) (admission.Warnings, error) { | ||
if !reflect.DeepEqual(oldVMClass.Spec.SizingPolicies, newVMClass.Spec.SizingPolicies) { | ||
v.recorder.Event(newVMClass, corev1.EventTypeNormal, v1alpha2.ReasonVMClassSizingPoliciesWasChanged, "Sizing policies was changed") |
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.
were
cb. | ||
Status(metav1.ConditionTrue). | ||
Reason(vmclasscondition.ReasonVMClassInUse). | ||
Message(msg) | ||
return reconcile.Result{RequeueAfter: 60 * time.Second}, nil |
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.
Why not subscribe to virtual machine deletion?
cb. | ||
Status(metav1.ConditionFalse). | ||
Reason(vmclasscondition.ReasonVMClassFree). | ||
Message("") |
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.
+1
prevMap := make(map[string]struct{}) | ||
currentMap := make(map[string]struct{}) | ||
|
||
for _, n := range prev { |
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.
n usually means a number, but I suppose not in this context.
removed []string | ||
} | ||
|
||
var _ = Describe("DiscoveryHandler Run", func() { |
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.
DiscoveryHandler doesn't have method Run
Description
Using new events api.
Add event when list of available nodes changed.
Add event when sizing policies changed.
Why do we need it, and what problem does it solve?
What is the expected result?
Checklist