Skip to content

Commit df74511

Browse files
authored
Merge pull request #5621 from pohly/contextual-logging-1.35
KEP-1602, KEP-3077: structured, contextual logging in 1.35
2 parents 7fb57da + f964be5 commit df74511

File tree

3 files changed

+38
-101
lines changed

3 files changed

+38
-101
lines changed

keps/sig-instrumentation/1602-structured-logging/kep.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,10 @@ approvers:
2020
see-also:
2121
replaces:
2222
stage: beta
23-
latest-milestone: "v1.23"
23+
latest-milestone: "v1.35"
2424
milestone:
2525
alpha: "v1.19"
2626
beta: "v1.23"
27-
stable: "v1.26"
2827
feature-gates:
2928
disable-supported: true
3029
metrics:

keps/sig-instrumentation/3077-contextual-logging/README.md

Lines changed: 36 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,116 +1091,54 @@ it has been determined that they introduce too much overhead.
10911091
* Kubernetes 1.28: kube-controller-manager converted completely, relationship
10921092
with log/slog in Go 1.21 clarified
10931093
* Kubernetes 1.29: kube-scheduler converted completely
1094+
* Kubernetes 1.30: graduation to beta
10941095

10951096
## Status and next steps
10961097

1097-
As of Kubernetes 1.29.1, kube-controller-manager and kube-scheduler have been
1098-
converted. The logcheck tool can be used to count remaining log calls that need
1098+
As of Kubernetes 1.34, kube-controller-manager and kube-scheduler have been
1099+
converted. Work on the kubelet is in progress.
1100+
1101+
The logcheck tool can be used to count remaining log calls that need
10991102
to be converted:
11001103

11011104
```
11021105
go install sigs.k8s.io/logtools/logcheck@latest
11031106
1104-
echo "Component | Non-Structured Logging | Non-Contextual Logging " && echo "------ | ------- | -------" && for i in $(find pkg/* cmd/* staging/src/k8s.io/* -maxdepth 0 -type d | sort); do echo "$i | $(cd $i; ${GOPATH}/bin/logcheck -check-structured -check-deprecations=false 2>&1 ./... | wc -l ) | $(cd $i; ${GOPATH}/bin/logcheck -check-structured -check-deprecations=false -check-contextual ./... 2>&1 | wc -l )"; done
1107+
echo "Component | Non-Structured Logging | Non-Contextual Logging | Owner " && echo "------ | ------- | ------- | ------" && for i in $(find cmd/kube-apiserver cmd/kubelet cmd/kubelet pkg/* staging/src/k8s.io/client-go staging/src/k8s.io/apimachinery/* staging/src/k8s.io/apiserver -maxdepth 0 -type d | sort); do echo "$i | $(cd $i; ${GOPATH}/bin/logcheck -check-structured -check-deprecations=false 2>&1 ./... | wc -l ) | $(cd $i; ${GOPATH}/bin/logcheck -check-structured -check-deprecations=false -check-contextual ./... 2>&1 | wc -l ) |" | grep -v '| 0 | 0 |'; done
11051108
```
11061109

1107-
Note that this also counts calls where it was decided to not convert them. The
1108-
actual check with golangci-lint ignores those because of a `//nolint:logcheck`
1109-
suppression comment.
1110-
1111-
Component | Non-Structured Logging | Non-Contextual Logging
1112-
------ | ------- | -------
1113-
cmd/clicheck | 0 | 0
1114-
cmd/cloud-controller-manager | 6 | 8
1115-
cmd/dependencycheck | 0 | 0
1116-
cmd/dependencyverifier | 0 | 0
1117-
cmd/fieldnamedocscheck | 1 | 1
1118-
cmd/gendocs | 0 | 0
1119-
cmd/genkubedocs | 0 | 0
1120-
cmd/genman | 0 | 0
1121-
cmd/genswaggertypedocs | 2 | 2
1122-
cmd/genutils | 0 | 0
1123-
cmd/genyaml | 0 | 0
1124-
cmd/gotemplate | 0 | 0
1125-
cmd/importverifier | 0 | 0
1126-
cmd/kubeadm | 264 | 463
1127-
cmd/kube-apiserver | 6 | 7
1128-
cmd/kube-controller-manager | 0 | 0
1129-
cmd/kubectl | 0 | 0
1130-
cmd/kubectl-convert | 0 | 0
1131-
cmd/kubelet | 0 | 52
1132-
cmd/kubemark | 1 | 1
1133-
cmd/kube-proxy | 0 | 42
1134-
cmd/kube-scheduler | 0 | 0
1135-
cmd/preferredimports | 0 | 0
1136-
cmd/prune-junit-xml | 0 | 0
1137-
cmd/yamlfmt | 0 | 0
1138-
pkg/api | 0 | 0
1139-
pkg/apis | 0 | 0
1140-
pkg/auth | 1 | 1
1141-
pkg/capabilities | 0 | 0
1142-
pkg/client | 0 | 0
1143-
pkg/cloudprovider | 0 | 0
1144-
pkg/cluster | 0 | 0
1145-
pkg/controller | 0 | 3
1146-
pkg/controlplane | 53 | 69
1147-
pkg/credentialprovider | 48 | 77
1148-
pkg/features | 0 | 0
1149-
pkg/fieldpath | 0 | 0
1150-
pkg/generated | 0 | 0
1151-
pkg/kubeapiserver | 4 | 4
1152-
pkg/kubectl | 1 | 2
1153-
pkg/kubelet | 2 | 1983
1154-
pkg/kubemark | 7 | 7
1155-
pkg/printers | 0 | 0
1156-
pkg/probe | 7 | 24
1157-
pkg/proxy | 0 | 360
1158-
pkg/quota | 0 | 0
1159-
pkg/registry | 46 | 99
1160-
pkg/routes | 2 | 2
1161-
pkg/scheduler | 0 | 0
1162-
pkg/security | 0 | 0
1163-
pkg/securitycontext | 0 | 0
1164-
pkg/serviceaccount | 25 | 44
1165-
pkg/util | 20 | 57
1166-
pkg/volume | 704 | 1110
1167-
pkg/windows | 1 | 1
1168-
staging/src/k8s.io/api | 0 | 0
1169-
staging/src/k8s.io/apiextensions-apiserver | 58 | 89
1170-
staging/src/k8s.io/apimachinery | 80 | 125
1171-
staging/src/k8s.io/apiserver | 285 | 655
1172-
staging/src/k8s.io/client-go | 163 | 283
1173-
staging/src/k8s.io/cli-runtime | 1 | 2
1174-
staging/src/k8s.io/cloud-provider | 122 | 162
1175-
staging/src/k8s.io/cluster-bootstrap | 2 | 4
1176-
staging/src/k8s.io/code-generator | 108 | 155
1177-
staging/src/k8s.io/component-base | 33 | 64
1178-
staging/src/k8s.io/component-helpers | 2 | 4
1179-
staging/src/k8s.io/controller-manager | 10 | 10
1180-
staging/src/k8s.io/cri-api | 0 | 0
1181-
staging/src/k8s.io/csi-translation-lib | 3 | 4
1182-
staging/src/k8s.io/dynamic-resource-allocation | 0 | 0
1183-
staging/src/k8s.io/endpointslice | 0 | 0
1184-
staging/src/k8s.io/kms | 0 | 0
1185-
staging/src/k8s.io/kube-aggregator | 45 | 62
1186-
staging/src/k8s.io/kube-controller-manager | 0 | 0
1187-
staging/src/k8s.io/kubectl | 96 | 160
1188-
staging/src/k8s.io/kubelet | 0 | 32
1189-
staging/src/k8s.io/kube-proxy | 0 | 0
1190-
staging/src/k8s.io/kube-scheduler | 0 | 0
1191-
staging/src/k8s.io/legacy-cloud-providers | 1281 | 2015
1192-
staging/src/k8s.io/metrics | 0 | 0
1193-
staging/src/k8s.io/mount-utils | 55 | 95
1194-
staging/src/k8s.io/pod-security-admission | 0 | 1
1195-
staging/src/k8s.io/sample-apiserver | 0 | 0
1196-
staging/src/k8s.io/sample-cli-plugin | 0 | 0
1197-
staging/src/k8s.io/sample-controller | 0 | 0
1198-
1199-
For Kubernetes 1.30, the focus is on client-go. APIs need to be extended
1110+
Component | Non-Structured Logging | Non-Contextual Logging
1111+
------ | ------- | ------- | ------
1112+
cmd/kube-apiserver | 2 | 3 |
1113+
pkg/auth | 1 | 1 |
1114+
pkg/certauthorization | 2 | 4 |
1115+
pkg/controller | 0 | 4 |
1116+
pkg/controlplane | 83 | 112 |
1117+
pkg/credentialprovider | 27 | 51 |
1118+
pkg/kubeapiserver | 3 | 17 |
1119+
pkg/kubectl | 1 | 2 |
1120+
pkg/kubelet | 1 | 1328 |
1121+
pkg/kubemark | 7 | 7 |
1122+
pkg/probe | 7 | 24 |
1123+
pkg/proxy | 2 | 138 |
1124+
pkg/registry | 58 | 113 |
1125+
pkg/routes | 2 | 2 |
1126+
pkg/scheduler | 2 | 2 |
1127+
pkg/serviceaccount | 30 | 52 |
1128+
pkg/util | 12 | 43 |
1129+
pkg/volume | 551 | 897 |
1130+
pkg/windows | 1 | 1 |
1131+
staging/src/k8s.io/apimachinery/pkg | 74 | 119
1132+
staging/src/k8s.io/apiserver | 322 | 739
1133+
staging/src/k8s.io/client-go | 107 | 190
1134+
1135+
The focus is now on client-go. APIs need to be extended
12001136
carefully without breaking existing code so that a context can be provided for
12011137
log calls. In some cases, this also makes a context available to code which
1202-
currently uses `context.TODO` as a stop-gap measure. Currently there are over
1203-
300 of those in `staging/src/k8s.io/client-go`. Whenever new APIs get
1138+
currently uses `context.TODO` as a stop-gap measure. Initially there were over
1139+
300 of those in `staging/src/k8s.io/client-go`, now 91 are left.
1140+
1141+
Whenever new APIs get
12041142
introduced, components which were already converted to contextual logging get
12051143
updated to use those.
12061144

keps/sig-instrumentation/3077-contextual-logging/kep.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ stage: beta
2424
# The most recent milestone for which work toward delivery of this KEP has been
2525
# done. This can be the current (upcoming) milestone, if it is being actively
2626
# worked on.
27-
latest-milestone: "v1.30"
27+
latest-milestone: "v1.35"
2828

2929
# The milestone at which this feature was, or is targeted to be, at each stage.
3030
milestone:

0 commit comments

Comments
 (0)