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

remove broken --version flag, replace by version command #1956

Merged
merged 4 commits into from
Jan 24, 2023

Conversation

bjorand
Copy link
Contributor

@bjorand bjorand commented Jan 18, 2023

What this PR does / why we need it:

--version flag is broken in 2.7.0. It should return the version instead of trying to run kube-state-metrics.

here is the current broken behaviour:

$ kube-state-metrics --version
I0118 21:27:02.638112   80415 wrapper.go:98] Starting kube-state-metrics
I0118 21:27:02.640674   80415 server.go:185] "Used default resources"
I0118 21:27:02.641064   80415 types.go:184] "Using all namespaces"
I0118 21:27:02.641174   80415 server.go:218] "Metric allow-denylisting" allowDenyStatus="Excluding the following lists that were on denylist: "
W0118 21:27:02.641423   80415 client_config.go:618] Neither --kubeconfig nor --master was specified.  Using the inClusterConfig.  This might not work.
W0118 21:27:02.641503   80415 client_config.go:623] error creating inClusterConfig, falling back to default config: unable to load in-cluster configuration, KUBERNETES_SERVICE_HOST and KUBERNETES_SERVICE_PORT must be defined
E0118 21:27:02.642813   80415 wrapper.go:40] "Failed to run kube-state-metrics" err="failed to create client: invalid configuration: no configuration has been provided, try setting KUBERNETES_MASTER environment variable"

with this fix:

$ kube-state-metrics --version
kube-state-metrics, version  (branch: , revision: 689a1f5f4fd60cdb8a285d39875b0328923a5cc6)
  build user:
  build date:
  go version:       go1.19.5
  platform:         darwin/amd64

Note that I'm also removing useless code.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Jan 18, 2023
@k8s-ci-robot
Copy link
Contributor

@bjorand: This issue is currently awaiting triage.

If kube-state-metrics contributors determine this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

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.

@k8s-ci-robot
Copy link
Contributor

Welcome @bjorand!

It looks like this is your first PR to kubernetes/kube-state-metrics 🎉. 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/kube-state-metrics 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/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jan 18, 2023
@mrueg
Copy link
Member

mrueg commented Jan 19, 2023

There are currently two ways to show the version:

via a version command and via a version flag. The kube-state-metrics version command still works.
I don't think we need both and rather would remove one of them.
Any thoughts/preferences @kubernetes/kube-state-metrics-maintainers ?

@mrueg mrueg self-assigned this Jan 19, 2023
@fpetkovski
Copy link
Contributor

Is the help text of the command sufficient for users to find out they need to use kube-state-metrics version? I agree that we should not have two ways to show the version.

@bjorand
Copy link
Contributor Author

bjorand commented Jan 23, 2023

Is the help text of the command sufficient for users to find out they need to use kube-state-metrics version? I agree that we should not have two ways to show the version.

I agree. I removed the broken --version flag and we now have only the version command (which is documented in the help message)

@bjorand bjorand changed the title fix --version flag remove broken --version flag, replace by version command Jan 23, 2023
@mrueg
Copy link
Member

mrueg commented Jan 23, 2023

Can you also remove the version flag from help.txt? You can generate it via ./scripts/generate-help-text.sh

@bjorand
Copy link
Contributor Author

bjorand commented Jan 23, 2023

done in 57a196b

@mrueg
Copy link
Member

mrueg commented Jan 23, 2023

I think this change only updated the markdown file and not the help.txt.

@bjorand
Copy link
Contributor Author

bjorand commented Jan 23, 2023

I think this change only updated the markdown file and not the help.txt.

help.txt is in .gitignore

@mrueg
Copy link
Member

mrueg commented Jan 23, 2023

I think this change only updated the markdown file and not the help.txt.

help.txt is in .gitignore

Ah my mistake. I looked at my local checkout.

/approve

Thanks!

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 23, 2023
@mrueg
Copy link
Member

mrueg commented Jan 24, 2023

/lgtm

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bjorand, mrueg

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 merged commit bc7b5b6 into kubernetes:main Jan 24, 2023
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. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants