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

Wire up stats commands for daemonsets (#2006) #2086

Merged
merged 6 commits into from
Jan 24, 2019

Conversation

zknill
Copy link
Contributor

@zknill zknill commented Jan 15, 2019

DaemonSet stats are not currently shown in the cli stat command, web ui
or grafana dashboard. This commit adds daemonset support for stat.

Update stat command's help message to reference daemonsets.
Update the public-api to support stats for daemonsets.
Add tests for stat summary and api.

Add daemonset get/list/watch permissions to the linkerd-controller
cluster role that's created using the install command.
Update golden expectation test files for install command
yaml manifest output.

Update web UI with daemonsets
Update navigation, overview and pages to list daemonsets and the pods
associated to them.
Add daemonset paths to server, and ui apps.

Add grafana dashboard for daemonsets; a clone of the deployment
dashboard.

Fixes of #2006

Signed-off-by: Zak Knill zrjknill@gmail.com

@zknill
Copy link
Contributor Author

zknill commented Jan 15, 2019

Validation

To test, took the example project curl https://run.linkerd.io/emojivoto.yml > emojivoto.yaml , and updated the Deployments for web, voting and emoji to be DaemonSets

cli

linkerd stat all -n emojivoto
linkerd stat daemonset -n emojivoto
linkerd stat ds -n emojivoto

linkerd stat daemonset/emoji -n emojivoto
linkerd stat ds/web -n emojivoto

linkerd stat daemonsets --to ds/emoji -n emojivoto
linkerd stat daemonsets --from ds/web -n emojivoto

$ linkerd stat ds -n emojivoto
NAME     MESHED   SUCCESS      RPS   LATENCY_P50   LATENCY_P95   LATENCY_P99   TLS
emoji       1/1   100.00%   1.9rps           1ms           3ms           3ms    0%
voting      1/1    79.66%   1.0rps           1ms           3ms           4ms    0%
web         1/1    89.57%   1.9rps          10ms          37ms          40ms    0%

web UI

Pages checked;

  • /overview
  • /daemonsets
  • /namespaces/:namespace/daemonsets/:daemonset

grafana

Checked dashboard, and links from above pages of the web ui

@wmorgan
Copy link
Member

wmorgan commented Jan 15, 2019

Awesome, thanks for submitting this @zknill!

@wmorgan wmorgan requested a review from klingerf January 15, 2019 15:10
siggy added a commit that referenced this pull request Jan 15, 2019
Signed-off-by: Andrew Seigner <siggy@buoyant.io>
@siggy
Copy link
Member

siggy commented Jan 15, 2019

@zknill awesome! would you mind sharing your modified emojivoto/daemonsets config? bonus points for submitting it as a PR to https://github.com/BuoyantIO/emojivoto ;)

@siggy siggy self-requested a review January 15, 2019 18:44
Copy link
Member

@siggy siggy left a comment

Choose a reason for hiding this comment

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

This is really great work @zknill! Thank you so much for the contribution!

Had a few minor nits but overall this is good to go. 👍 💥

@@ -33,6 +35,7 @@ type APIResource int
// These constants enumerate Kubernetes resource types.
const (
CM APIResource = iota
Daemonset
Copy link
Member

Choose a reason for hiding this comment

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

mind naming this DS?

sp spinformers.ServiceProfileInformer
svc coreinformers.ServiceInformer
cm coreinformers.ConfigMapInformer
daemonset appv1informers.DaemonSetInformer
Copy link
Member

Choose a reason for hiding this comment

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

ds

err: nil,
k8sConfigs: []string{`
apiVersion: apps/v1
kind: DaemonSet
Copy link
Member

Choose a reason for hiding this comment

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

🙏

@@ -59,6 +59,7 @@ func newCmdStat() *cobra.Command {
Examples:
* deploy
* deploy/my-deploy
* ds/my-daemonset
Copy link
Member

Choose a reason for hiding this comment

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

a few lines below this, add daemonsets under Valid resource types include:

@zknill
Copy link
Contributor Author

zknill commented Jan 16, 2019

@siggy very happy to open a PR, but not super sure where / how it would fit into that project. It seems more logical for that repo to hold deployments for the services... anyhow, linked below is the daemonset config that I used for testing.

https://gist.github.com/zknill/c2253bad3cc2da0a0b3b10617d2f2bc8

@grampelberg
Copy link
Contributor

@zknill just create a secondary yaml named emojivoto-daemonset.yml in the root =) If you want extra brownie points, a PR on linkerd/website putting the same file at run.linkerd.io/public/emojivoto-daemonset.yml would be mind blowing!

Copy link
Contributor

@klingerf klingerf left a comment

Choose a reason for hiding this comment

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

@zknill Awesome work! So cool to see this wired all the way through.

It looks like your most recent commit doesn't include a DCO signoff. Can I trouble you to rewrite that commit to include it so that we can get this merged?

I also noticed that there's no live tap data showing up on the daemonset detail page in the web UI. This is because we haven't updated the linkerd tap and linkerd top commands to support daemonsets. For instance, on your branch, I get:

$ bin/linkerd tap ds/emoji -n emojivoto
Error: unsupported resource type [daemonset]

And in the web UI, I see:

screen shot 2019-01-16 at 10 57 40 am

(Note that for unrelated reasons that error doesn't show up when you run bin/linkerd dashboard (it silently swallows websocket errors), but it does show up when you run bin/web run)

Anyhow, I actually don't think it would be a lot more work to support daemonsets in tap and top, and it would be fine to do that as part of this branch or in a follow up branch -- whatever's easiest for you.

@@ -142,6 +142,7 @@ class Namespaces extends React.Component {
<NetworkGraph namespace={this.state.ns} deployments={metrics.deployment} />
}
{this.renderResourceSection("deployment", metrics.deployment)}
{this.renderResourceSection("daemonset", metrics.daemonset)}
Copy link
Contributor

Choose a reason for hiding this comment

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

This is super nit-picky: the renderResourceSection method converts the resource string "daemonset" to title-case, using the friendlyTitle method from web/app/js/components/util/Utils.js. There's a special case inside that function to convert "replicationcontroller" to "Replication Controllers", here:

if (resource === "replicationcontroller") {
titleCase = _startCase("replication controller");
}

My preference is to treat daemonsets similarly, by adding an additional special case for "daemonset", so that the headers are displayed as "Daemon Sets" instead of "Daemonsets".

]
},
"timezone": "",
"title": "Linkerd Daemonset",
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we call this "Linkerd DaemonSet" to match the Kubernetes casing?

siggy added a commit that referenced this pull request Jan 16, 2019
Depends on #2037, #2038, #2063, #2066, #2086, #2087, #2089

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
siggy added a commit that referenced this pull request Jan 16, 2019
Depends on #2037, #2038, #2063, #2066, #2086, #2087, #2089

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
siggy added a commit that referenced this pull request Jan 17, 2019
Signed-off-by: Andrew Seigner <siggy@buoyant.io>
@zknill
Copy link
Contributor Author

zknill commented Jan 18, 2019

Sorry for slow response, on holiday at the moment. I will be able to look into things on Sunday / Monday

@zknill
Copy link
Contributor Author

zknill commented Jan 22, 2019

Hi there @klingerf, I intentionally omitted the top command support because I thought it out of scope of the original ticket.

I can look at adding it as that experience for users of the UI isn't great.

It might be worth updating the other similar tickets for StatefulSets / Jobs to be clear that they will also need top support?

@zknill
Copy link
Contributor Author

zknill commented Jan 22, 2019

I am looking into top and tap commands next

siggy added a commit that referenced this pull request Jan 22, 2019
Signed-off-by: Andrew Seigner <siggy@buoyant.io>
Copy link
Member

@siggy siggy 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 all the updates @zknill ! one small doc nit (and a rebase from master), and then this is good to go.

cli/cmd/top.go Outdated
@@ -283,9 +283,11 @@ func newCmdTop() *cobra.Command {
* deploy
* deploy/my-deploy
* deploy my-deploy
* ds/my-deploy
Copy link
Member

Choose a reason for hiding this comment

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

ds/my-daemonset ;)

Copy link
Contributor

@dadjeibaah dadjeibaah left a comment

Choose a reason for hiding this comment

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

This all looks great @zknill! The only thing left to do is just rebase off of master like siggy mentioned

@zknill
Copy link
Contributor Author

zknill commented Jan 24, 2019

Yes ofc, sorry all!

I'm sure you appreciate it's sometimes hard to find the time to do all the things - I've not forgotten!

DaemonSet stats are not currently shown in the cli stat command, web ui
or grafana dashboard. This commit adds daemonset support for stat.

Update stat command's help message to reference daemonsets.
Update the public-api to support stats for daemonsets.
Add tests for stat summary and api.

Add daemonset get/list/watch permissions to the linkerd-controller
cluster role that's created using the install command.
Update golden expectation test files for install command
yaml manifest output.

Update web UI with daemonsets
Update navigation, overview and pages to list daemonsets and the pods
associated to them.
Add daemonset paths to server, and ui apps.

Add grafana dashboard for daemonsets; a clone of the deployment
dashboard.

Update dependencies and dockerfile hashes

Fixes of linkerd#2006

Signed-off-by: Zak Knill <zrjknill@gmail.com>
Update daemonset in controller to use short form name
Reorder the fields and methods to still be alphabetical

List daemonset as one of the supported stat resources in cli help text

Signed-off-by: Zak Knill <zrjknill@gmail.com>
Update grafana dashboard name to match kubernetes case; DasemonSet
Update friendlyTitle for web UI to be "daemon set"

Signed-off-by: Zak Knill <zrjknill@gmail.com>
The web UI support DaemonSets but the Live Calls section will error
without support for the tap and top commands.

Update tap and top commands with DaemonSet support.

Signed-off-by: Zak Knill <zrjknill@gmail.com>
Signed-off-by: Zak Knill <zrjknill@gmail.com>
@zknill
Copy link
Contributor Author

zknill commented Jan 24, 2019

I think I've got everything; rebase and all

Let me know if there are other tweaks to be made! 🙏

siggy added a commit that referenced this pull request Jan 24, 2019
Signed-off-by: Andrew Seigner <siggy@buoyant.io>
siggy added a commit that referenced this pull request Jan 24, 2019
Relates to #2086

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
Copy link
Member

@siggy siggy left a comment

Choose a reason for hiding this comment

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

So close @zknill ! I think all the changes in master caused some test failures, and surfaced a new issue, I've taken a crack at addressing things in a commit, feel free to pull this into your branch and verify:
eb5ed7b

Relates to linkerd#2086

Signed-off-by: Andrew Seigner <siggy@buoyant.io>
@zknill
Copy link
Contributor Author

zknill commented Jan 24, 2019

@siggy thank you so much for this! (not quite sure how this slipped through the net)

I've picked the commit, and rechecked the UI and stat, top and tap cli comamnds.

Thanks for all your help, I appreciate your time!

Copy link
Member

@siggy siggy left a comment

Choose a reason for hiding this comment

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

Awesome work @zknill ! Thanks for sticking with us through all the review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants