Add integration tests for auto machine preservation - #1124
Conversation
|
/assign |
| } | ||
|
|
||
| // DeleteVAPToRestartKubeletUpdates deletes the ValidatingAdmissionPolicy and ValidatingAdmissionPolicyBinding that were created to block kubelet from updating node leases and node status. | ||
| func (c *Cluster) DeleteVAPToRestartKubeletUpdates(ctx context.Context) error { |
There was a problem hiding this comment.
I have some points/questions regarding this function
- Should we use
deferinstead ofgomega.Expect(c.TargetCluster.DeleteVAPToRestartKubeletUpdates(ctx)).To(gomega.BeNil())for cleanup steps like these? In case of any test assertion failure above where this is called, the VAP and VAPB might not get cleared if Ginkgo aborts the test immediately. - I think we should also add this function in
cleanTestResources(). If any matching resources get left behind, this way they get cleared after(and before) test runs. - In case the IT process crashes (with no chance to execute the cleanup), the resources can get left behind in the cluster. Currently(pre-PR) even the test machine deployment, and the machines themselves can persist if this happens. Would it be worthwhile to add a make target to clean this up?
There was a problem hiding this comment.
I've added DeleteVAPToRestartKubeletUpdates to DeferCleanups within tests and have added vap/vapb cleanup to cleanTestResources() in fbfc7b5
PTAL
thiyyakat
left a comment
There was a problem hiding this comment.
Thanks for adding these much-needed tests! 👍
|
@aaronfern , should we have some IT to test reduction of |
Co-authored-by: gagan16k
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
@thiyyakat Okay, sure, makes sense. I will add this test |
Co-authored-by: Meghana <meghana.thiyyakat@sap.com>
…ailedMachineMax is reduced
thiyyakat
left a comment
There was a problem hiding this comment.
Thanks for adding the test and addressing the comments. Just a few nits.
thiyyakat
left a comment
There was a problem hiding this comment.
There are a few if-else if blocks that can be converted to if-else blocks. PTAL.
What this PR does / why we need it:
This PR adds integration tests for auto machine preservation.
The following cases have been covered:
preserve=falseannotation is presentpreserve=falseannotation is addedAutoPreserveFailedMachineMaxis reduced, failed machines that exceed the newAutoPreserveFailedMachineMaxcount are moved to terminatingWhich issue(s) this PR fixes:
Fixes partially #1123
Special notes for your reviewer:
To trigger machine failures, this PR takes the approach of applying a validating admission policy to block all kubelet updates. This causes kubelet not to be able to update it's node lease or it's node status and results in the node going into the
Unknownstate.This is a k8s native way of achieving node failures and has no dependency on the provider or any other node/worker-pool setting
This might not work with the virtual provider of the virtual provider does not use kubelets, but imo this can be considered a special case and can be tackled in a separate PR
Release note: