Skip to content

Commit

Permalink
Merge pull request kubernetes#4460 from sub-mod/guestbook_ns
Browse files Browse the repository at this point in the history
Adding guestbook example with latest json format for v1beta3 api
  • Loading branch information
bgrant0607 committed Feb 24, 2015
2 parents 5070041 + 7d00c45 commit 754a2a8
Show file tree
Hide file tree
Showing 15 changed files with 402 additions and 0 deletions.
24 changes: 24 additions & 0 deletions examples/examples_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,30 @@ func TestExampleObjectSchemas(t *testing.T) {
"redis-master-service": &api.Service{},
"redis-slave-service": &api.Service{},
},
"../examples/guestbook/v1beta3": {
"frontend-controller": &api.ReplicationController{},
"redis-slave-controller": &api.ReplicationController{},
"redis-master": &api.ReplicationController{},
"frontend-service": &api.Service{},
"redis-master-service": &api.Service{},
"redis-slave-service": &api.Service{},
},
"../examples/guestbook-go": {
"guestbook-controller": &api.ReplicationController{},
"redis-slave-controller": &api.ReplicationController{},
"redis-master-controller": &api.ReplicationController{},
"guestbook-service": &api.Service{},
"redis-master-service": &api.Service{},
"redis-slave-service": &api.Service{},
},
"../examples/guestbook-go/v1beta3": {
"guestbook-controller": &api.ReplicationController{},
"redis-slave-controller": &api.ReplicationController{},
"redis-master-controller": &api.ReplicationController{},
"guestbook-service": &api.Service{},
"redis-master-service": &api.Service{},
"redis-slave-service": &api.Service{},
},
"../examples/walkthrough": {
"pod1": &api.Pod{},
"pod2": &api.Pod{},
Expand Down
14 changes: 14 additions & 0 deletions examples/guestbook-go/v1beta3/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
## GuestBook v1beta3 example

This example shows how to build a simple, multi-tier web application using Kubernetes and Docker.

The example consists of:
- A web frontend
- A redis master (for storage and a replicated set of redis slaves)

The web front end interacts with the redis master via javascript redis API calls.

The v1beta3 API is not enabled by default. The kube-apiserver process needs to run with the --runtime_config=api/v1beta3 argument. Use the following command to enable it:
$sudo sed -i 's|KUBE_API_ARGS="|KUBE_API_ARGS="--runtime_config=api/v1beta3 |' /etc/kubernetes/apiserver


38 changes: 38 additions & 0 deletions examples/guestbook-go/v1beta3/guestbook-controller.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"kind":"ReplicationController",
"apiVersion":"v1beta3",
"metadata":{
"name":"guestbook",
"labels":{
"name":"guestbook"
}
},
"spec":{
"replicas":3,
"selector":{
"name":"guestbook"
},
"template":{
"metadata":{
"labels":{
"name":"guestbook"
}
},
"spec":{
"containers":[
{
"image":"kubernetes/guestbook",
"name":"guestbook",
"ports":[
{
"name":"http-server",
"containerPort":3000,
"protocol":"TCP"
}
]
}
]
}
}
}
}
18 changes: 18 additions & 0 deletions examples/guestbook-go/v1beta3/guestbook-service.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"kind":"Service",
"apiVersion":"v1beta3",
"metadata":{
"name":"guestbook",
"labels":{
"name":"guestbook"
}
},
"spec":{
"port":3000,
"containerPort":"http-server",
"protocol":"TCP",
"selector":{
"name":"guestbook"
}
}
}
42 changes: 42 additions & 0 deletions examples/guestbook-go/v1beta3/redis-master-controller.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"kind":"ReplicationController",
"apiVersion":"v1beta3",
"id":"redis-master",
"metadata":{
"name":"redis-master",
"labels":{
"name":"redis",
"role":"master"
}
},
"spec":{
"replicas":1,
"selector":{
"name":"redis",
"role":"master"
},
"template":{
"metadata":{
"labels":{
"name":"redis",
"role":"master"
}
},
"spec":{
"containers":[
{
"name":"redis-master",
"image":"gurpartap/redis",
"ports":[
{
"name":"redis-server",
"containerPort":6379,
"protocol":"TCP"
}
]
}
]
}
}
}
}
20 changes: 20 additions & 0 deletions examples/guestbook-go/v1beta3/redis-master-service.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"kind":"Service",
"apiVersion":"v1beta3",
"metadata":{
"name":"redis-master",
"labels":{
"name":"redis",
"role":"master"
}
},
"spec":{
"port":6379,
"containerPort":"redis-server",
"protocol":"TCP",
"selector":{
"name":"redis",
"role":"master"
}
}
}
47 changes: 47 additions & 0 deletions examples/guestbook-go/v1beta3/redis-slave-controller.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"kind":"ReplicationController",
"apiVersion":"v1beta3",
"id":"redis-slave",
"metadata":{
"name":"redis-slave",
"labels":{
"name":"redis",
"role":"slave"
}
},
"spec":{
"replicas":1,
"selector":{
"name":"redis",
"role":"slave"
},
"template":{
"metadata":{
"labels":{
"name":"redis",
"role":"slave"
}
},
"spec":{
"containers":[
{
"name":"redis-slave",
"image":"gurpartap/redis",
"command":[
"sh",
"-c",
"redis-server /etc/redis/redis.conf --slaveof $REDIS_MASTER_SERVICE_HOST $REDIS_MASTER_SERVICE_PORT"
],
"ports":[
{
"name":"redis-server",
"containerPort":6379,
"protocol":"TCP"
}
]
}
]
}
}
}
}
20 changes: 20 additions & 0 deletions examples/guestbook-go/v1beta3/redis-slave-service.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"kind":"Service",
"apiVersion":"v1beta3",
"metadata":{
"name":"redis-slave",
"labels":{
"name":"redis",
"role":"slave"
}
},
"spec":{
"port":6379,
"containerPort":"redis-server",
"protocol":"TCP",
"selector":{
"name":"redis",
"role":"slave"
}
}
}
14 changes: 14 additions & 0 deletions examples/guestbook/v1beta3/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
## GuestBook v1beta3 example

This example shows how to build a simple, multi-tier web application using Kubernetes and Docker.

The example consists of:
- A web frontend
- A redis master (for storage and a replicated set of redis slaves)

The web front end interacts with the redis master via javascript redis API calls.

The v1beta3 API is not enabled by default. The kube-apiserver process needs to run with the --runtime_config=api/v1beta3 argument. Use the following command to enable it:
$sudo sed -i 's|KUBE_API_ARGS="|KUBE_API_ARGS="--runtime_config=api/v1beta3 |' /etc/kubernetes/apiserver


37 changes: 37 additions & 0 deletions examples/guestbook/v1beta3/frontend-controller.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"kind":"ReplicationController",
"apiVersion":"v1beta3",
"metadata":{
"name":"frontend",
"labels":{
"name":"frontend"
}
},
"spec":{
"replicas":2,
"selector":{
"name":"frontend"
},
"template":{
"metadata":{
"labels":{
"name":"frontend"
}
},
"spec":{
"containers":[
{
"name":"php-redis",
"image":"kubernetes/example-guestbook-php-redis",
"ports":[
{
"containerPort":80,
"protocol":"TCP"
}
]
}
]
}
}
}
}
18 changes: 18 additions & 0 deletions examples/guestbook/v1beta3/frontend-service.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"kind":"Service",
"apiVersion":"v1beta3",
"metadata":{
"name":"frontend",
"labels":{
"name":"frontend"
}
},
"spec":{
"port":80,
"containerPort":80,
"protocol":"TCP",
"selector":{
"name":"frontend"
}
}
}
18 changes: 18 additions & 0 deletions examples/guestbook/v1beta3/redis-master-service.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"kind":"Service",
"apiVersion":"v1beta3",
"metadata":{
"name":"redis-master",
"labels":{
"name":"redis-master"
}
},
"spec":{
"port":6379,
"containerPort":6379,
"protocol":"TCP",
"selector":{
"name":"redis-master"
}
}
}
37 changes: 37 additions & 0 deletions examples/guestbook/v1beta3/redis-master.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"kind":"ReplicationController",
"apiVersion":"v1beta3",
"metadata":{
"name":"redis-master",
"labels":{
"name":"redis-master"
}
},
"spec":{
"replicas":1,
"selector":{
"name":"redis-master"
},
"template":{
"metadata":{
"labels":{
"name":"redis-master"
}
},
"spec":{
"containers":[
{
"name":"master",
"image":"dockerfile/redis",
"ports":[
{
"containerPort":6379,
"protocol":"TCP"
}
]
}
]
}
}
}
}
Loading

0 comments on commit 754a2a8

Please sign in to comment.