-
Notifications
You must be signed in to change notification settings - Fork 40.1k
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
Implement verbosity feature for kubeadm #57661
Conversation
/ok-to-test |
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.
glog is still our logging library. Structured logging is mentioned once in a while, also at KubeCon again. But I haven't seen further investment into that. |
I like logrus and we use it on our tools. |
@timothysc Should We change it to use logrus then ? I am waiting for some conclusion so that I can work further on this issue. |
@vbmade2000 Not now. Currently we still use |
@dixudx Ok. So can I proceed further with glog ? |
@sttts Any objection on still using |
Since logrus is already listed as a dep, and the eventual aim is for kubeadm to live in its own repo, is there any reason why not to use it if most of us deem it a better tool? Just wondering if adhering to precedent is worth it here. |
@luxas @timothysc Any conclusion ? This issue is pending since long time. |
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 think it's fine to stay with glog. I'm not a fan of the explicit leveling for most of the default statements, they should all be Infof for now and we can decide later what their verbosity is.
@timothysc Sure.
|
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.
Thanks for submitting this! Generally LGTM, but I think we should document flag usage, especially the different verbosity levels
cmd/kubeadm/app/cmd/init.go
Outdated
@@ -120,6 +121,7 @@ func NewCmdInit(out io.Writer) *cobra.Command { | |||
Short: "Run this command in order to set up the Kubernetes master.", | |||
Run: func(cmd *cobra.Command, args []string) { | |||
var err 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: can you remove these extra lines? doesn't seem related to changeset. prefer to keep diffs small :)
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.
Sure. This is not a final push. This is just to show approach and get confirmation from members but thanks, I'll keep that in mind :)
cmd/kubeadm/app/cmd/init.go
Outdated
} | ||
|
||
// NewInit validates given arguments and instantiates Init struct with provided information. | ||
func NewInit(cfgPath string, cfg *kubeadmapi.MasterConfiguration, ignorePreflightErrors sets.String, skipTokenPrint, dryRun bool, criSocket string) (*Init, error) { | ||
|
||
if cfgPath != "" { | ||
glog.V(1).Infof("[init] Reading config file from : " + cfgPath) |
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.
So we only have two verbosity levels? 0 (default) and 1, right? might be good to document this somewhere
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.
Also, should be: from:
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.
Good observation for from:
. I'll take care of that from now on.
cmd/kubeadm/app/cmd/init.go
Outdated
} | ||
|
||
// Temporarily set cfg.CertificatesDir to the "real value" when writing controlplane manifests | ||
// This is needed for writing the right kind of manifests | ||
i.cfg.CertificatesDir = realCertsDir | ||
|
||
// PHASE 3: Bootstrap the control plane | ||
glog.V(1).Infof("[init] Bootstraping the control plane") |
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.
bootstrapping
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.
Got it.
cmd/kubeadm/app/cmd/init.go
Outdated
err := configutil.SetInitDynamicDefaults(cfg) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
glog.V(1).Infof("[init] Validating kubernetes version") |
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.
Kubernetes (capitalised)
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.
Got it.
cmd/kubeadm/app/cmd/init.go
Outdated
|
||
// Warn about the limitations with the current cloudprovider solution. | ||
if cfg.CloudProvider != "" { | ||
fmt.Println("[init] WARNING: For cloudprovider integrations to work --cloud-provider must be set for all kubelets in the cluster.") | ||
fmt.Println("\t(/etc/systemd/system/kubelet.service.d/10-kubeadm.conf should be edited for this purpose)") | ||
glog.Warningln("[init] For cloudprovider integrations to work --cloud-provider must be set for all kubelets in the cluster.") |
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.
Here you're terminating with a period .
, but in other places you remove them. Can we pick one style and make that consistent?
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.
Sure.
cmd/kubeadm/app/cmd/init.go
Outdated
if err := nodebootstraptokenphase.AutoApproveNodeCertificateRotation(client); err != nil { | ||
return err | ||
} | ||
|
||
// Create the cluster-info ConfigMap with the associated RBAC rules | ||
glog.V(1).Infof("[init] Creating bootstrap config map") |
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: configmap
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.
Got it.
cmd/kubeadm/app/cmd/init.go
Outdated
if err := clusterinfophase.CreateBootstrapConfigMapIfNotExists(client, adminKubeConfigPath); err != nil { | ||
return fmt.Errorf("error creating bootstrap configmap: %v", err) | ||
} | ||
glog.V(1).Infof("[init] Creating ClsuterInfo RBAC rules") |
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.
ClusterInfo
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.
Got it.
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
/retest |
Fixes #340 Adds functionality to see logs with various level of verbosity. Currently there are two verbosity levels: 0 and 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.
Thank you for the patch and your patience.
/lgtm
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: timothysc, vbmade2000 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 |
/test all Tests are more than 96 hours old. Re-running tests. |
Automatic merge from submit-queue (batch tested with PRs 59027, 62333, 57661, 62086, 61584). If you want to cherry-pick this change to another branch, please follow the instructions here. |
[WIP] Adds verbosity feature to init command hierarchy of kubeadm utility.
What this PR does / why we need it:
Implements verbosity feature to kubeadm
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes kubernetes/kubeadm#340
Special notes for your reviewer:
I will be splitting this work into a smaller PR to keep it separate and clean.
Release note: