Change resource "ingress" to "ingresses" in URL path and kubectl

This commit is contained in:
Janet Kuo
2015-10-23 17:17:55 -07:00
parent 4f17b4b39c
commit 54b743bc05
12 changed files with 41 additions and 40 deletions

View File

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

View File

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