Change:
For structured logging migration we have developed a tool to klog invocations For a given directory logcheck validates two things: directory is fully migrated - check if there are non-structured logging calls like usage of and is correct - check if key values passed are paired. We run logcheck as part of Kubernetes verify scripts on directories listed in Directories listed in are marked as migrated to avoid regressions from organized migration, however there are also other code locations that already use new functions that are not yet ready to be marked as migrated (components that are not part of organized migrations are done as best effort). We should split checking if directory was migrated from correctness of new functions and scan whole codebase for correctness. Plan: Add a flag to logcheck for requiring that directory was migrated. Add to verify-strucured- running logcheck of whole k/k codebase to check correctness This will ensure higher quality of migration PRs by validating correctness of directories that were not yet in .structuredlogging /wg structured-logging /cc
I'd like to pick this up. Do I need to wait till it is triage/accepted?
/triage accepted
Feel free to pick it up :P Usually I don't want to self triage, but this issue is purely Structured Logging WG related.
/assign
[Case 2: Correct usage] If the directory is not marked as migrated, we check that it's usage of is correct and don't care about usage of . By default, CI will test for correctness of whole k/k codebase instead of testing for complete migration (which is the current behavior). And to test for migration, a new flag must be passed explicitly. is this the expectation?
To clarify, let me rephrase. Current state is What we want: [Case 2: Correct usage] tested on whole repository
If this is the case, I can start implementing it.
SG, thanks for the help.
/milestone v1.22 Part of work go graduate Structured Logging KEP to beta.
I don't think work here has finished. We still need to implement those changes in k/k repo: Cut new klog Bump klog in k/k Update the script ./hack/verify-structured- /reopen
Reopened this issue. <detailsIn response to : I don't think work here has finished. We still need to implement those changes in k/k repo: Update the script /reopen </details
Why do we need to cut a new klog and bump in k/k? Can't we make latest logcheck available to k/k without it? I don't know the process.
Hmm, We could try without updating to update. Please send PR that will update ./hack/verify-structured- If updating klog is nesesery feel free to contact for help
If we do both, we'd have to run logcheck twice (with and without flag) which means test time will increase.
This depends on implementation, increasing running time is ok as long it's reasonable, for example x1.5, but not x10.
Due to v1.22 code freeze, I'm moving this issue to the next release. /milestone v1.23
We would like to have static analysis setup before we start migrating logs in 1.23. will you be able to work on it this week? Do you need any help?
Yes, I can. PR kubernetes/kubernetes/pull/ is up for enabling static analysis. It has some unresolved conversations. It'd be helpful if I could get another round of review on that PR. Before we merge that we'd need to fix existing logging issues which are listed here: If I could get help fixing those it'd be great. Else I can fix it too.
I see two issues that need to be addressed: Fix handling of in klog code, this should be done by creating an issue to klog () Fix remaining errors Upgrade klog version to pick up fix for Exit

Discussion:
echo "Starting etcd" ETCD_DIR=$(mktemp -d -t kube-integration.XXXXXX) <del> trap "rm -rf ${ETCD_DIR}" EXIT </del> (etcd -name test -data-dir ${ETCD_DIR} &> /tmp/etcd.log) & ETCD_PID=$!

API_PORT=8080 KUBELET_PORT=10250 <ins> GO_OUT=$(dirname $0)/../output/go </ins> <del> $(dirname $0)/../output/go/apiserver  </del> <ins> APISERVER_LOG=/tmp/apiserver.log ${GO_OUT}/apiserver  </ins> --address="127.0.0.1"  --port="${API_PORT}"  --etcd_servers="http://127.0.0.1:4001"  <del> --machines="127.0.0.1" &> /tmp/apiserver.log & </del> <ins> --machines="127.0.0.1" &> ${APISERVER_LOG} & </ins> APISERVER_PID=$! <del> $(dirname $0)/../output/go/controller-manager  </del> <ins> CTLRMGR_LOG=/tmp/controller-manager.log ${GO_OUT}/controller-manager  </ins> --etcd_servers="http://127.0.0.1:4001"  <del> --master="127.0.0.1:${API_PORT}" &> /tmp/controller-manager.log & </del> <ins> --master="127.0.0.1:${API_PORT}" &> ${CTLRMGR_LOG} & </ins> CTLRMGR_PID=$! <del> $(dirname $0)/../output/go/kubelet  </del> <ins> KUBELET_LOG=/tmp/kubelet.log ${GO_OUT}/kubelet  </ins> --etcd_servers="http://127.0.0.1:4001"  --hostname_override="127.0.0.1"  --address="127.0.0.1"  <del> --port="$KUBELET_PORT" &> /tmp/kubelet.log & </del> <ins> --port="$KUBELET_PORT" &> ${KUBELET_LOG} & </ins> KUBELET_PID=$! <del> echo "Local Kubernetes cluster is running. Press enter to shut it down." read unused kill ${APISERVER_PID} kill ${CTLRMGR_PID} kill ${KUBELET_PID} kill ${ETCD_PID} </del> <ins> echo "Local Kubernetes cluster is running. Press Ctrl-C to shut it down." echo "Logs: " echo "  ${APISERVER_LOG}" echo "  ${CTLRMGR_LOG}" echo "  ${KUBELET_LOG}" cleanup() { echo "Cleaning up..." kill ${APISERVER_PID} kill ${CTLRMGR_PID} kill ${KUBELET_PID} kill ${ETCD_PID} rm -rf ${ETCD_DIR} exit 0 } trap cleanup EXIT while true; do read x; done </ins>