Skip to content
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

Conversation

furkatgofurov7
Copy link
Member

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

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Sep 5, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign justinsb for approval by writing /assign @justinsb in a comment. For more information see:The Kubernetes Code Review Process.

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Sep 5, 2022
@k8s-ci-robot
Copy link
Contributor

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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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.

@furkatgofurov7
Copy link
Member Author

/cc @sbueringer @fabriziopandini PTAL once you get some time and let me know your thoughts, thanks.

@furkatgofurov7 furkatgofurov7 force-pushed the cleanup/improve-md-scale-up-down-logs branch 2 times, most recently from 65dc6c2 to 9b82ab2 Compare September 5, 2022 17:38
@fabriziopandini
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Sep 6, 2022
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))
Copy link
Member Author

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)

Copy link
Member

@sbueringer sbueringer Sep 6, 2022

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.

Copy link
Member Author

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))
Copy link
Member

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

Copy link
Member Author

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

@furkatgofurov7 furkatgofurov7 force-pushed the cleanup/improve-md-scale-up-down-logs branch from 9b82ab2 to 72005dc Compare September 7, 2022 10:05
@furkatgofurov7 furkatgofurov7 changed the title 🌱 Improve logging for MachineDeployment scale up&down workflow 🌱 [WIP] Improve logging for MachineDeployment scale up&down workflow Sep 7, 2022
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))
Copy link
Member

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.

@k8s-triage-robot
Copy link

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:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Dec 6, 2022
@k8s-triage-robot
Copy link

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:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Jan 5, 2023
@furkatgofurov7
Copy link
Member Author

/remove-lifecycle rotten

@k8s-ci-robot k8s-ci-robot removed the lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. label Jan 5, 2023
@sbueringer
Copy link
Member

sbueringer commented Jan 5, 2023

@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)

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 8, 2023
@k8s-ci-robot
Copy link
Contributor

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.

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Mark this PR as fresh with /remove-lifecycle stale
  • Close this PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jun 6, 2023
@enxebre
Copy link
Member

enxebre commented Jun 28, 2023

Thanks @furkatgofurov7 change seems good to me are you wanting to pick this up or should we close it for now?

@furkatgofurov7
Copy link
Member Author

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.

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jun 29, 2023
@furkatgofurov7
Copy link
Member Author

This needs a rebase and further refactoring, will close it for now

/close

@k8s-ci-robot
Copy link
Contributor

@furkatgofurov7: Closed this PR.

In response to this:

This needs a rebase and further refactoring, will close it for now

/close

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants