Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ You'll need Docker and the Go language compilation tools installed.
6. In another terminal window, switch to the directory:

$ cd $GOPATH/src/github.com/openshift/origin
$ output/go/bin/openshift kube create services -c examples/test-service.json

$ output/go/bin/openshift kube create pods -c examples/hello-openshift/hello-pod.json

You can also try the [multiple container pod](https://github.com/openshift/origin/blob/master/examples/test-pod-multi.json) example that includes a database and an admin front-end.

Coming soon: Vagrant environments supporting OpenShift - see [Kubernetes README.md](https://github.com/GoogleCloudPlatform/kubernetes/blob/master/README.md) for now.

API
Expand Down
4 changes: 4 additions & 0 deletions examples/hello-openshift/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM scratch
MAINTAINER Jessica Forrester <jforrest@redhat.com>
ADD hello_openshift /hello_openshift
ENTRYPOINT ["/hello_openshift"]
14 changes: 14 additions & 0 deletions examples/hello-openshift/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Hello, OpenShift!
-----------------

This example will serve an http response of "Hello Openshift!" to [http://localhost:6061](http://localhost:6061). To create the pod run:

$ cd $GOPATH/src/github.com/openshift/origin
$ output/go/bin/openshift kube create pods -c examples/hello-openshift/hello-pod.json

Contribute
----------

For any updates to hello_openshift.go, the hello_openshift binary should be rebuilt using:

$ CGO_ENABLED=0 go build -a -ldflags '-s' hello_openshift.go
22 changes: 22 additions & 0 deletions examples/hello-openshift/hello-pod.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"id": "hello-openshift",
"kind": "Pod",
"apiVersion": "v1beta1",
"desiredState": {
"manifest": {
"version": "v1beta1",
"id": "hello-openshift",
"containers": [{
"name": "hello-openshift",
"image": "openshift/hello-openshift",
"ports": [{
"containerPort": 8080,
"hostPort": 6061
}]
}]
}
},
"labels": {
"name": "hello-openshift"
}
}
Binary file added examples/hello-openshift/hello_openshift
Binary file not shown.
20 changes: 20 additions & 0 deletions examples/hello-openshift/hello_openshift.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package main

import (
"fmt"
"net/http"
)

func helloHandler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintln(w, "Hello OpenShift!")
}

func main() {
http.HandleFunc("/", helloHandler)

fmt.Println("Started, serving at 8080")
err := http.ListenAndServe(":8080", nil)
if err != nil {
panic("ListenAndServe: " + err.Error())
}
}
31 changes: 31 additions & 0 deletions examples/test-pod-multi.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"id": "mongodb-1",
"kind": "Pod",
"desiredState": {
"manifest": {
"version": "v1beta1",
"id": "mongodb-1",
"containers": [
{
"name": "rockmongo",
"image": "openshift/centos-rockmongo",
"ports": [{
"containerPort": 80,
"hostPort": 6060
}]
},
{
"name": "mongodb",
"image": "openshift/centos-mongodb",
"ports": [{
"containerPort": 27017,
"hostPort": 27017
}]
}
]
}
},
"labels": {
"name": "mongodb_with_admin"
}
}