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 shortnames for endpointslices #117742

Closed

Conversation

hysyeah
Copy link
Contributor

@hysyeah hysyeah commented May 3, 2023

What type of PR is this?

/kind feature

What this PR does / why we need it:

Add shortnames for endpointslices, better UX.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?

The short name eps was introduced for the resource endpointslices.

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. kind/feature Categorizes issue or PR as related to a new feature. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels May 3, 2023
@k8s-ci-robot
Copy link
Contributor

Hi @hysyeah. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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 k8s-ci-robot added the needs-priority Indicates a PR lacks a `priority/foo` label and requires one. label May 3, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: hysyeah
Once this PR has been reviewed and has the lgtm label, please assign lavalamp for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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

@dims
Copy link
Member

dims commented May 3, 2023

/sig network

@k8s-ci-robot k8s-ci-robot added sig/network Categorizes an issue or PR as relevant to SIG Network. release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. release-note-none Denotes a PR that doesn't merit a release note. labels May 3, 2023
@danwinship
Copy link
Contributor

This seems like it makes sense... we definitely use that abbreviation in places.
I'm not sure if there are other places that need modifications...

/assign @robscott
who would know if there was some reason we never did this before

@hysyeah
Copy link
Contributor Author

hysyeah commented May 9, 2023

I'm not sure if there are other places that need modifications...

no other places that need modifications for shortname

Copy link
Member

@robscott robscott left a comment

Choose a reason for hiding this comment

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

Thanks @hysyeah! This was an accidental omission so thanks for catching this.


// ShortNames implements the ShortNamesProvider interface. Returns a list of short names for a resource.
func (r *REST) ShortNames() []string {
return []string{"epslice"}
Copy link
Member

Choose a reason for hiding this comment

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

I think I'd prefer "eps" here. This would correspond with the "ep" used for Endpoints:

For what it's worth, kubectl get eps does not currently resolve in a Kubernetes cluster for me:

➜  ~ kubectl get eps
error: the server doesn't have a resource type "eps"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think I'd prefer "eps" here. This would correspond with the "ep" used for Endpoints

I changed it to "eps"

@@ -0,0 +1,51 @@
/*
Copyright 2021 The Kubernetes Authors.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Copyright 2021 The Kubernetes Authors.
Copyright 2023 The Kubernetes Authors.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have corrected it

@hysyeah hysyeah force-pushed the feature/endpointslice-shortnames branch from dd220f9 to f585bcc Compare May 9, 2023 16:05
@hysyeah hysyeah force-pushed the feature/endpointslice-shortnames branch from f585bcc to 3b85974 Compare May 9, 2023 16:07
@hysyeah hysyeah requested a review from robscott May 11, 2023 14:11
@robscott
Copy link
Member

Thanks @hysyeah!

/lgtm
/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. lgtm "Looks good to me", indicates that a PR is ready to be merged. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels May 11, 2023
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: e33e8450dbf32a26d2e035074954056c62e9bee2

@k8s-ci-robot k8s-ci-robot removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels May 11, 2023
@aojea
Copy link
Member

aojea commented May 12, 2023

/assign @liggitt @thockin

@thockin
Copy link
Member

thockin commented May 12, 2023

I thought we had a general moratorium on new shortnames - do I misremember that, @liggitt ?

@liggitt
Copy link
Member

liggitt commented May 12, 2023

I don't recall either way, but given they lead to ambiguous outcomes (see #117668) we should maybe discourage adding new official ones?

@liggitt
Copy link
Member

liggitt commented May 12, 2023

also, endpointslices doesn't seem egregious to type out

@liggitt
Copy link
Member

liggitt commented May 12, 2023

looks like #117535 and #116208 just merged adding more ... if we're unsure about adding new official shortnames, we should revert those until we're sure this is a good direction

@thockin
Copy link
Member

thockin commented May 12, 2023 via email

@liggitt
Copy link
Member

liggitt commented May 12, 2023

Both autocomplete (already exists, used like kubectl get mut<tab> expanding to mutatingwebhookconfigurations...) and locally defined aliases (proposed but not implemented) seem like better solutions than server defined possibly-ambiguous shortnames

cc @hysyeah @kkkkun @wojtek-t @jpbetz @MikeSpreitzer as authors/reviewers on the other PRs adding new shortnames to 1.28 in the last ~week

@liggitt
Copy link
Member

liggitt commented May 12, 2023

/hold

@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 May 12, 2023
@smarterclayton
Copy link
Contributor

Shouldn’t shortnames be under api review? Is the issue the number of types we add, or colliding with ecosystem names? We can certainly have a higher bar for adding a short name,

Names are egregious to type out, i can’t say i’ve typed anything but rs or sts in the last five years. I’m not sure many humans type mutatingwebhookconfigurstion and agree autocomplete handles the non core types. If it’s something you type all the time, a short name is an affordance for humans.

Wish we had data on prevalence of use…

@thockin
Copy link
Member

thockin commented May 12, 2023 via email

@liggitt
Copy link
Member

liggitt commented May 12, 2023

Shouldn’t shortnames be under api review?

they definitely should be since they're API surface, but mechanically weren't because the implementation put the definition in registry packages

Is the issue the number of types we add, or colliding with ecosystem names?

Poor behavior in collision cases, and that shortnames, aliases, and unqualified singular and plural resource names are all in the kubectl fuzzy matching bucket, so adding a CRD with an actual resource type of sts "breaks" the StatefulSet shortname (I think…)

@liggitt
Copy link
Member

liggitt commented May 12, 2023

Can we fail to load if we find conflicting shortnames?

I … don't know… #117668 was exploring what to do in ambiguous situations … goals of being user friendly, safe, and compatible are sort of at odds here

@hysyeah
Copy link
Contributor Author

hysyeah commented May 13, 2023

The shortnames "eps" does not colliding with other names.
Personally, endpointslice is a resource that need frequent visits, shortname may be more convenient.

@kkkkun
Copy link
Member

kkkkun commented May 13, 2023

Both autocomplete (already exists, used like kubectl get mut<tab> expanding to mutatingwebhookconfigurations...) and locally defined aliases (proposed but not implemented) seem like better solutions than server defined possibly-ambiguous shortnames

cc @hysyeah @kkkkun @wojtek-t @jpbetz @MikeSpreitzer as authors/reviewers on the other PRs adding new shortnames to 1.28 in the last ~week

I agree we should add shortnames to kubectl. We should not change service define and should revert these.

@liggitt
Copy link
Member

liggitt commented May 13, 2023

Opened #117993 to undo the just-merged PRs until the path forward is determined, and opened #117995 to capture discovery endpoint output in the api/ package which ensures we don't accidentally change stuff there without API review

@humblec
Copy link
Contributor

humblec commented May 14, 2023

The inconsistency of available shortnames ( some {lengthy} types have , but not all) is not good as well. I think we should have clear definition /criteria on this. May be we have such requirement documented somewhere ? 🤔 , I failed to find though.

@thockin
Copy link
Member

thockin commented May 15, 2023

If we are going to support client-side shortcuts, we should emit a message to that effect or even disallow aliases when running in a script (not 100% sure how to tell - there must be a way). Is there a KEP?

e.g.

$ kubectl get po
<stderr>shortname 'po' resolved to 'pods'
NAME                                                              READY   STATUS      RESTARTS   AGE
iamyouare-5c6cf5d54b-ldvzp                                        1/1     Running     0          13d
iamyouare-5c6cf5d54b-rbqp9                                        1/1     Running     0          13d
$ ./myscript_which_calls_kubectl.sh
<stderr>shortname resolution is not supported in non-interactive mode: 'po'

$ echo $?
99

@thockin thockin closed this May 15, 2023
@thockin
Copy link
Member

thockin commented May 15, 2023

Do we have a place to document the moratorium?

@liggitt
Copy link
Member

liggitt commented May 17, 2023

Do we have a place to document the moratorium?

hmm, not a great place, but https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md didn't have anything about short names or categories, so opened kubernetes/community#7299

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/network Categorizes an issue or PR as relevant to SIG Network. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet