Commit graph

75 commits

Author SHA1 Message Date
Kubernetes Prow Robot
b639540931
Merge pull request #135432 from pohly/apimachinery-featuregate-contextual-logging
featuregate: contextual logging
2026-01-14 01:11:35 +05:30
Patrick Ohly
c16a07a8b1 featuregate: contextual logging
This is primarily useful in unit tests and therefore supported by
featuregate/testing. Without this, all warnings are emitted to stderr, with no
connection to the test which caused the warning to be emitted.

When a single test fails, `go test` started by showing all warnings triggered by
any test, not just the failed test:

    I1121 18:50:28.112284  396950 feature_gate.go:466] feature gates: {map[DRADeviceTaintRules:true DRADeviceTaints:true]}
    ...
    I1121 18:50:29.704907  396950 feature_gate.go:466] feature gates: {map[DRADeviceTaintRules:false DRADeviceTaints:false]}
    --- FAIL: TestAll (1.58s)
        --- FAIL: TestAll/Eviction (0.02s)

This warning was actually slightly broken: it passed an atomic.Value to Infof,
not the map. This violates the "must not be copied after first use" rule
for atomic.Value (thus wasn't thread-safe) and printed the value in an awkward
way (extra {}).

Now it shows that the feature gates are modified inside TestAll (in this example):

    --- FAIL: TestAll (1.56s)
        feature_gate.go:170: I1124 17:31:27.245108] Updated featureGates={"DRADeviceTaintRules":true,"DRADeviceTaints":true}
        --- FAIL: TestAll/Eviction (0.02s)
            --- FAIL: TestAll/Eviction/initial (0.00s)
        ...

        feature_gate.go:170: I1124 17:31:28.821975] Updated featureGates={"DRADeviceTaintRules":false,"DRADeviceTaints":false}
    FAIL
    FAIL	k8s.io/kubernetes/pkg/controller/devicetainteviction	1.602s
2026-01-13 18:20:59 +01:00
Ed Bartosh
0dc83930de logcheck: move all kubelet subdirs to contextual logging 2026-01-12 12:36:59 +02:00
Ed Bartosh
1c48267565 migrate pkg/kubelet/events to contextual logging 2026-01-12 12:36:59 +02:00
Ed Bartosh
597c20d050 migrate kubelet/stats to contextual logging 2026-01-12 12:36:59 +02:00
Ed Bartosh
152c2e5d1c migrate kubelet/images/pullmanager to contextual logging 2026-01-12 12:36:53 +02:00
Francesco Romani
816eee64e8 cpumanager: hack: add golang ci config for contextual logging
add cpumanager to contextual logging linter
regenerate with
```hack/update-golangci-lint-config.sh```

Signed-off-by: Francesco Romani <fromani@redhat.com>
2025-10-27 08:38:58 +01:00
phuhung273
7ed61cfde1 chore(kubelet): migrate topologymanager to contextual logging 2025-10-14 18:32:20 +07:00
Ed Bartosh
bb91913017 Migrate sample-device-lugin to contextual logging 2025-09-28 21:13:41 +03:00
Ed Bartosh
d45a4557c1 Migrate device manager to contextual logging 2025-09-26 16:50:34 +03:00
Ed Bartosh
bf0429ed07 migrate kubelet/certificate to contextual logging 2025-09-10 12:33:33 +03:00
Ed Bartosh
b276c96ef8 Migrate kubelet/server to contextual logging 2025-09-09 12:49:42 +03:00
Kubernetes Prow Robot
3b687533aa
Merge pull request #133217 from bart0sh/PR187-migrate-utils-logs-to-contextual-logging
Kubelet: Migrate util/ and logs/ to contextual logging
2025-09-05 14:37:34 -07:00
Kubernetes Prow Robot
078a8f1894
Merge pull request #130581 from zhifei92/migrate-kubelet-config-to-contextual-logging
chore(kubelet):  migrate config to contextual logging
2025-09-05 05:25:26 -07:00
Omer Aplatony
d75d4860e7 kubelet: migrate module logs to contextual logging
Signed-off-by: Omer Aplatony <omerap12@gmail.com>
Co-authored-by: Ed Bartosh <eduard.bartosh@intel.com>
2025-09-05 13:22:00 +03:00
Omer Aplatony
9c1cf79d74 kubelet: migrate utils to contextual logging
Signed-off-by: Omer Aplatony <omerap12@gmail.com>
Co-authored-by: Ed Bartosh <eduard.bartosh@intel.com>
2025-09-05 13:19:56 +03:00
Kubernetes Prow Robot
b8257c1667
Merge pull request #133699 from pohly/log-check-update
hack/logcheck.conf: add several converted packages
2025-08-29 08:17:16 -07:00
Patrick Ohly
4fa6c70604 hack/logcheck.conf: add several converted packages
Several packages in `pkg` already have no log calls which need to be
updated. Adding them to the logcheck.conf prevents regressions.
2025-08-26 09:31:57 +02:00
Anish Ramasekar
39e7b2ce5e
Migrate pkg/credentialprovider to structured logging
Signed-off-by: Anish Ramasekar <anish.ramasekar@gmail.com>
2025-08-11 16:41:55 -07:00
Kubernetes Prow Robot
d12fae55d0
Merge pull request #131001 from Chulong-Li/winstats-contextual-logging
Migrate pkg/kubelet/winstats to contextual logging
2025-07-24 17:58:26 -07:00
Kubernetes Prow Robot
9eb462ef4a
Merge pull request #131306 from Chulong-Li/volumemanager-contextual-logging
Migrate pkg/kubelet/volumemanager to contextual logging
2025-07-24 10:50:27 -07:00
Chulong Li
bf98e45afb Migrate pkg/kubelet/volumemanager to contextual logging
Remove context.TODO and context.Background

Fix linter error in volume_manager_test

Fix QF1008: Could remove embedded field "ObjectMeta" from selector

Remove the extra code change

Remove the extra change

Update the NewTestContext
2025-07-24 21:20:12 +08:00
Chulong Li
f626e847e7 Migrate pkg/kubelet/winstats to contextual logging
Update the order of imports to follow the standard convention

Quick update on import order for cadvisor_windows.go

Update the hack files

Update contextual logging in Test_convertWinApiToCadvisorApi
2025-07-22 20:44:53 +08:00
zhangzhifei16
2b1f38a83b chore(kubelet): migrate config to contextual logging. 2025-07-22 10:57:04 +08:00
zhangzhifei16
911df655d3 chore: migrate kubelet lifecycle to contextual logging. 2025-07-22 10:14:42 +08:00
Kubernetes Prow Robot
ba35c0613d
Merge pull request #132427 from soma00333/kuberuntime-contextual-logging-1
feat(kubelet): migrate kuberuntime to contextual logging
2025-07-21 05:50:36 -07:00
Swati Sehgal
b8758ac31b node: mm-mgr: migrate to contextual logging
Signed-off-by: Swati Sehgal <swsehgal@redhat.com>
2025-07-20 21:50:58 +01:00
soma00333
ab839c93ff
feat(kubelet): migrate kuberuntime to contextual logging 2025-07-20 09:47:50 +09:00
soma00333
7ddb042626
feat(cmd/kubelet): support structured and contextual logging 2025-07-19 17:10:37 +09:00
Ed Bartosh
4bc2ad6eea migrate pkg/kubelet/preemption to contextual logging 2025-07-17 10:16:03 +03:00
Ed Bartosh
b96e3cac74 migrate pkg/kubelet/pod to contextual logging 2025-07-17 10:16:03 +03:00
Ed Bartosh
0cb31bc407 migrate pkg/kubelet/nodeshutdown to contextual logging 2025-07-17 10:16:03 +03:00
Ed Bartosh
75ccd69bab migrate pkg/kubelet/kubeletconfig to contextual logging 2025-07-17 10:16:03 +03:00
Ed Bartosh
7dad9e2af6 migrate pkg/kubelet/apis to contextual logging 2025-07-17 10:15:58 +03:00
Chulong Li
d868eeb088 Migrate pkg/kubelet/status to contextual logging
Update with logger from context

Fix nil pointer issue in TestUpdateReadiness
2025-03-20 21:58:14 +08:00
Ed Bartosh
71b9114840 kubelet: Migrate pkg/kubelet/sysctl to contextual logging 2025-01-30 10:31:58 +02:00
Kubernetes Prow Robot
8294abc599
Merge pull request #128998 from bart0sh/PR165-migrate-oom-to-contextual-logging
kubelet: Migrate pkg/kubelet/oom to contextual logging
2025-01-28 13:33:22 -08:00
Patrick Ohly
7821abf2ae client-go/rest: finish conversion to contextual logging
The remaining calls can be converted without API changes.
2025-01-22 07:58:18 +01:00
Patrick Ohly
4638ba9716 client-go/tools/cache: add APIs with context parameter
The context is used for cancellation and to support contextual logging.

In most cases, alternative *WithContext APIs get added, except for
NewIntegerResourceVersionMutationCache where code searches indicate that the
API is not used downstream.

An API break around SharedInformer couldn't be avoided because the
alternative (keeping the interface unchanged and adding a second one with
the new method) would have been worse. controller-runtime needs to be updated
because it implements that interface in a test package. Downstream consumers of
controller-runtime will work unless they use those test package.

Converting Kubernetes to use the other new alternatives will follow. In the
meantime, usage of the new alternatives cannot be enforced via logcheck
yet (see https://github.com/kubernetes/kubernetes/issues/126379 for the
process).

Passing context through and checking it for cancellation is tricky for event
handlers. A better approach is to map the context cancellation to the normal
removal of an event handler via a helper goroutine. Thanks to the new
HandleErrorWithLogr and HandleCrashWithLogr, remembering the logger is
sufficient for handling problems at runtime.
2024-12-18 18:45:02 +01:00
Ed Bartosh
f622be0333 kubelet: Migrate pkg/kubelet/oom to contextual logging 2024-11-28 17:47:02 +02:00
Ed Bartosh
e5cb071c2e kubelet: Migrate CAdvisor to contextual logging 2024-11-06 01:49:20 +02:00
Oksana Baranova
49b88f1d8a kubelet: migrate clustertrustbundle, token to contextual logging
Signed-off-by: Oksana Baranova <oksana.baranova@intel.com>
2024-10-30 17:31:11 +02:00
Oksana Baranova
2474369227 kubelet: migrate pleg to contextual logging
Signed-off-by: Oksana Baranova <oksana.baranova@intel.com>
2024-09-13 12:13:26 +03:00
Ed Bartosh
e1bc8defac kubelet: Migrate DRA Manager to contextual logging
Co-authored-by: Patrick Ohly <patrick.ohly@intel.com>
2024-08-22 11:12:41 +03:00
bells17
1298c8a5fe
csi-translation-lib: Support structured and contextual logging 2024-07-18 14:01:27 +09:00
carlory
7149cb9f5a Revert "Revert "remove legacycloudproviders from staging""
This reverts commit d9a0be3b01.
2024-05-15 20:10:09 +08:00
carlory
d9a0be3b01 Revert "remove legacycloudproviders from staging"
This reverts commit 07c8d35681.
2024-05-14 13:39:13 +08:00
carlory
07c8d35681 remove legacycloudproviders from staging 2024-05-09 11:59:43 +08:00
bells17
318ea033d5 Include k8s.io components with contextual logging in logcheck.conf 2024-05-07 20:35:33 +09:00
bells17
1c917aa463
component-helpers: Support structured and contextual logging (#120637) 2024-04-24 03:06:15 -07:00