-
Notifications
You must be signed in to change notification settings - Fork 200
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
Move pkg util strings/keymutex from kubernetes kubernetes #55
Conversation
/assign @thockin |
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. |
related to kubernetes/kubernetes#69585 |
There was a problem hiding this 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 get
table so it might be worth dropping the Bazel BUILD files. I ended up removing them from the packages I've imported.
strings/strings.go
Outdated
} | ||
|
||
// isVowel returns true if the rune is a vowel (case insensitive). | ||
func isVowel(c rune) bool { |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
/lgtm |
} | ||
|
||
// Acquires a lock associated with the specified ID. | ||
func (km *hashedKeyMutex) LockKey(id string) { |
There was a problem hiding this comment.
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
strings/escape.go
Outdated
return strings.Replace(in, "~", "/", -1) | ||
} | ||
|
||
// EscapeQualifiedNameForDisk converts a plugin name, which might contain a / into a |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
strings/strings.go
Outdated
} | ||
|
||
// IsVowel returns true if the rune is a vowel (case insensitive). | ||
func IsVowel(c rune) bool { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ack. removing this
ad8dbf5
to
08cbc5b
Compare
Replace funtions with strings pkg Fix all references and rename the pkg
Refactoring resource container
For example: "a Ingress" > "an Ingress"
anymore. See kubernetes/kubernetes/pull/66442 for discussions.
Signed-off-by: Christian Schlotter <[email protected]>
Change-Id: I33c28cb65b4915b5f037c93bf62fda3f5b4c804a
08cbc5b
to
ddab25b
Compare
- 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
ddab25b
to
41bae72
Compare
@thockin this is ready. we will have to bypass the CLA stuff though |
/check-cla |
Why did we close this? I went looking for it and found it wasn't merged |
re-opened. was not sure what to do about the CLA stuff @thockin |
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. |
strings/escape.go
Outdated
// EscapePluginName converts a plugin name in the format | ||
// vendor/pluginname into a proper ondisk vendor~pluginname plugin directory | ||
// format. | ||
func EscapePluginName(in string) string { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dropped! (Escape|Unescape)PluginName
We can manually merge once comments are resolved |
Change-Id: I8b213a52dbd96c510e4f7173324e198f4caf55fd
@thockin this is ready, please take a look |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/approve
[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 |
Manual merge because of CLA of multiple commits |
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)).
This is to help with the larger effort around breaking up cloud providers and moving them out of tree.
Fixes #62