kubernetes-sigs / node-ipam-controller

Out of tree implementation of https://github.com/kubernetes/enhancements/tree/master/keps/sig-network/2593-multiple-cluster-cidrs
Apache License 2.0
9 stars 9 forks source link

Add support for json logging #7

Closed uablrek closed 8 months ago

uablrek commented 8 months ago

Based on https://github.com/kubernetes/component-base/blob/master/logs/example/stdlib/logger.go.

Simple example:

manager -logging-format json 2>&1 | jq
{
  "ts": 1706632637890.2253,
  "caller": "clientcmd/client_config.go:618",
  "msg": "Neither --kubeconfig nor --master was specified.  Using the inClusterConfig.  This might not work.",
  "v": 0
}
...

The call to klog.InitFlags(nil) is removed/replaced which it the right action according to @pohly.

Fixes: #6

mneverov commented 8 months ago

/approve

k8s-ci-robot commented 8 months ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mneverov, uablrek

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: - ~~[OWNERS](https://github.com/kubernetes-sigs/node-ipam-controller/blob/main/OWNERS)~~ [mneverov] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
mneverov commented 8 months ago

/lgtm