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

Move pkg util strings/keymutex from kubernetes kubernetes #55

Merged

Conversation

dims
Copy link
Member

@dims dims commented Oct 19, 2018

This is to help with the larger effort around breaking up cloud providers and moving them out of tree.

Fixes #62

@k8s-ci-robot k8s-ci-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Oct 19, 2018
@dims
Copy link
Member Author

dims commented Oct 19, 2018

/assign @thockin
cc @mcrute @andrewsykim

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


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If you signed the CLA as a corporation, please sign in with your organization's credentials at https://identity.linuxfoundation.org/projects/cncf to be authorized.
  • If you have done the above and are still having issues with the CLA being reported as unsigned, please email the CNCF helpdesk: [email protected]

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 19, 2018
@dims dims changed the title Move pkg util strings from kubernetes kubernetes Move pkg util strings/keymutex from kubernetes kubernetes Oct 19, 2018
@dims
Copy link
Member Author

dims commented Oct 19, 2018

related to kubernetes/kubernetes#69585

Copy link
Contributor

@mcrute mcrute left a comment

Choose a reason for hiding this comment

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

The README says that this package is supposed to be go gettable so it might be worth dropping the Bazel BUILD files. I ended up removing them from the packages I've imported.

}

// isVowel returns true if the rune is a vowel (case insensitive).
func isVowel(c rune) bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

It might be worth exporting this since it could be used to eliminate some duplicate code in apiserver

}

// Acquires a lock associated with the specified ID.
func (km *hashedKeyMutex) LockKey(id string) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Does golint pass on this package? I thought it complained about comments not starting with function names. New code should be golint clean (he says, realizing now that he forgot to check for his PRs).

Copy link
Member Author

Choose a reason for hiding this comment

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

travis seems to test at least gofmt and vet. though not go lint. if we want to do golint, we should start by adding it there there and not start on this PR

Copy link
Contributor

Choose a reason for hiding this comment

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

That's fair. I need to do it with my merged code as well so I'll raise a PR with those changes independent of this one.

Copy link
Member

Choose a reason for hiding this comment

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

Getting clean lint and vet should be a requirement for packages promoted to util

@mcrute
Copy link
Contributor

mcrute commented Oct 19, 2018

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 19, 2018
}

// Acquires a lock associated with the specified ID.
func (km *hashedKeyMutex) LockKey(id string) {
Copy link
Member

Choose a reason for hiding this comment

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

Getting clean lint and vet should be a requirement for packages promoted to util

return strings.Replace(in, "~", "/", -1)
}

// EscapeQualifiedNameForDisk converts a plugin name, which might contain a / into a
Copy link
Member

Choose a reason for hiding this comment

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

Is it just me or are these 2 sets of functions exactly the same? Can we get rid of one? we could also rename this more generally, e.g. EscapePath or EscapeQualifiedName ?

Copy link
Member Author

Choose a reason for hiding this comment

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

@thockin we enforce vet in travis CI, but we don't do golint. I've filed a PR for that in #56

Copy link
Member Author

Choose a reason for hiding this comment

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

Done. dropping ForDisk from the names

Copy link
Member Author

Choose a reason for hiding this comment

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

Done. dropping ForDisk from the names

Copy link
Member Author

Choose a reason for hiding this comment

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

Dropped ForDisk from method names

Copy link
Member Author

Choose a reason for hiding this comment

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

Dropped ForDisk from method names

}

// IsVowel returns true if the rune is a vowel (case insensitive).
func IsVowel(c rune) bool {
Copy link
Member

Choose a reason for hiding this comment

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

We have a test for this in staging/src/k8s.io/apiserver/pkg/endpoints/installer_test.go and that pkg seems to be the only user of this function. Oh, and they have their own copy of this. Can we nuke this?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ack. removing this

@dims dims force-pushed the move-pkg-util-strings-from-kubernetes-kubernetes branch from ad8dbf5 to 08cbc5b Compare October 21, 2018 23:47
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 21, 2018
@dims dims force-pushed the move-pkg-util-strings-from-kubernetes-kubernetes branch from 08cbc5b to ddab25b Compare October 22, 2018 19:44
- Move
https://github.com/kubernetes/kubernetes/tree/master/pkg/util/strings to
k8s.io/utils/strings
- Move
https://github.com/kubernetes/kubernetes/tree/master/pkg/util/keymutex
to k8s.io/utils/keymutex

This is to help with the larger effort around breaking up cloud
providers and moving them out of tree.

Change-Id: I69ad6a24d05c078fefa8c63df2b9d2c3ab1f5974
@dims dims force-pushed the move-pkg-util-strings-from-kubernetes-kubernetes branch from ddab25b to 41bae72 Compare October 26, 2018 14:41
@dims
Copy link
Member Author

dims commented Oct 26, 2018

@thockin this is ready. we will have to bypass the CLA stuff though

@dims
Copy link
Member Author

dims commented Nov 2, 2018

/check-cla

@dims dims closed this Dec 4, 2018
@thockin
Copy link
Member

thockin commented Dec 6, 2018

Why did we close this?

I went looking for it and found it wasn't merged

@dims
Copy link
Member Author

dims commented Dec 6, 2018

re-opened. was not sure what to do about the CLA stuff @thockin

@pohly
Copy link
Contributor

pohly commented Dec 6, 2018

Is the problem with the CLA that for some of the authors there's no CLA on record?

Independently today, I proposed keymutex for inclusion into k8s.io/utils (issue #55), so I hope that this can be sorted out.

// EscapePluginName converts a plugin name in the format
// vendor/pluginname into a proper ondisk vendor~pluginname plugin directory
// format.
func EscapePluginName(in string) string {
Copy link
Member

Choose a reason for hiding this comment

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

I swear I made this comment before, but can't find it. The Escape/UnescapePluginName funcs are totally redundant. Can we get rid of them?

Copy link
Member Author

Choose a reason for hiding this comment

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

Dropped! (Escape|Unescape)PluginName

@thockin
Copy link
Member

thockin commented Jan 4, 2019

We can manually merge once comments are resolved

Change-Id: I8b213a52dbd96c510e4f7173324e198f4caf55fd
@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, 2019
@dims
Copy link
Member Author

dims commented Jan 24, 2019

@thockin this is ready, please take a look

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

@thockin thockin left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dims, mcrute, thockin

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

@thockin
Copy link
Member

thockin commented Jan 25, 2019

Manual merge because of CLA of multiple commits

@thockin thockin merged commit fe7be10 into kubernetes:master Jan 25, 2019
pohly added a commit to pohly/utils that referenced this pull request Jan 28, 2019
kubernetes#55 was merged shortly after
kubernetes#68 and then brought back
glog, which now breaks vendoring of k8s.io/utils (can't have both glog
and klog defining the same command line flags).

Instead of replacing the logging with klog, logging gets removed
entirely. The rationale is that the log output is likely to be more
useful and/or readable if it is done by the caller. This is also a
first step towards removing the klog dependency from
k8s.io/utils (kubernetes#68 (comment)).
@pohly pohly mentioned this pull request Jan 28, 2019
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: no Indicates the PR's author has not signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.