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

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

Merged
merged 1 commit into from
Oct 26, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 7 additions & 7 deletions api/swagger-spec/v1beta1.json
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,7 @@
]
},
{
"path": "/apis/extensions/v1beta1/namespaces/{namespace}/ingress",
"path": "/apis/extensions/v1beta1/namespaces/{namespace}/ingresses",
"description": "API at /apis/extensions/v1beta1",
"operations": [
{
Expand Down Expand Up @@ -856,7 +856,7 @@
]
},
{
"path": "/apis/extensions/v1beta1/watch/namespaces/{namespace}/ingress",
"path": "/apis/extensions/v1beta1/watch/namespaces/{namespace}/ingresses",
"description": "API at /apis/extensions/v1beta1",
"operations": [
{
Expand Down Expand Up @@ -939,7 +939,7 @@
]
},
{
"path": "/apis/extensions/v1beta1/namespaces/{namespace}/ingress/{name}",
"path": "/apis/extensions/v1beta1/namespaces/{namespace}/ingresses/{name}",
"description": "API at /apis/extensions/v1beta1",
"operations": [
{
Expand Down Expand Up @@ -1151,7 +1151,7 @@
]
},
{
"path": "/apis/extensions/v1beta1/watch/namespaces/{namespace}/ingress/{name}",
"path": "/apis/extensions/v1beta1/watch/namespaces/{namespace}/ingresses/{name}",
"description": "API at /apis/extensions/v1beta1",
"operations": [
{
Expand Down Expand Up @@ -1242,7 +1242,7 @@
]
},
{
"path": "/apis/extensions/v1beta1/ingress",
"path": "/apis/extensions/v1beta1/ingresses",
"description": "API at /apis/extensions/v1beta1",
"operations": [
{
Expand Down Expand Up @@ -1317,7 +1317,7 @@
]
},
{
"path": "/apis/extensions/v1beta1/watch/ingress",
"path": "/apis/extensions/v1beta1/watch/ingresses",
"description": "API at /apis/extensions/v1beta1",
"operations": [
{
Expand Down Expand Up @@ -1392,7 +1392,7 @@
]
},
{
"path": "/apis/extensions/v1beta1/namespaces/{namespace}/ingress/{name}/status",
"path": "/apis/extensions/v1beta1/namespaces/{namespace}/ingresses/{name}/status",
"description": "API at /apis/extensions/v1beta1",
"operations": [
{
Expand Down
6 changes: 3 additions & 3 deletions pkg/api/meta/restmapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
7 changes: 4 additions & 3 deletions pkg/api/meta/restmapper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion pkg/client/unversioned/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ func TestGetServerResources(t *testing.T) {
GroupVersion: "extensions/v1",
APIResources: []unversioned.APIResource{
{"deployments", true},
{"ingress", true},
{"ingresses", true},
{"jobs", true},
},
}
Expand Down
16 changes: 8 additions & 8 deletions pkg/client/unversioned/ingress.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,50 +54,50 @@ func newIngress(c *ExtensionsClient, namespace string) *ingress {
// List returns a list of ingress that match the label and field selectors.
func (c *ingress) List(label labels.Selector, field fields.Selector) (result *extensions.IngressList, err error) {
result = &extensions.IngressList{}
err = c.r.Get().Namespace(c.ns).Resource("ingress").LabelsSelectorParam(label).FieldsSelectorParam(field).Do().Into(result)
err = c.r.Get().Namespace(c.ns).Resource("ingresses").LabelsSelectorParam(label).FieldsSelectorParam(field).Do().Into(result)
return
}

// Get returns information about a particular ingress.
func (c *ingress) Get(name string) (result *extensions.Ingress, err error) {
result = &extensions.Ingress{}
err = c.r.Get().Namespace(c.ns).Resource("ingress").Name(name).Do().Into(result)
err = c.r.Get().Namespace(c.ns).Resource("ingresses").Name(name).Do().Into(result)
return
}

// Create creates a new ingress.
func (c *ingress) Create(ingress *extensions.Ingress) (result *extensions.Ingress, err error) {
result = &extensions.Ingress{}
err = c.r.Post().Namespace(c.ns).Resource("ingress").Body(ingress).Do().Into(result)
err = c.r.Post().Namespace(c.ns).Resource("ingresses").Body(ingress).Do().Into(result)
return
}

// Update updates an existing ingress.
func (c *ingress) Update(ingress *extensions.Ingress) (result *extensions.Ingress, err error) {
result = &extensions.Ingress{}
err = c.r.Put().Namespace(c.ns).Resource("ingress").Name(ingress.Name).Body(ingress).Do().Into(result)
err = c.r.Put().Namespace(c.ns).Resource("ingresses").Name(ingress.Name).Body(ingress).Do().Into(result)
return
}

// Delete deletes a ingress, returns error if one occurs.
func (c *ingress) Delete(name string, options *api.DeleteOptions) (err error) {
if options == nil {
return c.r.Delete().Namespace(c.ns).Resource("ingress").Name(name).Do().Error()
return c.r.Delete().Namespace(c.ns).Resource("ingresses").Name(name).Do().Error()
}

body, err := api.Scheme.EncodeToVersion(options, c.r.APIVersion())
if err != nil {
return err
}
return c.r.Delete().Namespace(c.ns).Resource("ingress").Name(name).Body(body).Do().Error()
return c.r.Delete().Namespace(c.ns).Resource("ingresses").Name(name).Body(body).Do().Error()
}

// Watch returns a watch.Interface that watches the requested ingress.
func (c *ingress) Watch(label labels.Selector, field fields.Selector, opts api.ListOptions) (watch.Interface, error) {
return c.r.Get().
Prefix("watch").
Namespace(c.ns).
Resource("ingress").
Resource("ingresses").
Param("resourceVersion", opts.ResourceVersion).
TimeoutSeconds(TimeoutFromListOptions(opts)).
LabelsSelectorParam(label).
Expand All @@ -108,6 +108,6 @@ func (c *ingress) Watch(label labels.Selector, field fields.Selector, opts api.L
// UpdateStatus takes the name of the ingress and the new status. Returns the server's representation of the ingress, and an error, if it occurs.
func (c *ingress) UpdateStatus(ingress *extensions.Ingress) (result *extensions.Ingress, err error) {
result = &extensions.Ingress{}
err = c.r.Put().Namespace(c.ns).Resource("ingress").Name(ingress.Name).SubResource("status").Body(ingress).Do().Into(result)
err = c.r.Put().Namespace(c.ns).Resource("ingresses").Name(ingress.Name).SubResource("status").Body(ingress).Do().Into(result)
return
}
2 changes: 1 addition & 1 deletion pkg/client/unversioned/ingress_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
)

func getIngressResourceName() string {
return "ingress"
return "ingresses"
}

func TestListIngress(t *testing.T) {
Expand Down
14 changes: 7 additions & 7 deletions pkg/client/unversioned/testclient/fake_ingress.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ type FakeIngress struct {
}

func (c *FakeIngress) Get(name string) (*extensions.Ingress, error) {
obj, err := c.Fake.Invokes(NewGetAction("ingress", c.Namespace, name), &extensions.Ingress{})
obj, err := c.Fake.Invokes(NewGetAction("ingresses", c.Namespace, name), &extensions.Ingress{})
if obj == nil {
return nil, err
}
Expand All @@ -41,7 +41,7 @@ func (c *FakeIngress) Get(name string) (*extensions.Ingress, error) {
}

func (c *FakeIngress) List(label labels.Selector, fields fields.Selector) (*extensions.IngressList, error) {
obj, err := c.Fake.Invokes(NewListAction("ingress", c.Namespace, label, nil), &extensions.IngressList{})
obj, err := c.Fake.Invokes(NewListAction("ingresses", c.Namespace, label, nil), &extensions.IngressList{})
if obj == nil {
return nil, err
}
Expand All @@ -50,7 +50,7 @@ func (c *FakeIngress) List(label labels.Selector, fields fields.Selector) (*exte
}

func (c *FakeIngress) Create(ingress *extensions.Ingress) (*extensions.Ingress, error) {
obj, err := c.Fake.Invokes(NewCreateAction("ingress", c.Namespace, ingress), ingress)
obj, err := c.Fake.Invokes(NewCreateAction("ingresses", c.Namespace, ingress), ingress)
if obj == nil {
return nil, err
}
Expand All @@ -59,7 +59,7 @@ func (c *FakeIngress) Create(ingress *extensions.Ingress) (*extensions.Ingress,
}

func (c *FakeIngress) Update(ingress *extensions.Ingress) (*extensions.Ingress, error) {
obj, err := c.Fake.Invokes(NewUpdateAction("ingress", c.Namespace, ingress), ingress)
obj, err := c.Fake.Invokes(NewUpdateAction("ingresses", c.Namespace, ingress), ingress)
if obj == nil {
return nil, err
}
Expand All @@ -68,16 +68,16 @@ func (c *FakeIngress) Update(ingress *extensions.Ingress) (*extensions.Ingress,
}

func (c *FakeIngress) Delete(name string, options *api.DeleteOptions) error {
_, err := c.Fake.Invokes(NewDeleteAction("ingress", c.Namespace, name), &extensions.Ingress{})
_, err := c.Fake.Invokes(NewDeleteAction("ingresses", c.Namespace, name), &extensions.Ingress{})
return err
}

func (c *FakeIngress) Watch(label labels.Selector, field fields.Selector, opts api.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(NewWatchAction("ingress", c.Namespace, label, field, opts))
return c.Fake.InvokesWatch(NewWatchAction("ingresses", c.Namespace, label, field, opts))
}

func (c *FakeIngress) UpdateStatus(ingress *extensions.Ingress) (result *extensions.Ingress, err error) {
obj, err := c.Fake.Invokes(NewUpdateSubresourceAction("ingress", "status", c.Namespace, ingress), ingress)
obj, err := c.Fake.Invokes(NewUpdateSubresourceAction("ingresses", "status", c.Namespace, ingress), ingress)
if obj == nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/namespace/namespace_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ func deleteAllContent(kubeClient client.Interface, versions *unversioned.APIVers
return estimate, err
}
}
if containsResource(resources, "ingress") {
if containsResource(resources, "ingresses") {
err = deleteIngress(kubeClient.Extensions(), namespace)
if err != nil {
return estimate, err
Expand Down
4 changes: 2 additions & 2 deletions pkg/controller/namespace/namespace_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func testSyncNamespaceThatIsTerminating(t *testing.T, versions *unversioned.APIV

if containsVersion(versions, "extensions/v1beta1") {
resources := []unversioned.APIResource{}
for _, resource := range []string{"daemonsets", "deployments", "jobs", "horizontalpodautoscalers", "ingress"} {
for _, resource := range []string{"daemonsets", "deployments", "jobs", "horizontalpodautoscalers", "ingresses"} {
resources = append(resources, unversioned.APIResource{Name: resource})
}
mockClient.Resources = map[string]*unversioned.APIResourceList{
Expand Down Expand Up @@ -128,7 +128,7 @@ func testSyncNamespaceThatIsTerminating(t *testing.T, versions *unversioned.APIV
strings.Join([]string{"list", "deployments", ""}, "-"),
strings.Join([]string{"list", "jobs", ""}, "-"),
strings.Join([]string{"list", "horizontalpodautoscalers", ""}, "-"),
strings.Join([]string{"list", "ingress", ""}, "-"),
strings.Join([]string{"list", "ingresses", ""}, "-"),
strings.Join([]string{"get", "resource", ""}, "-"),
)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/kubectl/kubectl.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func expandResourceShortcut(resource string) string {
"rc": "replicationcontrollers",
"ds": "daemonsets",
"svc": "services",
"ing": "ingress",
"ing": "ingresses",
}
if expanded, ok := shortForms[resource]; ok {
return expanded
Expand Down
10 changes: 5 additions & 5 deletions pkg/master/master.go
Original file line number Diff line number Diff line change
Expand Up @@ -1033,7 +1033,7 @@ func (m *Master) thirdpartyapi(group, kind, version string) *apiserver.APIGroupV
// experimental returns the resources and codec for the experimental api
func (m *Master) experimental(c *Config) *apiserver.APIGroupVersion {
// All resources except these are disabled by default.
enabledResources := utilsets.NewString("jobs", "horizontalpodautoscalers", "ingress")
enabledResources := utilsets.NewString("jobs", "horizontalpodautoscalers", "ingresses")
resourceOverrides := m.apiGroupVersionOverrides["extensions/v1beta1"].ResourceOverrides
isEnabled := func(resource string) bool {
// Check if the resource has been overriden.
Expand Down Expand Up @@ -1088,10 +1088,10 @@ func (m *Master) experimental(c *Config) *apiserver.APIGroupVersion {
storage["jobs"] = jobStorage
storage["jobs/status"] = jobStatusStorage
}
if isEnabled("ingress") {
ingressStorage, ingressStatusStorage := ingressetcd.NewREST(dbClient("ingress"))
storage["ingress"] = ingressStorage
storage["ingress/status"] = ingressStatusStorage
if isEnabled("ingresses") {
ingressStorage, ingressStatusStorage := ingressetcd.NewREST(dbClient("ingresses"))
storage["ingresses"] = ingressStorage
storage["ingresses/status"] = ingressStatusStorage
}

extensionsGroup := latest.GroupOrDie("extensions")
Expand Down
2 changes: 1 addition & 1 deletion pkg/registry/ingress/etcd/etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func NewREST(s storage.Interface) (*REST, *StatusREST) {
PredicateFunc: func(label labels.Selector, field fields.Selector) generic.Matcher {
return ingress.MatchIngress(label, field)
},
EndpointName: "ingress",
EndpointName: "ingresses",

// Used to validate controller creation
CreateStrategy: ingress.Strategy,
Expand Down