Skip to content
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

Merged
merged 1 commit into from
Apr 11, 2018
Merged

Implement verbosity feature for kubeadm #57661

merged 1 commit into from
Apr 11, 2018

Conversation

vbmade2000
Copy link
Contributor

@vbmade2000 vbmade2000 commented Dec 27, 2017

[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:

Implements verbosity logging feature for kubeadm commands

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Dec 27, 2017
@xiangpengzhao
Copy link
Contributor

/ok-to-test

@k8s-ci-robot k8s-ci-robot removed the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Dec 28, 2017
Copy link
Member

@luxas luxas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @kubernetes/sig-cluster-lifecycle-pr-reviews @ncdc @thockin @sttts @kubernetes/sig-cli-pr-reviews

What kind of logging solution would you prefer for kubeadm to implement?

@k8s-ci-robot k8s-ci-robot added sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. sig/cli Categorizes an issue or PR as relevant to SIG CLI. labels Dec 30, 2017
@sttts
Copy link
Contributor

sttts commented Jan 2, 2018

What kind of logging solution would you prefer for kubeadm to implement?

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.

@timothysc
Copy link
Member

I like logrus and we use it on our tools.

@timothysc timothysc assigned timothysc and unassigned jamiehannaford Jan 5, 2018
@vbmade2000
Copy link
Contributor Author

@timothysc Should We change it to use logrus then ? I am waiting for some conclusion so that I can work further on this issue.

@dixudx
Copy link
Member

dixudx commented Jan 11, 2018

Should We change it to use logrus then ?

@vbmade2000 Not now. Currently we still use glog in Kubernetes.

@vbmade2000
Copy link
Contributor Author

@dixudx Ok. So can I proceed further with glog ?

@dixudx
Copy link
Member

dixudx commented Jan 11, 2018

Ok. So can I proceed further with glog ?

@sttts Any objection on still using glog?

@jamiehannaford
Copy link
Contributor

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.

@vbmade2000
Copy link
Contributor Author

@luxas @timothysc Any conclusion ? This issue is pending since long time.

Copy link
Member

@timothysc timothysc left a 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.

@vbmade2000
Copy link
Contributor Author

@timothysc Sure.

I'm not a fan of the explicit leveling for most of the default statements, they should all be Infof for now.
Didn't get it.

Copy link
Contributor

@jamiehannaford jamiehannaford left a 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

@@ -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

Copy link
Contributor

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 :)

Copy link
Contributor Author

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 :)

}

// 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)
Copy link
Contributor

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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, should be: from:

Copy link
Contributor Author

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.

}

// 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")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bootstrapping

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it.

err := configutil.SetInitDynamicDefaults(cfg)
if err != nil {
return nil, err
}

glog.V(1).Infof("[init] Validating kubernetes version")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kubernetes (capitalised)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it.


// 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.")
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure.

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")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: configmap

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it.

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")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ClusterInfo

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it.

@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 12, 2018
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Mar 3, 2018
Copy link
Member

@timothysc timothysc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 5, 2018
@thockin
Copy link
Member

thockin commented Mar 5, 2018

This change is Reviewable

@xiangpengzhao
Copy link
Contributor

/retest

Fixes #340

Adds functionality to see logs with various level of verbosity.

Currently there are two verbosity levels: 0 and 1
Copy link
Member

@timothysc timothysc left a 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

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 10, 2018
@k8s-ci-robot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-github-robot
Copy link

/test all

Tests are more than 96 hours old. Re-running tests.

@k8s-github-robot
Copy link

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.

@k8s-github-robot k8s-github-robot merged commit 0023c41 into kubernetes:master Apr 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/cli Categorizes an issue or PR as relevant to SIG CLI. sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement different verbosity levels in kubeadm