Commit 775787bb authored by Brian Grant's avatar Brian Grant

Merge pull request #6849 from nikhiljindal/validation

Updating api/validation/schema_test to test testapi.Version rather than just v1beta1
parents 29e68ad3 40842e44
......@@ -78,7 +78,14 @@ func main() {
if err != nil {
log.Fatalf("Couldn't read from input: %q", err)
}
isYAML := isYAML(data)
if isYAML {
data, err = yaml.YAMLToJSON(data)
if err != nil {
log.Fatalf("Failed to convert YAML to JSON: %q", err)
}
}
obj, err := api.Scheme.Decode(data)
if err != nil {
log.Fatalf("Couldn't decode input: %q", err)
......@@ -89,7 +96,7 @@ func main() {
log.Fatalf("Failed to encode to version %q: %q", *outputVersion, err)
}
if isYAML(data) {
if isYAML {
outData, err = yaml.JSONToYAML(outData)
if err != nil {
log.Fatalf("Failed to convert to YAML: %q", err)
......
......@@ -73,7 +73,10 @@ func (s *SwaggerSchema) ValidateBytes(data []byte) error {
if err := json.Unmarshal(data, &obj); err != nil {
return err
}
fields := obj.(map[string]interface{})
fields, ok := obj.(map[string]interface{})
if !ok {
return fmt.Errorf("error in unmarshaling data %s", string(data))
}
apiVersion := fields["apiVersion"].(string)
kind := fields["kind"].(string)
return s.ValidateObject(obj, apiVersion, "", apiVersion+"."+kind)
......@@ -84,25 +87,37 @@ func (s *SwaggerSchema) ValidateObject(obj interface{}, apiVersion, fieldName, t
// TODO: handle required fields here too.
model, ok := models[typeName]
if !ok {
glog.V(2).Infof("couldn't find type: %s, skipping validation", typeName)
return nil
return fmt.Errorf("couldn't find type: %s", typeName)
}
properties := model.Properties
fields := obj.(map[string]interface{})
if len(properties) == 0 {
// The object does not have any sub-fields.
return nil
}
fields, ok := obj.(map[string]interface{})
if !ok {
return fmt.Errorf("expected object of type map[string]interface{} as value of %s field", fieldName)
}
if len(fieldName) > 0 {
fieldName = fieldName + "."
}
for key, value := range fields {
details, ok := properties[key]
if !ok {
glog.V(2).Infof("couldn't find properties for %s, skipping", key)
// Some properties can be missing because of
// https://github.com/GoogleCloudPlatform/kubernetes/issues/6842.
glog.V(2).Infof("couldn't find properties for %s", key)
continue
}
if details.Type == nil {
glog.V(2).Infof("nil details for %s, skipping", key)
continue
if details.Type == nil && details.Ref == nil {
return fmt.Errorf("could not find the type of %s from object: %v", key, details)
}
var fieldType string
if details.Type != nil {
fieldType = *details.Type
} else {
fieldType = *details.Ref
}
fieldType := *details.Type
if value == nil {
glog.V(2).Infof("Skipping nil field: %s", key)
continue
......@@ -134,7 +149,15 @@ func (s *SwaggerSchema) validateField(value interface{}, apiVersion, fieldName,
if !ok {
return NewInvalidTypeError(reflect.Array, reflect.TypeOf(value).Kind(), fieldName)
}
arrType := *fieldDetails.Items.Ref
var arrType string
if fieldDetails.Items.Ref == nil && fieldDetails.Items.Type == nil {
return NewInvalidTypeError(reflect.Array, reflect.TypeOf(value).Kind(), fieldName)
}
if fieldDetails.Items.Ref != nil {
arrType = *fieldDetails.Items.Ref
} else {
arrType = *fieldDetails.Items.Type
}
for ix := range arr {
err := s.validateField(arr[ix], apiVersion, fmt.Sprintf("%s[%d]", fieldName, ix), arrType, nil)
if err != nil {
......@@ -156,6 +179,7 @@ func (s *SwaggerSchema) validateField(value interface{}, apiVersion, fieldName,
if _, ok := value.(bool); !ok {
return NewInvalidTypeError(reflect.Bool, reflect.TypeOf(value).Kind(), fieldName)
}
case "any":
default:
return fmt.Errorf("unexpected type: %v", fieldType)
}
......
......@@ -22,13 +22,22 @@ import (
"testing"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/testapi"
apitesting "github.com/GoogleCloudPlatform/kubernetes/pkg/api/testing"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/v1beta1"
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
)
func LoadSchemaForTest(file string) (Schema, error) {
data, err := ioutil.ReadFile(file)
func readPod(filename string) (string, error) {
data, err := ioutil.ReadFile("testdata/" + testapi.Version() + "/" + filename)
if err != nil {
return "", err
}
return string(data), nil
}
func loadSchemaForTest() (Schema, error) {
pathToSwaggerSpec := "../../../api/swagger-spec/" + testapi.Version() + ".json"
data, err := ioutil.ReadFile(pathToSwaggerSpec)
if err != nil {
return nil, err
}
......@@ -36,14 +45,14 @@ func LoadSchemaForTest(file string) (Schema, error) {
}
func TestLoad(t *testing.T) {
_, err := LoadSchemaForTest("v1beta1-swagger.json")
_, err := loadSchemaForTest()
if err != nil {
t.Errorf("Failed to load: %v", err)
}
}
func TestValidateOk(t *testing.T) {
schema, err := LoadSchemaForTest("v1beta1-swagger.json")
schema, err := loadSchemaForTest()
if err != nil {
t.Errorf("Failed to load: %v", err)
}
......@@ -62,7 +71,7 @@ func TestValidateOk(t *testing.T) {
for _, test := range tests {
testObj := test.obj
apiObjectFuzzer.Fuzz(testObj)
data, err := v1beta1.Codec.Encode(testObj)
data, err := testapi.Codec().Encode(testObj)
if err != nil {
t.Errorf("unexpected error: %v", err)
}
......@@ -74,150 +83,45 @@ func TestValidateOk(t *testing.T) {
}
}
var invalidPod = `{
"id": "name",
"kind": "Pod",
"apiVersion": "v1beta1",
"desiredState": {
"manifest": {
"version": "v1beta1",
"id": "redis-master",
"containers": [{
"name": "master",
"image": "dockerfile/redis",
"command": "this is a bad command",
}]
}
},
"labels": {
"name": "redis-master"
}
}
`
var invalidPod2 = `{
"apiVersion": "v1beta1",
"kind": "Pod",
"id": "apache-php",
"desiredState": {
"manifest": {
"version": "v1beta1",
"id": "apache-php",
"containers": [{
"name": "apache-php",
"image": "php:5.6.2-apache",
"ports": [{ "name": "apache", "containerPort": 80, "hostPort":"13380", "protocol":"TCP" }],
"volumeMounts": [{"name": "shared-disk","mountPath": "/var/www/html", "readOnly": false}]
}]
}
},
"labels": { "name": "apache-php" },
"restartPolicy": {"always": {}},
"dnsPolicy": "ClusterFirst",
"volumes": [
"name": "shared-disk",
"source": {
"GCEPersistentDisk": {
"path": "shared-disk"
}
}
]
}
`
var invalidPod3 = `{
"apiVersion": "v1beta1",
"kind": "Pod",
"id": "apache-php",
"desiredState": {
"manifest": {
"version": "v1beta1",
"id": "apache-php",
"containers": [{
"name": "apache-php",
"image": "php:5.6.2-apache",
"ports": [{ "name": "apache", "containerPort": 80, "hostPort":"13380", "protocol":"TCP" }],
"volumeMounts": [{"name": "shared-disk","mountPath": "/var/www/html", "readOnly": false}]
}]
}
},
"labels": { "name": "apache-php" },
"restartPolicy": {"always": {}},
"dnsPolicy": "ClusterFirst",
"volumes": [
{
"name": "shared-disk",
"source": {
"GCEPersistentDisk": {
"path": "shared-disk"
}
}
}
]
}
`
var invalidYaml = `
id: name
kind: Pod
apiVersion: v1beta1
desiredState:
manifest:
version: v1beta1
id: redis-master
containers:
- name: "master"
image: "dockerfile/redis"
command: "this is a bad command"
labels:
name: "redis-master"
`
func TestInvalid(t *testing.T) {
schema, err := LoadSchemaForTest("v1beta1-swagger.json")
schema, err := loadSchemaForTest()
if err != nil {
t.Errorf("Failed to load: %v", err)
}
tests := []string{invalidPod, invalidPod2, invalidPod3, invalidYaml}
tests := []string{
"invalidPod1.json", // command is a string, instead of []string.
"invalidPod2.json", // hostPort if of type string, instead of int.
"invalidPod3.json", // volumes is not an array of objects.
"invalidPod.yaml", // command is a string, instead of []string.
}
for _, test := range tests {
err = schema.ValidateBytes([]byte(test))
pod, err := readPod(test)
if err != nil {
t.Errorf("could not read file: %s", pod)
}
err = schema.ValidateBytes([]byte(pod))
if err == nil {
t.Errorf("unexpected non-error\n%s", test)
t.Errorf("unexpected non-error, err: %s for pod: %s", err, pod)
}
}
}
var validYaml = `
id: name
kind: Pod
apiVersion: v1beta1
desiredState:
manifest:
version: v1beta1
id: redis-master
containers:
- name: "master"
image: "dockerfile/redis"
command:
- this
- is
- an
- ok
- command
labels:
name: "redis-master"
`
func TestValid(t *testing.T) {
schema, err := LoadSchemaForTest("v1beta1-swagger.json")
schema, err := loadSchemaForTest()
if err != nil {
t.Errorf("Failed to load: %v", err)
}
tests := []string{validYaml}
tests := []string{
"validPod.yaml",
}
for _, test := range tests {
err = schema.ValidateBytes([]byte(test))
if err == nil {
t.Errorf("unexpected non-error\n%s", test)
pod, err := readPod(test)
if err != nil {
t.Errorf("could not read file: %s", test)
}
err = schema.ValidateBytes([]byte(pod))
if err != nil {
t.Errorf("unexpected error %s, for pod %s", err, pod)
}
}
}
kind: Pod
apiVersion: v1beta1
id: name
desiredState:
manifest:
version: v1beta1
id: redis-master
containers:
- name: "master"
image: "dockerfile/redis"
command: "this is a bad command"
labels:
name: "redis-master"
{
"id": "name",
"kind": "Pod",
"apiVersion": "v1beta1",
"desiredState": {
"manifest": {
"version": "v1beta1",
"id": "redis-master",
"containers": [{
"name": "master",
"image": "dockerfile/redis",
"command": "this is a bad command"
}]
}
},
"labels": {
"name": "redis-master"
}
}
{
"apiVersion": "v1beta1",
"kind": "Pod",
"id": "apache-php",
"desiredState": {
"manifest": {
"version": "v1beta1",
"id": "apache-php",
"containers": [{
"name": "apache-php",
"image": "php:5.6.2-apache",
"ports": [{ "name": "apache", "containerPort": 80, "hostPort":"13380", "protocol":"TCP" }],
"volumeMounts": [{"name": "shared-disk","mountPath": "/var/www/html", "readOnly": false}]
}],
"restartPolicy": {"always": {}},
"dnsPolicy": "ClusterFirst",
"volumes": [{
"name": "shared-disk",
"source": {
"GCEPersistentDisk": {
"path": "shared-disk"
}
}
}]
}
},
"labels": { "name": "apache-php" }
}
{
"apiVersion": "v1beta1",
"kind": "Pod",
"id": "apache-php",
"desiredState": {
"manifest": {
"version": "v1beta1",
"id": "apache-php",
"containers": [{
"name": "apache-php",
"image": "php:5.6.2-apache",
"ports": [{ "name": "apache", "containerPort": 80, "hostPort":13380, "protocol":"TCP" }],
"volumeMounts": [{"name": "shared-disk","mountPath": "/var/www/html", "readOnly": false}]
}],
"restartPolicy": {"always": {}},
"dnsPolicy": "ClusterFirst",
"volumes": [
"name": "shared-disk",
"source": {
"GCEPersistentDisk": {
"path": "shared-disk"
}
}
]
}
},
"labels": { "name": "apache-php" }
}
id: name
kind: Pod
apiVersion: v1beta1
desiredState:
manifest:
version: v1beta1
id: redis-master
containers:
- name: "master"
image: "dockerfile/redis"
command:
- this
- is
- an
- ok
- command
labels:
name: "redis-master"
apiVersion: v1beta3
kind: Pod
metadata:
labels:
name: redis-master
name: name
spec:
containers:
- args: "this is a bad command"
image: dockerfile/redis
name: master
{
"kind": "Pod",
"apiVersion": "v1beta3",
"metadata": {
"name": "name",
"labels": {
"name": "redis-master"
}
},
"spec": {
"containers": [
{
"name": "master",
"image": "dockerfile/redis",
"args": "this is a bad command"
}
]
}
}
{
"kind": "Pod",
"apiVersion": "v1beta3",
"metadata": {
"name": "apache-php",
"labels": {
"name": "apache-php"
}
},
"spec": {
"volumes": [{
"name": "shared-disk"
}],
"containers": [
{
"name": "apache-php",
"image": "php:5.6.2-apache",
"ports": [
{
"name": "apache",
"hostPort": "13380",
"containerPort": 80,
"protocol": "TCP"
}
],
"volumeMounts": [
{
"name": "shared-disk",
"mountPath": "/var/www/html"
}
]
}
]
}
}
{
"kind": "Pod",
"apiVersion": "v1beta3",
"metadata": {
"name": "apache-php",
"labels": {
"name": "apache-php"
}
},
"spec": {
"volumes": [
"name": "shared-disk"
],
"containers": [
{
"name": "apache-php",
"image": "php:5.6.2-apache",
"ports": [
{
"name": "apache",
"hostPort": 13380,
"containerPort": 80,
"protocol": "TCP"
}
],
"volumeMounts": [
{
"name": "shared-disk",
"mountPath": "/var/www/html"
}
]
}
]
}
}
apiVersion: v1beta3
kind: Pod
metadata:
labels:
name: redis-master
name: name
spec:
containers:
- args:
- this
- is
- an
- ok
- command
image: dockerfile/redis
name: master
{
"swaggerVersion": "1.2",
"apiVersion": "",
"basePath": "http://127.0.0.1:8080",
"resourcePath": "/api/v1beta1",
"apis": [
{
"path": "/api/v1beta1/bindings",
"description": "API at /api, version v1beta1",
"operations": [
{
"type": "void",
"method": "POST",
"summary": "create a Binding",
"nickname": "createBinding",
"parameters": [
{
"type": "v1beta1.Binding",
"paramType": "body",
"name": "v1beta1.Binding",
"description": "",
"required": true,
"allowMultiple": false
}
],
"produces": [
"application/json"
],
"consumes": [
"*/*"
]
}
]
},
{
"path": "/api/v1beta1/replicationControllers/{name}",
"description": "API at /api, version v1beta1",
"operations": [
{
"type": "v1beta1.ReplicationController",
"method": "GET",
"summary": "read the specified ReplicationController",
"nickname": "readReplicationController",
"parameters": [
{
"type": "string",
"paramType": "path",
"name": "name",
"description": "name of the ReplicationController",
"required": true,
"allowMultiple": false
}
],
"produces": [
"application/json"
],
"consumes": [
"*/*"
]
},
{
"type": "void",
"method": "PUT",
"summary": "update the specified ReplicationController",
"nickname": "updateReplicationController",
"parameters": [
{
"type": "string",
"paramType": "path",
"name": "name",
"description": "name of the ReplicationController",
"required": true,
"allowMultiple": false
},
{
"type": "v1beta1.ReplicationController",
"paramType": "body",
"name": "v1beta1.ReplicationController",
"description": "",
"required": true,
"allowMultiple": false
}
],
"produces": [
"application/json"
],
"consumes": [
"*/*"
]
},
{
"type": "void",
"method": "DELETE",
"summary": "delete the specified ReplicationController",
"nickname": "deleteReplicationController",
"parameters": [
{
"type": "string",
"paramType": "path",
"name": "name",
"description": "name of the ReplicationController",
"required": true,
"allowMultiple": false
}
],
"produces": [
"application/json"
],
"consumes": [
"*/*"
]
}
]
},
{
"path": "/api/v1beta1/services/{name}",
"description": "API at /api, version v1beta1",
"operations": [
{
"type": "v1beta1.Service",
"method": "GET",
"summary": "read the specified Service",
"nickname": "readService",
"parameters": [
{
"type": "string",
"paramType": "path",
"name": "name",
"description": "name of the Service",
"required": true,
"allowMultiple": false
}
],
"produces": [
"application/json"
],
"consumes": [
"*/*"
]
},
{
"type": "void",
"method": "PUT",
"summary": "update the specified Service",
"nickname": "updateService",
"parameters": [
{
"type": "string",
"paramType": "path",
"name": "name",
"description": "name of the Service",
"required": true,
"allowMultiple": false
},
{
"type": "v1beta1.Service",
"paramType": "body",
"name": "v1beta1.Service",
"description": "",
"required": true,
"allowMultiple": false
}
],
"produces": [
"application/json"
],
"consumes": [
"*/*"
]
},
{
"type": "void",
"method": "DELETE",
"summary": "delete the specified Service",
"nickname": "deleteService",
"parameters": [
{
"type": "string",
"paramType": "path",
"name": "name",
"description": "name of the Service",
"required": true,
"allowMultiple": false
}
],
"produces": [
"application/json"
],
"consumes": [
"*/*"
]
}
]
},
{
"path": "/api/v1beta1/endpoints",
"description": "API at /api, version v1beta1",
"operations": [
{
"type": "void",
"method": "POST",
"summary": "create a Endpoints",
"nickname": "createEndpoints",
"parameters": [
{
"type": "v1beta1.Endpoints",
"paramType": "body",
"name": "v1beta1.Endpoints",
"description": "",
"required": true,
"allowMultiple": false
}
],
"produces": [
"application/json"
],
"consumes": [
"*/*"
]
},
{
"type": "void",
"method": "GET",
"summary": "list objects of kind Endpoints",
"nickname": "listEndpoints",
"parameters": [],
"responseMessages": [
{
"code": 200,
"message": "OK",
"responseModel": "v1beta1.EndpointsList"
}
],
"produces": [
"application/json"
],
"consumes": [
"*/*"
]
}
]
},
{
"path": "/api/v1beta1/events/{name}",
"description": "API at /api, version v1beta1",
"operations": [
{
"type": "v1beta1.Event",
"method": "GET",
"summary": "read the specified Event",
"nickname": "readEvent",
"parameters": [
{
"type": "string",
"paramType": "path",
"name": "name",
"description": "name of the Event",
"required": true,
"allowMultiple": false
}
],
"produces": [
"application/json"
],
"consumes": [
"*/*"
]
},
{
"type": "void",
"method": "PUT",
"summary": "update the specified Event",
"nickname": "updateEvent",
"parameters": [
{
"type": "string",
"paramType": "path",
"name": "name",
"description": "name of the Event",
"required": true,
"allowMultiple": false
},
{
"type": "v1beta1.Event",
"paramType": "body",
"name": "v1beta1.Event",
"description": "",
"required": true,
"allowMultiple": false
}
],
"produces": [
"application/json"
],
"consumes": [
"*/*"
]
},
{
"type": "void",
"method": "DELETE",
"summary": "delete the specified Event",
"nickname": "deleteEvent",
"parameters": [
{
"type": "string",
"paramType": "path",
"name": "name",
"description": "name of the Event",
"required": true,
"allowMultiple": false
}
],
"produces": [
"application/json"
],
"consumes": [
"*/*"
]
}
]
},
{
"path": "/api/v1beta1/events",
"description": "API at /api, version v1beta1",
"operations": [
{
"type": "void",
"method": "POST",
"summary": "create a Event",
"nickname": "createEvent",
"parameters": [
{
"type": "v1beta1.Event",
"paramType": "body",
"name": "v1beta1.Event",
"description": "",
"required": true,
"allowMultiple": false
}
],
"produces": [
"application/json"
],
"consumes": [
"*/*"
]
},
{
"type": "void",
"method": "GET",
"summary": "list objects of kind Event",
"nickname": "listEvent",
"parameters": [],
"responseMessages": [
{
"code": 200,
"message": "OK",
"responseModel": "v1beta1.EventList"
}
],
"produces": [
"application/json"
],
"consumes": [
"*/*"
]
}
]
},
{
"path": "/api/v1beta1/services",
"description": "API at /api, version v1beta1",
"operations": [
{
"type": "void",
"method": "POST",
"summary": "create a Service",
"nickname": "createService",
"parameters": [
{
"type": "v1beta1.Service",
"paramType": "body",
"name": "v1beta1.Service",
"description": "",
"required": true,
"allowMultiple": false
}
],
"produces": [
"application/json"
],
"consumes": [
"*/*"
]
},
{
"type": "void",
"method": "GET",
"summary": "list objects of kind Service",
"nickname": "listService",
"parameters": [],
"responseMessages": [
{
"code": 200,
"message": "OK",
"responseModel": "v1beta1.ServiceList"
}
],
"produces": [
"application/json"
],
"consumes": [
"*/*"
]
}
]
},
{
"path": "/api/v1beta1/minions",
"description": "API at /api, version v1beta1",
"operations": [
{
"type": "void",
"method": "POST",
"summary": "create a Minion",
"nickname": "createMinion",
"parameters": [
{
"type": "v1beta1.Minion",
"paramType": "body",
"name": "v1beta1.Minion",
"description": "",
"required": true,
"allowMultiple": false
}
],
"produces": [
"application/json"
],
"consumes": [
"*/*"
]
},
{
"type": "void",
"method": "GET",
"summary": "list objects of kind Minion",
"nickname": "listMinion",
"parameters": [],
"responseMessages": [
{
"code": 200,
"message": "OK",
"responseModel": "v1beta1.MinionList"
}
],
"produces": [
"application/json"
],
"consumes": [
"*/*"
]
}
]
},
{
"path": "/api/v1beta1/minions/{name}",
"description": "API at /api, version v1beta1",
"operations": [
{
"type": "v1beta1.Minion",
"method": "GET",
"summary": "read the specified Minion",
"nickname": "readMinion",
"parameters": [
{
"type": "string",
"paramType": "path",
"name": "name",
"description": "name of the Minion",
"required": true,
"allowMultiple": false
}
],
"produces": [
"application/json"
],
"consumes": [
"*/*"
]
},
{
"type": "void",
"method": "PUT",
"summary": "update the specified Minion",
"nickname": "updateMinion",
"parameters": [
{
"type": "string",
"paramType": "path",
"name": "name",
"description": "name of the Minion",
"required": true,
"allowMultiple": false
},
{
"type": "v1beta1.Minion",
"paramType": "body",
"name": "v1beta1.Minion",
"description": "",
"required": true,
"allowMultiple": false
}
],
"produces": [
"application/json"
],
"consumes": [
"*/*"
]
},
{
"type": "void",
"method": "DELETE",
"summary": "delete the specified Minion",
"nickname": "deleteMinion",
"parameters": [
{
"type": "string",
"paramType": "path",
"name": "name",
"description": "name of the Minion",
"required": true,
"allowMultiple": false
}
],
"produces": [
"application/json"
],
"consumes": [
"*/*"
]
}
]
},
{
"path": "/api/v1beta1/pods/{name}",
"description": "API at /api, version v1beta1",
"operations": [
{
"type": "v1beta1.Pod",
"method": "GET",
"summary": "read the specified Pod",
"nickname": "readPod",
"parameters": [
{
"type": "string",
"paramType": "path",
"name": "name",
"description": "name of the Pod",
"required": true,
"allowMultiple": false
}
],
"produces": [
"application/json"
],
"consumes": [
"*/*"
]
},
{
"type": "void",
"method": "PUT",
"summary": "update the specified Pod",
"nickname": "updatePod",
"parameters": [
{
"type": "string",
"paramType": "path",
"name": "name",
"description": "name of the Pod",
"required": true,
"allowMultiple": false
},
{
"type": "v1beta1.Pod",
"paramType": "body",
"name": "v1beta1.Pod",
"description": "",
"required": true,
"allowMultiple": false
}
],
"produces": [
"application/json"
],
"consumes": [
"*/*"
]
},
{
"type": "void",
"method": "DELETE",
"summary": "delete the specified Pod",
"nickname": "deletePod",
"parameters": [
{
"type": "string",
"paramType": "path",
"name": "name",
"description": "name of the Pod",
"required": true,
"allowMultiple": false
}
],
"produces": [
"application/json"
],
"consumes": [
"*/*"
]
}
]
},
{
"path": "/api/v1beta1/replicationControllers",
"description": "API at /api, version v1beta1",
"operations": [
{
"type": "void",
"method": "POST",
"summary": "create a ReplicationController",
"nickname": "createReplicationController",
"parameters": [
{
"type": "v1beta1.ReplicationController",
"paramType": "body",
"name": "v1beta1.ReplicationController",
"description": "",
"required": true,
"allowMultiple": false
}
],
"produces": [
"application/json"
],
"consumes": [
"*/*"
]
},
{
"type": "void",
"method": "GET",
"summary": "list objects of kind ReplicationController",
"nickname": "listReplicationController",
"parameters": [],
"responseMessages": [
{
"code": 200,
"message": "OK",
"responseModel": "v1beta1.ReplicationControllerList"
}
],
"produces": [
"application/json"
],
"consumes": [
"*/*"
]
}
]
},
{
"path": "/api/v1beta1/endpoints/{name}",
"description": "API at /api, version v1beta1",
"operations": [
{
"type": "v1beta1.Endpoints",
"method": "GET",
"summary": "read the specified Endpoints",
"nickname": "readEndpoints",
"parameters": [
{
"type": "string",
"paramType": "path",
"name": "name",
"description": "name of the Endpoints",
"required": true,
"allowMultiple": false
}
],
"produces": [
"application/json"
],
"consumes": [
"*/*"
]
},
{
"type": "void",
"method": "PUT",
"summary": "update the specified Endpoints",
"nickname": "updateEndpoints",
"parameters": [
{
"type": "string",
"paramType": "path",
"name": "name",
"description": "name of the Endpoints",
"required": true,
"allowMultiple": false
},
{
"type": "v1beta1.Endpoints",
"paramType": "body",
"name": "v1beta1.Endpoints",
"description": "",
"required": true,
"allowMultiple": false
}
],
"produces": [
"application/json"
],
"consumes": [
"*/*"
]
},
{
"type": "void",
"method": "DELETE",
"summary": "delete the specified Endpoints",
"nickname": "deleteEndpoints",
"parameters": [
{
"type": "string",
"paramType": "path",
"name": "name",
"description": "name of the Endpoints",
"required": true,
"allowMultiple": false
}
],
"produces": [
"application/json"
],
"consumes": [
"*/*"
]
}
]
},
{
"path": "/api/v1beta1/bindings/{name}",
"description": "API at /api, version v1beta1",
"operations": [
{
"type": "v1beta1.Binding",
"method": "GET",
"summary": "read the specified Binding",
"nickname": "readBinding",
"parameters": [
{
"type": "string",
"paramType": "path",
"name": "name",
"description": "name of the Binding",
"required": true,
"allowMultiple": false
}
],
"produces": [
"application/json"
],
"consumes": [
"*/*"
]
},
{
"type": "void",
"method": "PUT",
"summary": "update the specified Binding",
"nickname": "updateBinding",
"parameters": [
{
"type": "string",
"paramType": "path",
"name": "name",
"description": "name of the Binding",
"required": true,
"allowMultiple": false
},
{
"type": "v1beta1.Binding",
"paramType": "body",
"name": "v1beta1.Binding",
"description": "",
"required": true,
"allowMultiple": false
}
],
"produces": [
"application/json"
],
"consumes": [
"*/*"
]
},
{
"type": "void",
"method": "DELETE",
"summary": "delete the specified Binding",
"nickname": "deleteBinding",
"parameters": [
{
"type": "string",
"paramType": "path",
"name": "name",
"description": "name of the Binding",
"required": true,
"allowMultiple": false
}
],
"produces": [
"application/json"
],
"consumes": [
"*/*"
]
}
]
},
{
"path": "/api/v1beta1/pods",
"description": "API at /api, version v1beta1",
"operations": [
{
"type": "void",
"method": "POST",
"summary": "create a Pod",
"nickname": "createPod",
"parameters": [
{
"type": "v1beta1.Pod",
"paramType": "body",
"name": "v1beta1.Pod",
"description": "",
"required": true,
"allowMultiple": false
}
],
"produces": [
"application/json"
],
"consumes": [
"*/*"
]
},
{
"type": "void",
"method": "GET",
"summary": "list objects of kind Pod",
"nickname": "listPod",
"parameters": [],
"responseMessages": [
{
"code": 200,
"message": "OK",
"responseModel": "v1beta1.PodList"
}
],
"produces": [
"application/json"
],
"consumes": [
"*/*"
]
}
]
}
],
"models": {
"v1beta1.Binding": {
"id": "v1beta1.Binding",
"required": [
"annotations",
"kind",
"id",
"creationTimestamp",
"selfLink",
"namespace",
"uid",
"resourceVersion",
"apiVersion",
"podID",
"host"
],
"properties": {
"annotations": {
"type": "v1beta1.TypeMeta.annotations"
},
"apiVersion": {
"type": "string"
},
"creationTimestamp": {
"type": "string"
},
"host": {
"type": "string"
},
"id": {
"type": "string"
},
"kind": {
"type": "string"
},
"namespace": {
"type": "string"
},
"podID": {
"type": "string"
},
"resourceVersion": {
"type": "uint64"
},
"selfLink": {
"type": "string"
},
"uid": {
"type": "string"
}
}
},
"v1beta1.Container": {
"id": "v1beta1.Container",
"required": [
"name",
"image",
"imagePullPolicy"
],
"properties": {
"command": {
"type": "array",
"items": {
"$ref": "string"
}
},
"cpu": {
"type": "integer",
"format": "int32"
},
"env": {
"type": "array",
"items": {
"$ref": "v1beta1.EnvVar"
}
},
"image": {
"type": "string"
},
"imagePullPolicy": {
"type": "v1beta1.PullPolicy"
},
"lifecycle": {
"type": "v1beta1.Lifecycle"
},
"livenessProbe": {
"type": "v1beta1.LivenessProbe"
},
"memory": {
"type": "integer",
"format": "int32"
},
"name": {
"type": "string"
},
"ports": {
"type": "array",
"items": {
"$ref": "v1beta1.Port"
}
},
"privileged": {
"type": "boolean"
},
"terminationMessagePath": {
"type": "string"
},
"volumeMounts": {
"type": "array",
"items": {
"$ref": "v1beta1.VolumeMount"
}
},
"workingDir": {
"type": "string"
}
}
},
"v1beta1.ContainerManifest": {
"id": "v1beta1.ContainerManifest",
"required": [
"version",
"id",
"volumes",
"containers"
],
"properties": {
"containers": {
"type": "array",
"items": {
"$ref": "v1beta1.Container"
}
},
"id": {
"type": "string"
},
"restartPolicy": {
"type": "v1beta1.RestartPolicy"
},
"uuid": {
"type": "string"
},
"version": {
"type": "string"
},
"volumes": {
"type": "array",
"items": {
"$ref": "v1beta1.Volume"
}
}
}
},
"v1beta1.EmptyDir": {
"id": "v1beta1.EmptyDir",
"properties": {}
},
"v1beta1.Endpoints": {
"id": "v1beta1.Endpoints",
"required": [
"creationTimestamp",
"selfLink",
"namespace",
"kind",
"id",
"uid",
"resourceVersion",
"apiVersion",
"annotations"
],
"properties": {
"annotations": {
"type": "v1beta1.TypeMeta.annotations"
},
"apiVersion": {
"type": "string"
},
"creationTimestamp": {
"type": "string"
},
"endpoints": {
"type": "array",
"items": {
"$ref": "string"
}
},
"id": {
"type": "string"
},
"kind": {
"type": "string"
},
"namespace": {
"type": "string"
},
"resourceVersion": {
"type": "uint64"
},
"selfLink": {
"type": "string"
},
"uid": {
"type": "string"
}
}
},
"v1beta1.EndpointsList": {
"id": "v1beta1.EndpointsList",
"required": [
"creationTimestamp",
"selfLink",
"resourceVersion",
"apiVersion",
"namespace",
"kind",
"id",
"uid",
"annotations",
"items"
],
"properties": {
"annotations": {
"type": "v1beta1.TypeMeta.annotations"
},
"apiVersion": {
"type": "string"
},
"creationTimestamp": {
"type": "string"
},
"id": {
"type": "string"
},
"items": {
"type": "array",
"items": {
"$ref": "v1beta1.Endpoints"
}
},
"kind": {
"type": "string"
},
"namespace": {
"type": "string"
},
"resourceVersion": {
"type": "uint64"
},
"selfLink": {
"type": "string"
},
"uid": {
"type": "string"
}
}
},
"v1beta1.EnvVar": {
"id": "v1beta1.EnvVar",
"required": [
"name"
],
"properties": {
"key": {
"type": "string"
},
"name": {
"type": "string"
},
"value": {
"type": "string"
}
}
},
"v1beta1.Event": {
"id": "v1beta1.Event",
"required": [
"id",
"uid",
"resourceVersion",
"namespace",
"kind",
"creationTimestamp",
"selfLink",
"apiVersion",
"annotations"
],
"properties": {
"annotations": {
"type": "v1beta1.TypeMeta.annotations"
},
"apiVersion": {
"type": "string"
},
"creationTimestamp": {
"type": "string"
},
"id": {
"type": "string"
},
"involvedObject": {
"type": "v1beta1.ObjectReference"
},
"kind": {
"type": "string"
},
"message": {
"type": "string"
},
"namespace": {
"type": "string"
},
"reason": {
"type": "string"
},
"resourceVersion": {
"type": "uint64"
},
"selfLink": {
"type": "string"
},
"source": {
"type": "string"
},
"status": {
"type": "string"
},
"timestamp": {
"type": "string"
},
"uid": {
"type": "string"
}
}
},
"v1beta1.EventList": {
"id": "v1beta1.EventList",
"required": [
"apiVersion",
"annotations",
"kind",
"id",
"creationTimestamp",
"selfLink",
"uid",
"resourceVersion",
"namespace",
"items"
],
"properties": {
"annotations": {
"type": "v1beta1.TypeMeta.annotations"
},
"apiVersion": {
"type": "string"
},
"creationTimestamp": {
"type": "string"
},
"id": {
"type": "string"
},
"items": {
"type": "array",
"items": {
"$ref": "v1beta1.Event"
}
},
"kind": {
"type": "string"
},
"namespace": {
"type": "string"
},
"resourceVersion": {
"type": "uint64"
},
"selfLink": {
"type": "string"
},
"uid": {
"type": "string"
}
}
},
"v1beta1.ExecAction": {
"id": "v1beta1.ExecAction",
"properties": {
"command": {
"type": "array",
"items": {
"$ref": "string"
}
}
}
},
"v1beta1.GCEPersistentDisk": {
"id": "v1beta1.GCEPersistentDisk",
"required": [
"pdName"
],
"properties": {
"fsType": {
"type": "string"
},
"partition": {
"type": "integer",
"format": "int32"
},
"pdName": {
"type": "string"
},
"readOnly": {
"type": "boolean"
}
}
},
"v1beta1.GitRepo": {
"id": "v1beta1.GitRepo",
"required": [
"repository",
"revision"
],
"properties": {
"repository": {
"type": "string"
},
"revision": {
"type": "string"
}
}
},
"v1beta1.ISCSI": {
"id": "v1beta1.ISCSI",
"required": [
"targetPortal",
"iqn"
],
"properties": {
"fsType": {
"type": "string"
},
"lun": {
"type": "integer",
"format": "int32"
},
"targetPortal": {
"type": "string"
},
"readOnly": {
"type": "boolean"
},
"iqn": {
"type": "string"
}
}
},
"v1beta1.HTTPGetAction": {
"id": "v1beta1.HTTPGetAction",
"properties": {
"host": {
"type": "string"
},
"path": {
"type": "string"
},
"port": {
"type": "string"
}
}
},
"v1beta1.Handler": {
"id": "v1beta1.Handler",
"properties": {
"exec": {
"type": "v1beta1.ExecAction"
},
"httpGet": {
"type": "v1beta1.HTTPGetAction"
}
}
},
"v1beta1.HostDir": {
"id": "v1beta1.HostDir",
"required": [
"path"
],
"properties": {
"path": {
"type": "string"
}
}
},
"v1beta1.Lifecycle": {
"id": "v1beta1.Lifecycle",
"properties": {
"postStart": {
"type": "v1beta1.Handler"
},
"preStop": {
"type": "v1beta1.Handler"
}
}
},
"v1beta1.LivenessProbe": {
"id": "v1beta1.LivenessProbe",
"properties": {
"exec": {
"type": "v1beta1.ExecAction"
},
"httpGet": {
"type": "v1beta1.HTTPGetAction"
},
"initialDelaySeconds": {
"type": "integer",
"format": "int64"
},
"tcpSocket": {
"type": "v1beta1.TCPSocketAction"
}
}
},
"v1beta1.Minion": {
"id": "v1beta1.Minion",
"required": [
"creationTimestamp",
"selfLink",
"annotations",
"kind",
"id",
"uid",
"resourceVersion",
"apiVersion",
"namespace"
],
"properties": {
"annotations": {
"type": "v1beta1.TypeMeta.annotations"
},
"apiVersion": {
"type": "string"
},
"creationTimestamp": {
"type": "string"
},
"hostIP": {
"type": "string"
},
"id": {
"type": "string"
},
"kind": {
"type": "string"
},
"labels": {
"type": "v1beta1.Minion.labels"
},
"namespace": {
"type": "string"
},
"resourceVersion": {
"type": "uint64"
},
"resources": {
"type": "v1beta1.NodeResources"
},
"selfLink": {
"type": "string"
},
"uid": {
"type": "string"
}
}
},
"v1beta1.Minion.labels": {
"id": "v1beta1.Minion.labels",
"properties": {}
},
"v1beta1.MinionList": {
"id": "v1beta1.MinionList",
"required": [
"annotations",
"uid",
"resourceVersion",
"apiVersion",
"namespace",
"kind",
"id",
"creationTimestamp",
"selfLink",
"items"
],
"properties": {
"annotations": {
"type": "v1beta1.TypeMeta.annotations"
},
"apiVersion": {
"type": "string"
},
"creationTimestamp": {
"type": "string"
},
"id": {
"type": "string"
},
"items": {
"type": "array",
"items": {
"$ref": "v1beta1.Minion"
}
},
"kind": {
"type": "string"
},
"minions": {
"type": "array",
"items": {
"$ref": "v1beta1.Minion"
}
},
"namespace": {
"type": "string"
},
"resourceVersion": {
"type": "uint64"
},
"selfLink": {
"type": "string"
},
"uid": {
"type": "string"
}
}
},
"v1beta1.NodeResources": {
"id": "v1beta1.NodeResources",
"properties": {
"capacity": {
"type": "v1beta1.ResourceList"
}
}
},
"v1beta1.ObjectReference": {
"id": "v1beta1.ObjectReference",
"properties": {
"apiVersion": {
"type": "string"
},
"fieldPath": {
"type": "string"
},
"kind": {
"type": "string"
},
"name": {
"type": "string"
},
"namespace": {
"type": "string"
},
"resourceVersion": {
"type": "string"
},
"uid": {
"type": "string"
}
}
},
"v1beta1.Pod": {
"id": "v1beta1.Pod",
"required": [
"kind",
"creationTimestamp",
"selfLink",
"resourceVersion",
"namespace",
"id",
"uid",
"apiVersion",
"annotations"
],
"properties": {
"annotations": {
"type": "v1beta1.TypeMeta.annotations"
},
"apiVersion": {
"type": "string"
},
"creationTimestamp": {
"type": "string"
},
"currentState": {
"type": "v1beta1.PodState"
},
"desiredState": {
"type": "v1beta1.PodState"
},
"id": {
"type": "string"
},
"kind": {
"type": "string"
},
"labels": {
"type": "v1beta1.Pod.labels"
},
"namespace": {
"type": "string"
},
"nodeSelector": {
"type": "v1beta1.Pod.nodeSelector"
},
"resourceVersion": {
"type": "uint64"
},
"selfLink": {
"type": "string"
},
"uid": {
"type": "string"
}
}
},
"v1beta1.Pod.labels": {
"id": "v1beta1.Pod.labels",
"properties": {}
},
"v1beta1.Pod.nodeSelector": {
"id": "v1beta1.Pod.nodeSelector",
"properties": {}
},
"v1beta1.PodList": {
"id": "v1beta1.PodList",
"required": [
"uid",
"creationTimestamp",
"apiVersion",
"annotations",
"namespace",
"kind",
"id",
"selfLink",
"resourceVersion",
"items"
],
"properties": {
"annotations": {
"type": "v1beta1.TypeMeta.annotations"
},
"apiVersion": {
"type": "string"
},
"creationTimestamp": {
"type": "string"
},
"id": {
"type": "string"
},
"items": {
"type": "array",
"items": {
"$ref": "v1beta1.Pod"
}
},
"kind": {
"type": "string"
},
"namespace": {
"type": "string"
},
"resourceVersion": {
"type": "uint64"
},
"selfLink": {
"type": "string"
},
"uid": {
"type": "string"
}
}
},
"v1beta1.PodState": {
"id": "v1beta1.PodState",
"properties": {
"host": {
"type": "string"
},
"hostIP": {
"type": "string"
},
"info": {
"type": "v1beta1.PodInfo"
},
"manifest": {
"type": "v1beta1.ContainerManifest"
},
"message": {
"type": "string"
},
"podIP": {
"type": "string"
},
"status": {
"type": "v1beta1.PodStatus"
}
}
},
"v1beta1.PodTemplate": {
"id": "v1beta1.PodTemplate",
"properties": {
"desiredState": {
"type": "v1beta1.PodState"
},
"labels": {
"type": "v1beta1.PodTemplate.labels"
}
}
},
"v1beta1.PodTemplate.labels": {
"id": "v1beta1.PodTemplate.labels",
"properties": {}
},
"v1beta1.Port": {
"id": "v1beta1.Port",
"required": [
"containerPort"
],
"properties": {
"containerPort": {
"type": "integer",
"format": "int32"
},
"hostIP": {
"type": "string"
},
"hostPort": {
"type": "integer",
"format": "int32"
},
"name": {
"type": "string"
},
"protocol": {
"type": "v1beta1.Protocol"
}
}
},
"v1beta1.ReplicationController": {
"id": "v1beta1.ReplicationController",
"required": [
"apiVersion",
"namespace",
"kind",
"uid",
"creationTimestamp",
"selfLink",
"id",
"resourceVersion",
"annotations"
],
"properties": {
"annotations": {
"type": "v1beta1.TypeMeta.annotations"
},
"apiVersion": {
"type": "string"
},
"creationTimestamp": {
"type": "string"
},
"currentState": {
"type": "v1beta1.ReplicationControllerState"
},
"desiredState": {
"type": "v1beta1.ReplicationControllerState"
},
"id": {
"type": "string"
},
"kind": {
"type": "string"
},
"labels": {
"type": "v1beta1.ReplicationController.labels"
},
"namespace": {
"type": "string"
},
"resourceVersion": {
"type": "uint64"
},
"selfLink": {
"type": "string"
},
"uid": {
"type": "string"
}
}
},
"v1beta1.ReplicationController.labels": {
"id": "v1beta1.ReplicationController.labels",
"properties": {}
},
"v1beta1.ReplicationControllerList": {
"id": "v1beta1.ReplicationControllerList",
"required": [
"kind",
"resourceVersion",
"apiVersion",
"annotations",
"id",
"uid",
"creationTimestamp",
"selfLink",
"namespace",
"items"
],
"properties": {
"annotations": {
"type": "v1beta1.TypeMeta.annotations"
},
"apiVersion": {
"type": "string"
},
"creationTimestamp": {
"type": "string"
},
"id": {
"type": "string"
},
"items": {
"type": "array",
"items": {
"$ref": "v1beta1.ReplicationController"
}
},
"kind": {
"type": "string"
},
"namespace": {
"type": "string"
},
"resourceVersion": {
"type": "uint64"
},
"selfLink": {
"type": "string"
},
"uid": {
"type": "string"
}
}
},
"v1beta1.ReplicationControllerState": {
"id": "v1beta1.ReplicationControllerState",
"required": [
"replicas"
],
"properties": {
"podTemplate": {
"type": "v1beta1.PodTemplate"
},
"replicaSelector": {
"type": "v1beta1.ReplicationControllerState.replicaSelector"
},
"replicas": {
"type": "integer",
"format": "int32"
}
}
},
"v1beta1.ReplicationControllerState.replicaSelector": {
"id": "v1beta1.ReplicationControllerState.replicaSelector",
"properties": {}
},
"v1beta1.RestartPolicy": {
"id": "v1beta1.RestartPolicy",
"properties": {
"always": {
"type": "v1beta1.RestartPolicyAlways"
},
"never": {
"type": "v1beta1.RestartPolicyNever"
},
"onFailure": {
"type": "v1beta1.RestartPolicyOnFailure"
}
}
},
"v1beta1.RestartPolicyAlways": {
"id": "v1beta1.RestartPolicyAlways",
"properties": {}
},
"v1beta1.RestartPolicyNever": {
"id": "v1beta1.RestartPolicyNever",
"properties": {}
},
"v1beta1.RestartPolicyOnFailure": {
"id": "v1beta1.RestartPolicyOnFailure",
"properties": {}
},
"v1beta1.Service": {
"id": "v1beta1.Service",
"required": [
"id",
"selfLink",
"resourceVersion",
"namespace",
"kind",
"uid",
"creationTimestamp",
"apiVersion",
"annotations",
"port"
],
"properties": {
"annotations": {
"type": "v1beta1.TypeMeta.annotations"
},
"apiVersion": {
"type": "string"
},
"containerPort": {
"type": "string"
},
"createExternalLoadBalancer": {
"type": "boolean"
},
"creationTimestamp": {
"type": "string"
},
"id": {
"type": "string"
},
"kind": {
"type": "string"
},
"labels": {
"type": "v1beta1.Service.labels"
},
"namespace": {
"type": "string"
},
"port": {
"type": "integer",
"format": "int32"
},
"portalIP": {
"type": "string"
},
"protocol": {
"type": "v1beta1.Protocol"
},
"proxyPort": {
"type": "integer",
"format": "int32"
},
"publicIPs": {
"type": "array",
"items": {
"$ref": "string"
}
},
"resourceVersion": {
"type": "uint64"
},
"selector": {
"type": "v1beta1.Service.selector"
},
"selfLink": {
"type": "string"
},
"uid": {
"type": "string"
}
}
},
"v1beta1.Service.labels": {
"id": "v1beta1.Service.labels",
"properties": {}
},
"v1beta1.Service.selector": {
"id": "v1beta1.Service.selector",
"properties": {}
},
"v1beta1.ServiceList": {
"id": "v1beta1.ServiceList",
"required": [
"apiVersion",
"annotations",
"kind",
"uid",
"selfLink",
"namespace",
"id",
"creationTimestamp",
"resourceVersion",
"items"
],
"properties": {
"annotations": {
"type": "v1beta1.TypeMeta.annotations"
},
"apiVersion": {
"type": "string"
},
"creationTimestamp": {
"type": "string"
},
"id": {
"type": "string"
},
"items": {
"type": "array",
"items": {
"$ref": "v1beta1.Service"
}
},
"kind": {
"type": "string"
},
"namespace": {
"type": "string"
},
"resourceVersion": {
"type": "uint64"
},
"selfLink": {
"type": "string"
},
"uid": {
"type": "string"
}
}
},
"v1beta1.TCPSocketAction": {
"id": "v1beta1.TCPSocketAction",
"properties": {
"port": {
"type": "string"
}
}
},
"v1beta1.Volume": {
"id": "v1beta1.Volume",
"required": [
"name",
"source"
],
"properties": {
"name": {
"type": "string"
},
"source": {
"type": "v1beta1.VolumeSource"
}
}
},
"v1beta1.VolumeMount": {
"id": "v1beta1.VolumeMount",
"required": [
"name"
],
"properties": {
"mountPath": {
"type": "string"
},
"mountType": {
"type": "string"
},
"name": {
"type": "string"
},
"path": {
"type": "string"
},
"readOnly": {
"type": "boolean"
}
}
},
"v1beta1.VolumeSource": {
"id": "v1beta1.VolumeSource",
"required": [
"hostDir",
"emptyDir",
"persistentDisk",
"gitRepo",
"iscsi"
],
"properties": {
"emptyDir": {
"type": "v1beta1.EmptyDir"
},
"gitRepo": {
"type": "v1beta1.GitRepo"
},
"hostDir": {
"type": "v1beta1.HostDir"
},
"persistentDisk": {
"type": "v1beta1.GCEPersistentDisk"
},
"iscsi": {
"type": "v1beta1.ISCSI"
}
}
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment