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 |
65fea5a to
e511cc3
Compare
aaronfern
left a comment
There was a problem hiding this comment.
Feedback after first round of review
| return mcdDeepCopy, nil | ||
| } | ||
|
|
||
| func (dc *controller) checkAndAdjustMachineReplaceCycleCountAndEffectiveCreationTimeout(ctx context.Context, mcd *v1alpha1.MachineDeployment, machineMap map[types.UID]*v1alpha1.MachineList) (adjusted bool, err error) { |
There was a problem hiding this comment.
Can you please add a docstring explaining this function? it's quite complex and a quick explanation will help in the long term
Signed-off-by: elankath <tarun.ramakrishna.elankath@sap.com>
…tiveCreationTimeout Signed-off-by: elankath <tarun.ramakrishna.elankath@sap.com>
…laceCycleCountThreshold Signed-off-by: elankath <tarun.ramakrishna.elankath@sap.com>
Signed-off-by: elankath <tarun.ramakrishna.elankath@sap.com>
Signed-off-by: elankath <tarun.ramakrishna.elankath@sap.com>
Signed-off-by: elankath <tarun.ramakrishna.elankath@sap.com>
b6dd98a to
0ba7155
Compare
|
Activity: Rebased PR after upstream changes |
| return dc.rollback(ctx, d, machineSets, machineMap) | ||
| } | ||
|
|
||
| if adjusted, err := dc.checkAndAdjustMachineReplaceCycleCountAndEffectiveCreationTimeout(ctx, d, machineMap); adjusted || err != nil { |
There was a problem hiding this comment.
I was wondering if this could be put in defer so that this is the very last operation done on the MCD.
thiyyakat
left a comment
There was a problem hiding this comment.
Thank you for the PR. I've given a few comments after a preliminary review of the changes. I still need to review the mother lode – checkAndAdjustMachineReplaceCycleCountAndEffectiveCreationTimeout 😅 . PTAL.
| // IsMachineFailed checks if machine has failed | ||
| func IsMachineFailed(p *v1alpha1.Machine) bool { |
There was a problem hiding this comment.
The functions in utils.go no longer have Machine in their names. Please undo this change.
| // IsMachineFailed checks if machine has failed | |
| func IsMachineFailed(p *v1alpha1.Machine) bool { | |
| // IsFailed checks if machine has failed | |
| func IsFailed(p *v1alpha1.Machine) bool { |
| metaObject, err := meta.Accessor(object) | ||
| if err != nil { | ||
| return nil, err | ||
| return | ||
| } | ||
| effectiveMachineCreationTimeoutStr, ok := metaObject.GetAnnotations()[v1alpha1.AnnotationKeyMachineEffectiveCreationTimeout] | ||
| durationStr, ok := metaObject.GetAnnotations()[v1alpha1.AnnotationKeyMachineEffectiveCreationTimeout] |
There was a problem hiding this comment.
Why not have a generic helper function to fetch annotation values based on the annotation key? It can be used in the Get* functions that you have introduced here. The parsing can be done in the caller.
|
|
||
| // getMachineMachineSets returns the MachineSets matching the given Machine. | ||
| func (c *controller) getMachineMachineSets(machine *v1alpha1.Machine) ([]*v1alpha1.MachineSet, error) { | ||
| func (dc *controller) getMachineMachineSets(machine *v1alpha1.Machine) ([]*v1alpha1.MachineSet, error) { |
There was a problem hiding this comment.
Since this is the machineset controller, is the receiver name change from c to dc accurate/required?
If this was not intentional, please make the change elsewhere in this file as well.
| } | ||
|
|
||
| func (c *controller) Run(workers int, stopCh <-chan struct{}) { | ||
| func (dc *controller) Run(workers int, stopCh <-chan struct{}) { |
There was a problem hiding this comment.
What is the reason behind this change? Since the Run method handles all types of queues, not just for machine deployment?
Maybe I'm not expanding dc correctly in my head :) Do you not mean deployment controller?
There was a problem hiding this comment.
It was dc in more places and c in other places. Got lint error on inconsistent receiver name. Just changed to dc. I guess I should just change to c.
| } | ||
|
|
||
| // FilterNodeConditionOfType filters conditions and returns the NodeCondition belonging to the given conditionType or nil if not present. | ||
| func FilterNodeConditionOfType(conditions []v1.NodeCondition, conditionType v1.NodeConditionType) *v1.NodeCondition { |
There was a problem hiding this comment.
If I'm not wrong, GetCondition in this file does the same thing. If you don't want to pass the node object, then please modify GetCondition to accept only a list of conditions instead, or get rid of GetCondition and use only the function introduced here. I don't think there's a need for both functions.
Co-authored-by: thiyyakat <meghana.thiyyakat@sap.com> Signed-off-by: Tarun Ramakrishna Elankath <tarun.ramakrishna.elankath@sap.com>
| } | ||
| } | ||
| if adjustedAnnotations := createAdjustedAnnotations(oldInfo, newInfo); len(adjustedAnnotations) > 0 { | ||
| newMcd := mcd.DeepCopy() |
There was a problem hiding this comment.
You can skip the deepcopy here as we have done it on L505
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #1155
Special notes for your reviewer:
Release note: