From 44b9b7aea5d18d0459b8b858e0243f47afc08fed Mon Sep 17 00:00:00 2001 From: Alex Mohr Date: Mon, 9 Mar 2015 14:18:40 -0700 Subject: [PATCH] Revert "Deleting old sample JSON; moving those in use; updating references" --- api/examples/controller-list.json | 35 ++++++++++++ .../examples}/controller.json | 0 api/examples/external-service.json | 13 +++++ api/examples/pod-list.json | 54 +++++++++++++++++++ .../examples}/pod.json | 0 api/examples/service-list.json | 28 ++++++++++ api/examples/service.json | 12 +++++ cmd/integration/integration.go | 2 +- docs/getting-started-guides/azure.md | 2 +- docs/getting-started-guides/gce.md | 2 +- docs/getting-started-guides/locally.md | 2 +- examples/examples_test.go | 13 +++-- 12 files changed, 154 insertions(+), 9 deletions(-) create mode 100644 api/examples/controller-list.json rename {cmd/integration => api/examples}/controller.json (100%) create mode 100644 api/examples/external-service.json create mode 100644 api/examples/pod-list.json rename {docs/getting-started-guides => api/examples}/pod.json (100%) create mode 100644 api/examples/service-list.json create mode 100644 api/examples/service.json diff --git a/api/examples/controller-list.json b/api/examples/controller-list.json new file mode 100644 index 00000000000..e883abac57f --- /dev/null +++ b/api/examples/controller-list.json @@ -0,0 +1,35 @@ +{ + "kind": "ReplicationControllerList", + "apiVersion": "v1beta1", + "items": [ + { + "id": "test-run", + "desiredState": { + "replicas": 2, + "replicaSelector": { + "name": "test-run" + }, + "podTemplate": { + "desiredState": { + "manifest": { + "version": "v1beta1", + "image": "dockerfile/nginx", + "networkPorts": [ + { + "hostPort": 8080, + "containerPort": 80 + } + ] + } + }, + "labels": { + "name": "test-run" + } + } + }, + "labels": { + "name": "test-run" + } + } + ] +} diff --git a/cmd/integration/controller.json b/api/examples/controller.json similarity index 100% rename from cmd/integration/controller.json rename to api/examples/controller.json diff --git a/api/examples/external-service.json b/api/examples/external-service.json new file mode 100644 index 00000000000..95d796e5049 --- /dev/null +++ b/api/examples/external-service.json @@ -0,0 +1,13 @@ +{ + "id": "example", + "kind": "Service", + "apiVersion": "v1beta1", + "port": 8000, + "labels": { + "name": "nginx" + }, + "selector": { + "name": "nginx" + }, + "createExternalLoadBalancer": true +} diff --git a/api/examples/pod-list.json b/api/examples/pod-list.json new file mode 100644 index 00000000000..5d867de44e4 --- /dev/null +++ b/api/examples/pod-list.json @@ -0,0 +1,54 @@ +{ + "kind": "PodList", + "apiVersion": "v1beta1", + "items": [ + { + "id": "my-pod-1", + "labels": { + "name": "test-run", + "replicationcontroller": "test-run" + }, + "desiredState": { + "manifest": { + "version": "v1beta1", + "id": "my-pod-1", + "containers": [{ + "name": "nginx", + "image": "dockerfile/nginx", + "ports": [{ + "hostPort": 8080, + "containerPort": 80 + }] + }] + } + }, + "currentState": { + "host": "host-1" + } + }, + { + "id": "my-pod-2", + "labels": { + "name": "test-run", + "replicationcontroller": "test-run" + }, + "desiredState": { + "manifest": { + "version": "v1beta1", + "id": "my-pod-2", + "containers": [{ + "name": "nginx", + "image": "dockerfile/nginx", + "ports": [{ + "hostPort": 8080, + "containerPort": 80 + }] + }] + } + }, + "currentState": { + "host": "host-2" + } + } + ] +} diff --git a/docs/getting-started-guides/pod.json b/api/examples/pod.json similarity index 100% rename from docs/getting-started-guides/pod.json rename to api/examples/pod.json diff --git a/api/examples/service-list.json b/api/examples/service-list.json new file mode 100644 index 00000000000..1ac2963b164 --- /dev/null +++ b/api/examples/service-list.json @@ -0,0 +1,28 @@ +{ + "kind": "ServiceList", + "apiVersion": "v1beta1", + "items": [ + { + "id": "example1", + "port": 8000, + "labels": { + "name": "nginx" + }, + "selector": { + "name": "nginx" + } + }, + { + "id": "example2", + "port": 8080, + "labels": { + "env": "prod", + "name": "jetty" + }, + "selector": { + "env": "prod", + "name": "jetty" + } + } + ] +} diff --git a/api/examples/service.json b/api/examples/service.json new file mode 100644 index 00000000000..f4ae8993db3 --- /dev/null +++ b/api/examples/service.json @@ -0,0 +1,12 @@ +{ + "kind": "Service", + "apiVersion": "v1beta1", + "id": "example", + "port": 8000, + "labels": { + "name": "nginx" + }, + "selector": { + "name": "nginx" + } +} diff --git a/cmd/integration/integration.go b/cmd/integration/integration.go index 619e3ecf4b6..ea6e23180ed 100644 --- a/cmd/integration/integration.go +++ b/cmd/integration/integration.go @@ -273,7 +273,7 @@ func podExists(c *client.Client, podNamespace string, podID string) wait.Conditi } func runReplicationControllerTest(c *client.Client) { - data, err := ioutil.ReadFile("cmd/integration/controller.json") + data, err := ioutil.ReadFile("api/examples/controller.json") if err != nil { glog.Fatalf("Unexpected error: %v", err) } diff --git a/docs/getting-started-guides/azure.md b/docs/getting-started-guides/azure.md index a93d8e27c82..5e267616df3 100644 --- a/docs/getting-started-guides/azure.md +++ b/docs/getting-started-guides/azure.md @@ -64,7 +64,7 @@ You can create a pod like this: ``` cd kubernetes -cluster/kubectl.sh create -f docs/getting-started-guides/pod.json +cluster/kubectl.sh create -f api/examples/pod.json ``` Where pod.json contains something like: diff --git a/docs/getting-started-guides/gce.md b/docs/getting-started-guides/gce.md index 3d4b2f77331..b4b1cb8f740 100644 --- a/docs/getting-started-guides/gce.md +++ b/docs/getting-started-guides/gce.md @@ -77,7 +77,7 @@ can create a pod like this: ```bash cd kubernetes -cluster/kubectl.sh create -f docs/getting-started-guides/pod.json +cluster/kubectl.sh create -f api/examples/pod.json ``` Where pod.json contains something like: diff --git a/docs/getting-started-guides/locally.md b/docs/getting-started-guides/locally.md index 958d754f25f..739a1e62a5d 100644 --- a/docs/getting-started-guides/locally.md +++ b/docs/getting-started-guides/locally.md @@ -74,7 +74,7 @@ However you can't view the nginx start page on localhost. To verify that nginx i You can control the specifications of a pod via a user defined manifest, and reach nginx through your browser on the port specified therein: ``` -cluster/kubectl.sh create -f docs/getting-started-guides/pod.json +cluster/kubectl.sh create -f api/examples/pod.json ``` Congratulations! diff --git a/examples/examples_test.go b/examples/examples_test.go index d680cd2b683..26fde45d18b 100644 --- a/examples/examples_test.go +++ b/examples/examples_test.go @@ -98,11 +98,14 @@ func walkJSONFiles(inDir string, fn func(name, path string, data []byte)) error func TestExampleObjectSchemas(t *testing.T) { cases := map[string]map[string]runtime.Object{ - "../docs/getting-started-guides": { - "pod": &api.Pod{}, - }, - "../cmd/integration": { - "controller": &api.ReplicationController{}, + "../api/examples": { + "controller": &api.ReplicationController{}, + "controller-list": &api.ReplicationControllerList{}, + "pod": &api.Pod{}, + "pod-list": &api.PodList{}, + "service": &api.Service{}, + "external-service": &api.Service{}, + "service-list": &api.ServiceList{}, }, "../examples/guestbook": { "frontend-controller": &api.ReplicationController{},