-
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
🌱 Fix patch errors not being logged #9224
🌱 Fix patch errors not being logged #9224
Conversation
Hi @AndiDog. 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. |
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.
bootstrap/kubeadm/internal/controllers/kubeadmconfig_controller.go
Outdated
Show resolved
Hide resolved
@@ -173,9 +173,11 @@ func (r *KubeadmConfigReconciler) Reconcile(ctx context.Context, req ctrl.Reques | |||
} | |||
log = log.WithValues(configOwner.GetKind(), klog.KRef(configOwner.GetNamespace(), configOwner.GetName()), "resourceVersion", configOwner.GetResourceVersion()) | |||
|
|||
log = log.WithValues("Cluster", klog.KRef(configOwner.GetNamespace(), configOwner.ClusterName())) | |||
log = log.WithValues("Cluster", klog.KRef(configOwner.GetNamespace(), configOwner.ClusterName()), "KubeadmConfig", klog.KRef(config.GetNamespace(), config.GetName())) |
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.
This pair should already be included at this point when controller runtime sets up the logger.
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.
You mean KubeadmConfig
which I added? I definitely don't see it in a failing test's log, so that's why I wanted to have it.
Example before:
I0817 15:10:42.545337 55146 kubeadmconfig_controller.go:179] "msg"="Reconciling KubeadmConfig" "Cluster"={"name":"cluster","namespace":"default"} "MachinePool"={"name":"worker-machinepool","namespace":"default"} "resourceVersion"="999"
I found controller-runtime to actually fill it for production controller logs (namely in func (blder *Builder) doController(r reconcile.Reconciler) error
):
kubeadmconfig_controller.go:314] "Refreshing token until the infrastructure has a chance to consume it" controller="kubeadmconfig" controllerGroup="bootstrap.cluster.x-k8s.io" controllerKind="KubeadmConfig" KubeadmConfig="mynamespace/my-nodepool0"
So my problem is that tests never use the controller-runtime builder but construct KubeadmConfigReconciler{...}
directly. Not worth fixing this as I did, so I'll revert. Overall though, having the object logged in the test logs would help the developer experience.
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.
Didn't look at the code but potentially we could try to use the builder in tests as well (i.e. via our SetupWithManager func)
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.
Hm probably more complicated then that
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.
That would fix it - currently most of the KCP tests set up the controller using the raw reconciler e.g.
r := &KubeadmControlPlaneReconciler{
Not sure it's worth it for tests where you can set things up to get info on which cluster etc. is involved in the test code. But would be fine with it if someone wanted to make the changes
bootstrap/kubeadm/internal/controllers/kubeadmconfig_controller.go
Outdated
Show resolved
Hide resolved
979c29e
to
43d0c82
Compare
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.
Thanks!
/lgtm
LGTM label has been added. Git tree hash: da08bacbf57728e6d6e3cef9be047fa2fc4540b9
|
bootstrap/kubeadm/internal/controllers/kubeadmconfig_controller.go
Outdated
Show resolved
Hide resolved
43d0c82
to
cd72881
Compare
KubeadmConfigReconciler
One suggestion #9224 (comment) |
cd72881
to
252ff99
Compare
Thx! /lgtm /assign @killianmuldoon |
LGTM label has been added. Git tree hash: 13c06738c6240fe5b673812a1f0a8c8f5b61107f
|
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.
/lgtm
/approve
Thanks!
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: killianmuldoon The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/cherry-pick release-1.5 |
/cherry-pick release-1.4 |
@sbueringer: new pull request created: #9234 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. |
@sbueringer: new pull request created: #9235 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:
Log whichKubeadmConfig
gets reconciled so that every log line is easier to reason aboutrerr
vs.err
)Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):n/a
/area logging
/area provider/bootstrap-kubeadm