mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 07:27:21 +00:00
Change resource "ingress" to "ingresses" in URL path and kubectl
This commit is contained in:
@@ -142,12 +142,12 @@ func KindToResource(kind string, mixedCase bool) (plural, singular string) {
|
||||
} else {
|
||||
singular = strings.ToLower(kind)
|
||||
}
|
||||
if strings.HasSuffix(singular, "status") {
|
||||
plural = singular + "es"
|
||||
if strings.HasSuffix(singular, "endpoints") {
|
||||
plural = singular
|
||||
} else {
|
||||
switch string(singular[len(singular)-1]) {
|
||||
case "s":
|
||||
plural = singular
|
||||
plural = singular + "es"
|
||||
case "y":
|
||||
plural = strings.TrimSuffix(singular, "y") + "ies"
|
||||
default:
|
||||
|
||||
@@ -153,11 +153,12 @@ func TestKindToResource(t *testing.T) {
|
||||
{Kind: "ReplicationController", MixedCase: true, Plural: "replicationControllers", Singular: "replicationController"},
|
||||
{Kind: "ReplicationController", MixedCase: false, Plural: "replicationcontrollers", Singular: "replicationcontroller"},
|
||||
|
||||
// Add "ies" when ending with "y"
|
||||
{Kind: "ImageRepository", MixedCase: true, Plural: "imageRepositories", Singular: "imageRepository"},
|
||||
|
||||
// Add "es" when ending with "s"
|
||||
{Kind: "miss", MixedCase: false, Plural: "misses", Singular: "miss"},
|
||||
// Add "s" otherwise
|
||||
{Kind: "lowercase", MixedCase: false, Plural: "lowercases", Singular: "lowercase"},
|
||||
// Don't add extra s if the original object is already plural
|
||||
{Kind: "lowercases", MixedCase: false, Plural: "lowercases", Singular: "lowercases"},
|
||||
}
|
||||
for i, testCase := range testCases {
|
||||
plural, singular := KindToResource(testCase.Kind, testCase.MixedCase)
|
||||
|
||||
Reference in New Issue
Block a user