-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
🌱 [WIP] Improve logging for MachineDeployment scale up&down workflow #7168
🌱 [WIP] Improve logging for MachineDeployment scale up&down workflow #7168
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.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Hi @furkatgofurov7. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/cc @sbueringer @fabriziopandini PTAL once you get some time and let me know your thoughts, thanks. |
65dc6c2
to
9b82ab2
Compare
/ok-to-test |
continue | ||
} | ||
|
||
// If a MachineDeployment with a nil or empty selector creeps in, it should match nothing, not everything. | ||
if selector.Empty() { | ||
log.Info("Skipping MachineSet as the selector is empty") | ||
log.V(4).Info("Skipping MachineSet as the selector is empty", "MachineSet", klog.KObj(ms)) |
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.
Note: I am not sure if verbosity level here should be that high/lower or not needed at all, it is for now just aligned with
log.V(5).Info("Skipping MachineSet as the selector is empty", "machineset", ms.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.
4 or 5 seems okay for me given: https://cluster-api.sigs.k8s.io/developer/logging.html
Logs at higher levels of verbosity (>=4) are meant to document “how it happened”, providing insight on thorny parts of the code; a person reading those logs usually has deep knowledge of the codebase.
Don’t use verbosity higher than 5.
@fabriziopandini WDYT 4 or 5 for logs like this? I would use 5.
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 used 5 for now, please let me know if we have to change it otherwise.
@@ -235,13 +235,15 @@ func (r *Reconciler) reconcile(ctx context.Context, cluster *clusterv1.Cluster, | |||
} | |||
|
|||
if d.Spec.Strategy.Type == clusterv1.RollingUpdateMachineDeploymentStrategyType { | |||
log.Info(fmt.Sprintf("MachineDeployment %s strategy type is set to: %s", d.Name, d.Spec.Strategy.Type)) |
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'm not sure if we need this log statement as it just logs the current content of the strategy type field (same in l.246)
I think the most interesting logs for "MD creating/deleting MS" can be added in machinedeployment_rolling.go and machinedeployment_rollout_ondelete.go
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.
sure, I will rework the PR accordingly
internal/controllers/machinedeployment/machinedeployment_controller.go
Outdated
Show resolved
Hide resolved
internal/controllers/machinedeployment/machinedeployment_controller.go
Outdated
Show resolved
Hide resolved
9b82ab2
to
72005dc
Compare
continue | ||
} | ||
|
||
// Attempt to adopt machine if it meets previous conditions and it has no controller references. | ||
if metav1.GetControllerOf(ms) == nil { | ||
log.Info(fmt.Sprintf("Adopting MachineSet %q into MachineDeployment %q", ms.Name, d.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.
MachineDeployment should be part of the logger already so Adopting MachineSet %q
should be enough here.
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten |
/remove-lifecycle rotten |
@furkatgofurov7 Just fyi. Because of the label propagation proposal a lot of code in this area will probably change soon (xref: #7731) Might be good to defer further logging work in this area for now (cc @ykakarap) |
PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
The Kubernetes project currently lacks enough contributors to adequately respond to all PRs. This bot triages PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
Thanks @furkatgofurov7 change seems good to me are you wanting to pick this up or should we close it for now? |
/remove-lifecycle stale @enxebre sorry, got too busy with other stuff but planning to pick it up soon. |
This needs a rebase and further refactoring, will close it for now /close |
@furkatgofurov7: Closed this PR. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
What this PR does / why we need it:
Make logs for the MachineDeployment scale up&down workflow consistent with the new logging guidelines
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Ref: #6994