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

Fixup name vs ID terminology #1137

Merged
merged 1 commit into from
Sep 3, 2014
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 examples/guestbook/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ cluster/kubecfg.sh list pods
You'll see a single redis master pod. It will also display the machine that the pod is running on once it gets placed (may take up to thirty seconds).

```
Name Image(s) Host Labels
ID Image(s) Host Labels
---------- ---------- ---------- ----------
redis-master-2 dockerfile/redis kubernetes-minion-3.c.briandpe-api.internal name=redis-master
```
Expand Down Expand Up @@ -91,7 +91,7 @@ to create the service with the `kubecfg` cli:

```shell
$ cluster/kubecfg.sh -c examples/guestbook/redis-master-service.json create services
Name Labels Selector Port
ID Labels Selector Port
---------- ---------- ---------- ----------
redismaster name=redis-master 10000
```
Expand Down Expand Up @@ -135,7 +135,7 @@ to create the replication controller by running:

```shell
$ cluster/kubecfg.sh -c examples/guestbook/redis-slave-controller.json create replicationControllers
Name Image(s) Selector Replicas
ID Image(s) Selector Replicas
---------- ---------- ---------- ----------
redisSlaveController brendanburns/redis-slave name=redisslave 2
```
Expand All @@ -150,7 +150,7 @@ Once that's up you can list the pods in the cluster, to verify that the master a

```shell
$ cluster/kubecfg.sh list pods
Name Image(s) Host Labels
ID Image(s) Host Labels
---------- ---------- ---------- ----------
redis-master-2 dockerfile/redis kubernetes-minion-3.c.briandpe-api.internal name=redis-master
4d65822107fcfd52 brendanburns/redis-slave kubernetes-minion-3.c.briandpe-api.internal name=redisslave,replicationController=redisSlaveController
Expand Down Expand Up @@ -184,7 +184,7 @@ Now that you have created the service specification, create it in your cluster w

```shell
$ cluster/kubecfg.sh -c examples/guestbook/redis-slave-service.json create services
Name Labels Selector Port
ID Labels Selector Port
---------- ---------- ---------- ----------
redisslave name=redisslave name=redisslave 10001
```
Expand Down Expand Up @@ -225,7 +225,7 @@ Using this file, you can turn up your frontend with:

```shell
$ cluster/kubecfg.sh -c examples/guestbook/frontend-controller.json create replicationControllers
Name Image(s) Selector Replicas
ID Image(s) Selector Replicas
---------- ---------- ---------- ----------
frontendController brendanburns/php-redis name=frontend 3
```
Expand All @@ -234,7 +234,7 @@ Once that's up (it may take ten to thirty seconds to create the pods) you can li

```shell
$ cluster/kubecfg.sh list pods
Name Image(s) Host Labels
ID Image(s) Host Labels
---------- ---------- ---------- ----------
redis-master-2 dockerfile/redis kubernetes-minion-3.c.briandpe-api.internal name=redis-master
4d65822107fcfd52 brendanburns/redis-slave kubernetes-minion-3.c.briandpe-api.internal name=redisslave,replicationController=redisSlaveController
Expand Down
36 changes: 18 additions & 18 deletions pkg/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,16 @@ type Interface interface {
// PodInterface has methods to work with Pod resources.
type PodInterface interface {
ListPods(selector labels.Selector) (api.PodList, error)
GetPod(name string) (api.Pod, error)
DeletePod(name string) error
GetPod(id string) (api.Pod, error)
DeletePod(id string) error
CreatePod(api.Pod) (api.Pod, error)
UpdatePod(api.Pod) (api.Pod, error)
}

// ReplicationControllerInterface has methods to work with ReplicationController resources.
type ReplicationControllerInterface interface {
ListReplicationControllers(selector labels.Selector) (api.ReplicationControllerList, error)
GetReplicationController(name string) (api.ReplicationController, error)
GetReplicationController(id string) (api.ReplicationController, error)
CreateReplicationController(api.ReplicationController) (api.ReplicationController, error)
UpdateReplicationController(api.ReplicationController) (api.ReplicationController, error)
DeleteReplicationController(string) error
Expand All @@ -65,7 +65,7 @@ type ReplicationControllerInterface interface {

// ServiceInterface has methods to work with Service resources.
type ServiceInterface interface {
GetService(name string) (api.Service, error)
GetService(id string) (api.Service, error)
CreateService(api.Service) (api.Service, error)
UpdateService(api.Service) (api.Service, error)
DeleteService(string) error
Expand Down Expand Up @@ -247,15 +247,15 @@ func (c *Client) ListPods(selector labels.Selector) (result api.PodList, err err
return
}

// GetPod takes the name of the pod, and returns the corresponding Pod object, and an error if it occurs.
func (c *Client) GetPod(name string) (result api.Pod, err error) {
err = c.Get().Path("pods").Path(name).Do().Into(&result)
// GetPod takes the id of the pod, and returns the corresponding Pod object, and an error if it occurs
func (c *Client) GetPod(id string) (result api.Pod, err error) {
err = c.Get().Path("pods").Path(id).Do().Into(&result)
return
}

// DeletePod takes the name of the pod, and returns an error if one occurs.
func (c *Client) DeletePod(name string) error {
return c.Delete().Path("pods").Path(name).Do().Error()
// DeletePod takes the id of the pod, and returns an error if one occurs
func (c *Client) DeletePod(id string) error {
return c.Delete().Path("pods").Path(id).Do().Error()
}

// CreatePod takes the representation of a pod. Returns the server's representation of the pod, and an error, if it occurs.
Expand All @@ -281,8 +281,8 @@ func (c *Client) ListReplicationControllers(selector labels.Selector) (result ap
}

// GetReplicationController returns information about a particular replication controller.
func (c *Client) GetReplicationController(name string) (result api.ReplicationController, err error) {
err = c.Get().Path("replicationControllers").Path(name).Do().Into(&result)
func (c *Client) GetReplicationController(id string) (result api.ReplicationController, err error) {
err = c.Get().Path("replicationControllers").Path(id).Do().Into(&result)
return
}

Expand All @@ -303,8 +303,8 @@ func (c *Client) UpdateReplicationController(controller api.ReplicationControlle
}

// DeleteReplicationController deletes an existing replication controller.
func (c *Client) DeleteReplicationController(name string) error {
return c.Delete().Path("replicationControllers").Path(name).Do().Error()
func (c *Client) DeleteReplicationController(id string) error {
return c.Delete().Path("replicationControllers").Path(id).Do().Error()
}

// WatchReplicationControllers returns a watch.Interface that watches the requested controllers.
Expand All @@ -324,8 +324,8 @@ func (c *Client) ListServices(selector labels.Selector) (list api.ServiceList, e
}

// GetService returns information about a particular service.
func (c *Client) GetService(name string) (result api.Service, err error) {
err = c.Get().Path("services").Path(name).Do().Into(&result)
func (c *Client) GetService(id string) (result api.Service, err error) {
err = c.Get().Path("services").Path(id).Do().Into(&result)
return
}

Expand All @@ -346,8 +346,8 @@ func (c *Client) UpdateService(svc api.Service) (result api.Service, err error)
}

// DeleteService deletes an existing service.
func (c *Client) DeleteService(name string) error {
return c.Delete().Path("services").Path(name).Do().Error()
func (c *Client) DeleteService(id string) error {
return c.Delete().Path("services").Path(id).Do().Error()
}

// WatchServices returns a watch.Interface that watches the requested services.
Expand Down
6 changes: 3 additions & 3 deletions pkg/kubecfg/resource_printer.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,9 @@ func (h *HumanReadablePrinter) validatePrintHandlerFunc(printFunc reflect.Value)
return nil
}

var podColumns = []string{"Name", "Image(s)", "Host", "Labels"}
var replicationControllerColumns = []string{"Name", "Image(s)", "Selector", "Replicas"}
var serviceColumns = []string{"Name", "Labels", "Selector", "Port"}
var podColumns = []string{"ID", "Image(s)", "Host", "Labels"}
var replicationControllerColumns = []string{"ID", "Image(s)", "Selector", "Replicas"}
var serviceColumns = []string{"ID", "Labels", "Selector", "Port"}
var minionColumns = []string{"Minion identifier"}
var statusColumns = []string{"Status"}

Expand Down