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

Add plugin view-allocations 0.5.0 #294

Merged
merged 5 commits into from
Nov 18, 2019

Conversation

davidB
Copy link
Contributor

@davidB davidB commented Oct 31, 2019

This plugin lists allocations (cpu, memory, gpu,... X requested, limit, allocatable,...).

[x] Make sure you read the Plugin Naming Guide: https://sigs.k8s.io/krew/docs/NAMING_GUIDE.md
[x] Verify you can install your plugin locally: kubectl krew install --manifest=[...] --archive=[...]

Thanks

@k8s-ci-robot
Copy link
Contributor

Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please follow instructions at https://git.k8s.io/community/CLA.md#the-contributor-license-agreement to sign the CLA.

It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.


Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Oct 31, 2019
@k8s-ci-robot
Copy link
Contributor

Welcome @davidB!

It looks like this is your first PR to kubernetes-sigs/krew-index 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/krew-index has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Oct 31, 2019
@davidB
Copy link
Contributor Author

davidB commented Oct 31, 2019

I signed it

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Oct 31, 2019
Copy link
Contributor

@corneliusweig corneliusweig 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 great helper! I'll definitely use it :)

I left a few comments in-line. Mainly, I think you should improve the documentation which will also help for plugin adoption. It's easy to get started, but you should take some time to think how to explain the meaning of the output. Otherwise, many potential users will lose interest and not use it.

shortDescription: Prints the environment variables.
homepage: /~https://github.com/davidB/kubectl-view-allocations # optional, url for the project homepage
description: |
This plugin lists allocations (cpu, memory, gpu,... X requested, limit, allocatable,...).
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would be worth to briefly explain the difference between kubectl top nodes and your plugin.

Also, could you explain a little more what is the meaning of the columns in your output (should not be here but on the project page). It will help the adoption of your tool, if you elaborate on Request, Limit and how that connects to a given container resource request spec.

@corneliusweig
Copy link
Contributor

@davidB Also you should think about distributing statically linked binaries. I'm on a pretty normal Linux system and I get:

        linux-vdso.so.1 (0x00007fffb45bc000)
        libssl.so.1.1 => not found
        libcrypto.so.1.1 => not found
        libdl.so.2 => /lib64/libdl.so.2 (0x00007f9dbf4e7000)
        librt.so.1 => /lib64/librt.so.1 (0x00007f9dbf4dd000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f9dbf4ba000)
        libgcc_s.so.1 => /usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/libgcc_s.so.1 (0x00007f9dbf2a2000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f9dbf0d1000)
        libm.so.6 => /lib64/libm.so.6 (0x00007f9dbef94000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f9dbfb25000)

@davidB
Copy link
Contributor Author

davidB commented Oct 31, 2019

Thanks for your useful the feedback, I'll fix them.

@ahmetb
Copy link
Member

ahmetb commented Nov 4, 2019

Also please make sure you import the Rust equivalent of Go package:

import _ "k8s.io/client-go/plugin/pkg/client/auth"

so cloud k8s clusters work with this plugin. I assume you use api directly and not shell out to kubectl.

@davidB
Copy link
Contributor Author

davidB commented Nov 5, 2019

@ahmetb Do you meet an issue ? I used the kube-rs lib. The lib is young. About auth part, the lib works/tested with gcp, minikube and oidc token but with some limititations (eg: no update of the token stored into kubeconfig).

@davidB
Copy link
Contributor Author

davidB commented Nov 5, 2019

For changes related to the README/documentation of the project and compilation (why openssl is not statictly linked,...) they will be part of the next release of the plugin (after this week, I'm in biz trip and I don't have access to dektop config to debug the linking issue,...).

@ahmetb
Copy link
Member

ahmetb commented Nov 5, 2019

thread 'main' panicked at 'failed to load kubeconfig: Error { inner:

Error loading kube config: Missing GOOGLE_APPLICATION_CREDENTIALS env }', src/libcore/result.rs:1084:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
[1]    95119 abort      kubectl view-allocations

Doesn't work well on GCP. :(
Ideally you shouldn't need $GOOGLE_APPLICATION_CREDENTIALS, kubectl doesn't. It just calls into gcloud config config-helper --format=json to get an access_token+expiration.

@ahmetb
Copy link
Member

ahmetb commented Nov 5, 2019

I also don't think you should need static linking for sure, I'm ok with having dynamically linking plugin binaries, especially given the benefits of OS package manager updating those common libraries on the client machine frequently.

@ahmetb
Copy link
Member

ahmetb commented Nov 15, 2019

/hold

Until the auth issues are fixed. We can get the plugin in, but I don't think most users on cloud providers will be able to take advantage of it. I left a comment at kube-rs/kube#84 on how client-go authenticates to GCP. Hope someone implements it.

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 15, 2019
@davidB
Copy link
Contributor Author

davidB commented Nov 15, 2019

I should release a new version next week(end) with more static-linked dependency, and maybe a workaround to manage expired token (until kube-rs include a cleaner solution, may I'll made a PR).
I'll update this PR after the release of my plugin.

@ahmetb
Copy link
Member

ahmetb commented Nov 15, 2019

/hold

@davidB davidB changed the title Add plugin view-allocations 0.4.0 Add plugin view-allocations 0.5.0 Nov 16, 2019
@davidB
Copy link
Contributor Author

davidB commented Nov 16, 2019

kubectl-view-allocations 0.5.0 was released, with fixes for reported issue

  • openssl is staticly linked
  • include a workaround to managed expired access-token (not tested of GKE)
  • update README, description

feedbacks are welcome.

Copy link
Contributor

@corneliusweig corneliusweig left a comment

Choose a reason for hiding this comment

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

Hi! Thanks for submitting a second revision. This revision I could test on my machine, and it looks pretty neat!

My major point about improving the documentation still stands, though. I see that you added some more sections on the plugins README, but this still does not explain what that means. In particular, you should think about how you can explain the meaning of the columns. Please see my comment above how you could improve this.

We can merge without the docs improvements, but you really should invest some time here, if you want your plugin to be used.

There is one more important change to make: please include and install a LICENSE file.

Finally, can you comment about the GKE auth status? I could not test this -- so is it working already?

matchLabels:
os: darwin
arch: amd64
uri: /~https://github.com/davidB/kubectl-view-allocations/releases/download/0.5.0/kubectl-view-allocations_0.5.0-x86_64-apple-darwin.tar.gz
Copy link
Contributor

Choose a reason for hiding this comment

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

You should also install a license file. As you are defaulting to the copy-all rule, it will be sufficient to just include the LICENSE file in your plugin archive.

@davidB
Copy link
Contributor Author

davidB commented Nov 18, 2019

Hi do not have access to any GKE cluster, but I guess my workaround should work, @ahmetb can give a quick try to this version please ?

@corneliusweig I include the LICENSE.txt for the next version (0.5.1), I'll release it this week after adding info to the README. Can you update the /~https://github.com/kubernetes-sigs/krew/blob/master/docs/DEVELOPER_GUIDE.md with the requirement about LICENSE file for coming developer ?

Thanks for your valuable feedback.

@corneliusweig
Copy link
Contributor

@davidB kubernetes-sigs/krew#394 was merged yesterday. Would you see the need for more information around this?

Btw, you were just unlucky with regards to the license. We are in the process of making this a requirement for plugins.

@davidB
Copy link
Contributor Author

davidB commented Nov 18, 2019

the file is named LICENSE.txt in my archives (and project) is it OK ?

@corneliusweig
Copy link
Contributor

the file is named LICENSE.txt in my archives (and project) is it OK ?

Yes absolutely. Ensuring that the license is there is part of the review. As long as it is clear that this is a license file, you can pick whatever you like.

@davidB
Copy link
Contributor Author

davidB commented Nov 18, 2019

I also update the README.md (description) on github.

@corneliusweig
Copy link
Contributor

Hi @davidB, login on GKE looks good now 👍.

My recommendation would be to also include more help text in the command itself, i.e. when running kubectl view-allocations --help. Also, you can try to improve the description in the manifest. Currently, it's hard to understand. Let's re-iterate this with the next version.

/lgtm
/approve
/hold cancel

@k8s-ci-robot k8s-ci-robot added lgtm "Looks good to me", indicates that a PR is ready to be merged. and removed do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. labels Nov 18, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: corneliusweig, davidB

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-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 18, 2019
@k8s-ci-robot k8s-ci-robot merged commit 581cdf7 into kubernetes-sigs:master Nov 18, 2019
@davidB davidB deleted the view-allocations-0.4.0 branch April 8, 2023 19:06
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. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants