Skip to content

Commit

Permalink
Task -> Pod kubernetes#4, the final chapter
Browse files Browse the repository at this point in the history
  • Loading branch information
brendandburns committed Jun 9, 2014
1 parent 6018497 commit 5cb4444
Show file tree
Hide file tree
Showing 8 changed files with 98 additions and 98 deletions.
162 changes: 81 additions & 81 deletions api/kubernetes.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion cluster/kube-up.sh
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ echo " up."
echo

until $(curl --insecure --user ${user}:${passwd} --max-time 1 \
--fail --output /dev/null --silent https://${KUBE_MASTER_IP}/api/v1beta1/tasks); do
--fail --output /dev/null --silent https://${KUBE_MASTER_IP}/api/v1beta1/pods); do
printf "."
sleep 2
done
Expand Down
2 changes: 1 addition & 1 deletion cluster/saltbase/salt/controller-manager/initd
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# Short-Description: The Kubernetes controller manager
# Description:
# The Kubernetes controller manager is responsible for monitoring replication
# controllers, and creating corresponding tasks to achieve the desired state.
# controllers, and creating corresponding pods to achieve the desired state.
### END INIT INFO


Expand Down
2 changes: 1 addition & 1 deletion cmd/apiserver/apiserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func main() {
}

storage := map[string]apiserver.RESTStorage{
"tasks": registry.MakePodRegistryStorage(podRegistry, containerInfo, registry.MakeFirstFitScheduler(machineList, podRegistry)),
"pods": registry.MakePodRegistryStorage(podRegistry, containerInfo, registry.MakeFirstFitScheduler(machineList, podRegistry)),
"replicationControllers": registry.MakeControllerRegistryStorage(controllerRegistry),
"services": registry.MakeServiceRegistryStorage(serviceRegistry),
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/integration/integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func main() {
reg := registry.MakeEtcdRegistry(etcdClient, machineList)

apiserver := apiserver.New(map[string]apiserver.RESTStorage{
"tasks": registry.MakePodRegistryStorage(reg, &kube_client.FakeContainerInfo{}, registry.MakeRoundRobinScheduler(machineList)),
"pods": registry.MakePodRegistryStorage(reg, &kube_client.FakeContainerInfo{}, registry.MakeRoundRobinScheduler(machineList)),
"replicationControllers": registry.MakeControllerRegistryStorage(reg),
}, "/api/v1beta1")
server := httptest.NewServer(apiserver)
Expand Down
10 changes: 5 additions & 5 deletions pkg/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func DecodeLabelQuery(labelQuery string) map[string]string {

// ListPods takes a label query, and returns the list of pods that match that query
func (client Client) ListPods(labelQuery map[string]string) (api.PodList, error) {
path := "tasks"
path := "pods"
if labelQuery != nil && len(labelQuery) > 0 {
path += "?labels=" + EncodeLabelQuery(labelQuery)
}
Expand All @@ -156,13 +156,13 @@ func (client Client) ListPods(labelQuery map[string]string) (api.PodList, error)
// GetPod takes the name of the pod, and returns the corresponding Pod object, and an error if it occurs
func (client Client) GetPod(name string) (api.Pod, error) {
var result api.Pod
_, err := client.rawRequest("GET", "tasks/"+name, nil, &result)
_, err := client.rawRequest("GET", "pods/"+name, nil, &result)
return result, err
}

// DeletePod takes the name of the pod, and returns an error if one occurs
func (client Client) DeletePod(name string) error {
_, err := client.rawRequest("DELETE", "tasks/"+name, nil, nil)
_, err := client.rawRequest("DELETE", "pods/"+name, nil, nil)
return err
}

Expand All @@ -171,7 +171,7 @@ func (client Client) CreatePod(pod api.Pod) (api.Pod, error) {
var result api.Pod
body, err := json.Marshal(pod)
if err == nil {
_, err = client.rawRequest("POST", "tasks", bytes.NewBuffer(body), &result)
_, err = client.rawRequest("POST", "pods", bytes.NewBuffer(body), &result)
}
return result, err
}
Expand All @@ -181,7 +181,7 @@ func (client Client) UpdatePod(pod api.Pod) (api.Pod, error) {
var result api.Pod
body, err := json.Marshal(pod)
if err == nil {
_, err = client.rawRequest("PUT", "tasks/"+pod.ID, bytes.NewBuffer(body), &result)
_, err = client.rawRequest("PUT", "pods/"+pod.ID, bytes.NewBuffer(body), &result)
}
return result, err
}
Expand Down
14 changes: 7 additions & 7 deletions pkg/client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func TestListEmptyPods(t *testing.T) {
Host: testServer.URL,
}
podList, err := client.ListPods(nil)
fakeHandler.ValidateRequest(t, makeUrl("/tasks"), "GET", nil)
fakeHandler.ValidateRequest(t, makeUrl("/pods"), "GET", nil)
if err != nil {
t.Errorf("Unexpected error in listing pods: %#v", err)
}
Expand Down Expand Up @@ -84,7 +84,7 @@ func TestListPods(t *testing.T) {
Host: testServer.URL,
}
receivedPodList, err := client.ListPods(nil)
fakeHandler.ValidateRequest(t, makeUrl("/tasks"), "GET", nil)
fakeHandler.ValidateRequest(t, makeUrl("/pods"), "GET", nil)
if err != nil {
t.Errorf("Unexpected error in listing pods: %#v", err)
}
Expand Down Expand Up @@ -119,7 +119,7 @@ func TestListPodsLabels(t *testing.T) {
}
query := map[string]string{"foo": "bar", "name": "baz"}
receivedPodList, err := client.ListPods(query)
fakeHandler.ValidateRequest(t, makeUrl("/tasks"), "GET", nil)
fakeHandler.ValidateRequest(t, makeUrl("/pods"), "GET", nil)
queryString := fakeHandler.RequestReceived.URL.Query().Get("labels")
queryString, _ = url.QueryUnescape(queryString)
// TODO(bburns) : This assumes some ordering in serialization that might not always
Expand Down Expand Up @@ -156,7 +156,7 @@ func TestGetPod(t *testing.T) {
Host: testServer.URL,
}
receivedPod, err := client.GetPod("foo")
fakeHandler.ValidateRequest(t, makeUrl("/tasks/foo"), "GET", nil)
fakeHandler.ValidateRequest(t, makeUrl("/pods/foo"), "GET", nil)
if err != nil {
t.Errorf("Unexpected error: %#v", err)
}
Expand All @@ -176,7 +176,7 @@ func TestDeletePod(t *testing.T) {
Host: testServer.URL,
}
err := client.DeletePod("foo")
fakeHandler.ValidateRequest(t, makeUrl("/tasks/foo"), "DELETE", nil)
fakeHandler.ValidateRequest(t, makeUrl("/pods/foo"), "DELETE", nil)
if err != nil {
t.Errorf("Unexpected error: %#v", err)
}
Expand All @@ -203,7 +203,7 @@ func TestCreatePod(t *testing.T) {
Host: testServer.URL,
}
receivedPod, err := client.CreatePod(requestPod)
fakeHandler.ValidateRequest(t, makeUrl("/tasks"), "POST", nil)
fakeHandler.ValidateRequest(t, makeUrl("/pods"), "POST", nil)
if err != nil {
t.Errorf("Unexpected error: %#v", err)
}
Expand Down Expand Up @@ -234,7 +234,7 @@ func TestUpdatePod(t *testing.T) {
Host: testServer.URL,
}
receivedPod, err := client.UpdatePod(requestPod)
fakeHandler.ValidateRequest(t, makeUrl("/tasks/foo"), "PUT", nil)
fakeHandler.ValidateRequest(t, makeUrl("/pods/foo"), "PUT", nil)
if err != nil {
t.Errorf("Unexpected error: %#v", err)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/registry/replication_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ func TestCreateReplica(t *testing.T) {
// DesiredState: controllerSpec.DesiredState.PodTemplate.DesiredState,
//}
// TODO: fix this so that it validates the body.
fakeHandler.ValidateRequest(t, makeUrl("/tasks"), "POST", nil)
fakeHandler.ValidateRequest(t, makeUrl("/pods"), "POST", nil)
}

func TestHandleWatchResponseNotSet(t *testing.T) {
Expand Down

0 comments on commit 5cb4444

Please sign in to comment.