Skip to content

Commit

Permalink
Merge pull request kubernetes#565 from brendandburns/api2
Browse files Browse the repository at this point in the history
Fork API types.
  • Loading branch information
lavalamp committed Jul 25, 2014
2 parents dde108a + 3723eb7 commit 321ce0e
Show file tree
Hide file tree
Showing 28 changed files with 1,279 additions and 77 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ Where pod.json contains something like:
```
{
"id": "php",
"kind": "Pod",
"apiVersion": "v1beta1",
"desiredState": {
"manifest": {
"version": "v1beta1",
Expand Down
4 changes: 3 additions & 1 deletion api/examples/controller-list.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"kind": "ReplicationControllerList",
"apiVersion": "v1beta1",
"items": [
{
"id": "testRun",
Expand Down Expand Up @@ -30,4 +32,4 @@
}
}
]
}
}
2 changes: 2 additions & 0 deletions api/examples/controller.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"id": "nginxController",
"apiVersion": "v1beta1",
"kind": "ReplicationController",
"desiredState": {
"replicas": 2,
"replicaSelector": {"name": "nginx"},
Expand Down
2 changes: 2 additions & 0 deletions api/examples/external-service.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"id": "example",
"kind": "Service",
"apiVersion": "v1beta1",
"port": 8000,
"labels": {
"name": "nginx"
Expand Down
2 changes: 2 additions & 0 deletions api/examples/pod-list.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"kind": "PodList",
"apiVersion": "v1beta1",
"items": [
{
"id": "my-pod-1",
Expand Down
2 changes: 2 additions & 0 deletions api/examples/pod.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"kind": "Pod",
"apiVersion": "v1beta1",
"id": "php",
"desiredState": {
"manifest": {
Expand Down
2 changes: 2 additions & 0 deletions api/examples/service-list.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"kind": "ServiceList",
"apiVersion": "v1beta1",
"items": [
{
"id": "example1",
Expand Down
2 changes: 2 additions & 0 deletions api/examples/service.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"kind": "Service",
"apiVersion": "v1beta1",
"id": "example",
"port": 8000,
"labels": {
Expand Down
2 changes: 1 addition & 1 deletion cmd/integration/integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ func runAtomicPutTest(c *client.Client) {
var svc api.Service
err := c.Post().Path("services").Body(
api.Service{
JSONBase: api.JSONBase{ID: "atomicService"},
JSONBase: api.JSONBase{ID: "atomicService", APIVersion: "v1beta1"},
Port: 12345,
Labels: map[string]string{
"name": "atomicService",
Expand Down
2 changes: 2 additions & 0 deletions examples/guestbook/frontend-controller.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"id": "frontendController",
"kind": "ReplicationController",
"apiVersion": "v1beta1",
"desiredState": {
"replicas": 3,
"replicaSelector": {"name": "frontend"},
Expand Down
2 changes: 2 additions & 0 deletions examples/guestbook/frontend-service.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"id": "frontend",
"kind": "Service",
"apiVersion": "v1beta1",
"port": 9998,
"selector": {
"name": "frontend"
Expand Down
2 changes: 2 additions & 0 deletions examples/guestbook/redis-master-service.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"id": "redismaster",
"kind": "Service",
"apiVersion": "v1beta1",
"port": 10000,
"selector": {
"name": "redis-master"
Expand Down
2 changes: 2 additions & 0 deletions examples/guestbook/redis-master.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"id": "redis-master-2",
"kind": "Pod",
"apiVersion": "v1beta1",
"desiredState": {
"manifest": {
"version": "v1beta1",
Expand Down
2 changes: 2 additions & 0 deletions examples/guestbook/redis-slave-controller.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"id": "redisSlaveController",
"kind": "ReplicationController",
"apiVersion": "v1beta1",
"desiredState": {
"replicas": 2,
"replicaSelector": {"name": "redisslave"},
Expand Down
2 changes: 2 additions & 0 deletions examples/guestbook/redis-slave-service.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"id": "redisslave",
"kind": "Service",
"apiVersion": "v1beta1",
"port": 10001,
"labels": {
"name": "redisslave"
Expand Down
4 changes: 2 additions & 2 deletions hack/test-go.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ KUBE_COVER="-cover -covermode=atomic -coverprofile=\"tmp.out\""
cd "${KUBE_TARGET}"

if [ "$1" != "" ]; then
go test -race $KUBE_COVER "$KUBE_GO_PACKAGE/$1" "${@:2}"
go test -race -timeout 30s $KUBE_COVER "$KUBE_GO_PACKAGE/$1" "${@:2}"
exit 0
fi

for package in $(find_test_dirs); do
go test -race $KUBE_COVER "${KUBE_GO_PACKAGE}/${package}" "${@:2}"
go test -race -timeout 30s $KUBE_COVER "${KUBE_GO_PACKAGE}/${package}" "${@:2}"
done
7 changes: 5 additions & 2 deletions pkg/api/apiobj_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@ func TestAPIObject(t *testing.T) {
Object APIObject `yaml:"object,omitempty" json:"object,omitempty"`
EmptyObject APIObject `yaml:"emptyObject,omitempty" json:"emptyObject,omitempty"`
}

AddKnownTypes(EmbeddedTest{})
convert := func(obj interface{}) (interface{}, error) { return obj, nil }
AddKnownTypes("", EmbeddedTest{})
AddKnownTypes("v1beta1", EmbeddedTest{})
AddExternalConversion("EmbeddedTest", convert)
AddInternalConversion("EmbeddedTest", convert)

outer := &EmbeddedTest{
JSONBase: JSONBase{ID: "outer"},
Expand Down
Loading

0 comments on commit 321ce0e

Please sign in to comment.