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
use contextual logging(nodeipam and nodelifecycle part) #112670
Conversation
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.
/cc @bowei
/sig instrumentation
/wg structured-logging
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.
/retest
/assign @pohly |
/triage accepted |
klog.Fatalf("kubeClient is nil when starting NodeController") | ||
klog.ErrorS(nil, "kubeClient is nil when starting NodeController") | ||
// ACTION REQUIRED: Exit code changed from 255 to 1 | ||
os.Exit(1) |
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.
Instead of os.Exit
, please use klog.FlushAndExit
. os.Exit
itself does not flush buffered log messages.
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.
ok, I will update
klog.Fatalf("kubeClient is nil when starting NodeController") | ||
klog.ErrorS(nil, "kubeClient is nil when starting NodeController") | ||
// ACTION REQUIRED: Exit code changed from 255 to 1 | ||
os.Exit(1) |
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.
Please use klog.FlushAndExit(1)
.
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.
I'm also not sure about the // ACTION REQUIRED
comment. I think mentioning that in the changenote for the PR is enough. Applies also below.
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.
let me update
klog.Fatalf("client is nil") | ||
klog.ErrorS(nil, "client is nil") | ||
// ACTION REQUIRED: Exit code changed from 255 to 1 | ||
os.Exit(1) |
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.
klog.FlushAndExit(1)
klog.Fatalf("kubeClient is nil when starting NodeController") | ||
klog.ErrorS(nil, "kubeClient is nil when starting NodeController") | ||
// ACTION REQUIRED: Exit code changed from 255 to 1 | ||
os.Exit(1) |
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.
klog.FlushAndExit(1)
klog.Fatalf("kubeClient is nil when starting Controller") | ||
klog.ErrorS(nil, "kubeClient is nil when starting Controller") | ||
// ACTION REQUIRED: Exit code changed from 255 to 1 | ||
os.Exit(1) |
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.
klog.FlushAndExit(1)
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.
Or return an error? This function can do that. I haven't checked the others.
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.
yeah, maybe return a error is better here.
6008ac1
to
27eec16
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.
/cc @pohly I have updated all suggestions, Could you please take a look again?
@@ -86,13 +86,13 @@ var _ CIDRAllocator = (*cloudCIDRAllocator)(nil) | |||
// NewCloudCIDRAllocator creates a new cloud CIDR allocator. | |||
func NewCloudCIDRAllocator(client clientset.Interface, cloud cloudprovider.Interface, nodeInformer informers.NodeInformer) (CIDRAllocator, error) { | |||
if client == nil { | |||
klog.Fatalf("kubeClient is nil when starting NodeController") | |||
return nil, fmt.Errorf("kubeClient is nil when starting cloud CIDR allocator") |
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.
nit: When there's no need for formatting, use errors.New
. Also applies below.
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.
Looks like errors
now gets imported too often:
/home/prow/go/src/k8s.io/kubernetes/_output/local/go/src/k8s.io/kubernetes/pkg/controller/nodeipam/ipam/cloud_cidr_allocator.go:34:2: errors redeclared in this block
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.
Yeah, I have updated it.
27eec16
to
5ad03a8
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.
/lgtm
5ad03a8
to
1d1a239
Compare
/lgtm For approval. |
bbd1b87
to
e4663b6
Compare
e4663b6
to
0883222
Compare
0883222
to
c322758
Compare
/lgtm Thanks for keeping the PR up-to-date. We should be able to get it merged soon. |
LGTM label has been added. Git tree hash: c12415be1c8fb0a6bd85649d3850b04972f7a808
|
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.
/approve
@@ -181,28 +184,34 @@ func NewMultiCIDRRangeAllocator( | |||
ra.cidrQueue.Add(key) | |||
} | |||
}, | |||
//AddFunc: createClusterCIDRHandler(func(ccc *networkingv1alpha1.ClusterCIDR) error { |
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.
Nit: this should be removed
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.
done
/priority important-longterm |
c322758
to
780ef3a
Compare
/lgtm |
LGTM label has been added. Git tree hash: 6f75bb255f7e541f8c0542b3ef391f3891e8267d
|
/assign @dims For approval in cmd/cloud-controller-manager. |
changes under /approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: aojea, dims, pohly, soltysh, yangjunmyfm192085 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 |
The Kubernetes project has merge-blocking tests that are currently too flaky to consistently pass. This bot retests PRs for certain kubernetes repos according to the following rules:
You can:
/retest |
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
same as #111708
use klog.InfoS instead of klog.V(0).InfoS
As mentioned in the issue kubernetes-sigs/logtools#2, Calling V with zero as parameter just causes additional overhead, so we need to avoid this scenario
And the corresponding files are also log structured
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: