Conversation
|
[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 |
gagan16k
marked this pull request as draft
August 31, 2026 08:23
gagan16k
force-pushed
the
flake-fix
branch
3 times, most recently
from
August 31, 2026 18:48
12c45ca to
6154f72
Compare
gagan16k
marked this pull request as ready for review
September 17, 2026 07:54
Signed-off-by: Gagan163264 <gagan.surathkal@gmail.com>
Signed-off-by: Gagan163264 <gagan.surathkal@gmail.com>
Signed-off-by: Gagan163264 <gagan.surathkal@gmail.com>
Signed-off-by: Gagan163264 <gagan.surathkal@gmail.com>
Signed-off-by: Gagan163264 <gagan.surathkal@gmail.com>
elankath
reviewed
Sep 18, 2026
| prefix := getMachinesPrefix(parentMetaObj.GetName()) | ||
| prefix = prefix + "-" + uuid.New().String()[:5] | ||
| // Use the full UUID as the suffix to avoid name collisions when many machines are created in a single reconcile. | ||
| prefix = prefix + "-" + uuid.New().String() |
Member
There was a problem hiding this comment.
Debatable if this is really needed since we aren't doing some sort of burst test with millions of objects. This is a false hypothetical that is not the real issue - missing the selector.
elankath
reviewed
Sep 18, 2026
| Expect(mcs[0].Annotations[machineutils.LastDeploymentReplicaChangeByScalerTime]).To(Equal(ts)) | ||
| _, exists := mcs[0].Annotations[machineutils.TriggerDeletionByMCM] | ||
| Expect(exists).To(BeFalse()) | ||
| var ms *machinev1.MachineSet |
Member
There was a problem hiding this comment.
Can change to using slices.IndexFunc.
idx := slices.IndexFunc(mcs, func(ms machinev1.MachineSet) bool {
return ms.Name == "MachineSet-test"
})
if idx == -1 {
return errors.New(...)
}
ms := &mcs[idx]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it:
Fixes flaky unit tests in
pkg/controller/deployment_test.goThere were three intermittently failing tests. Using tool stress - gardener docs
Full test logs
should create new machines only equal to burstReplicas and should not return errors.
should set MachinePriority=1 for the machines named in TriggerDeletionByMCM annotation in the MachineDeployment
set LDRCBST annotation on the machineSet and TriggerDeletionByMCM annotation is not set on the machineSet
Adding some debug logs to understand the issue better, and re-running the stress test.
Full logs from run
From the logs,
Next reconcile,
There seems to be two issues:
LabelMachinesWithHashtoUpdateMachineWithRetries) reads a stale machine and overwrites theMachinePriority=1annotation just set by the trigger-deletion path;copyMachineDeploymentAnnotationsToMachineSet) reads a stale MachineDeployment and copies an emptyLastDeploymentReplicaChangeByScalerTimeonto the MachineSet.LastDeploymentReplicaChangeByScalerTime, but now the cache has caught up and has the annotation.GetFakeMachineFromTemplateused only the first 5 chars of the UUID as the generated-name suffix. Unlike the real apiserver, the fake client does not retry onGenerateNameconflicts, so when many machines are created in a single reconcile (e.g.burstReplicas) the truncated suffix could collide and produce duplicate machine names, flaking the test. Fixed by using the full UUID as the suffix.Changes in the PR:
MachineSetthemachine-template-hashlabel on itsSpec.Selector(in both affected entries) soaddHashKeyToISAndMachinesshort-circuits from the first reconcile.Expect(...)postChecks to returnerror. Match the DescribeTable's postCheck signature.GetFakeMachineFromTemplateto avoid duplicate machine names underburstReplicas.Stress test after PR:
Click to expand
Release note: