Merge pull request #31886 from deads2k/move-storage-class

Automatic merge from submit-queue

Move StorageClass to a storage group

We discussed the pros and cons in sig-api-machinery yesterday.  Choosing a particular group name means that clients (including our internal code) require less work and re-swizzling to handle promotions between versions.  Even if you choose a group you end up not liking, the amount of work remains the same as the incubator work case: you move the affected kind, resource, and storage.

This moves the `StorageClass` type to the `storage.k8s.io` group (named for consistency with authentication, authorization, rbac, and imagepolicy).  There are two commits, one for manaul changes and one for generated code.
pull/6/head
Kubernetes Submit Queue 2016-09-06 23:22:02 -07:00 committed by GitHub
commit 54db8fa2e3
100 changed files with 8982 additions and 8751 deletions

View File

@ -7028,561 +7028,6 @@
}
]
},
{
"path": "/apis/extensions/v1beta1/storageclasses",
"description": "API at /apis/extensions/v1beta1",
"operations": [
{
"type": "v1beta1.StorageClassList",
"method": "GET",
"summary": "list or watch objects of kind StorageClass",
"nickname": "listStorageClass",
"parameters": [
{
"type": "string",
"paramType": "query",
"name": "pretty",
"description": "If 'true', then the output is pretty printed.",
"required": false,
"allowMultiple": false
},
{
"type": "string",
"paramType": "query",
"name": "labelSelector",
"description": "A selector to restrict the list of returned objects by their labels. Defaults to everything.",
"required": false,
"allowMultiple": false
},
{
"type": "string",
"paramType": "query",
"name": "fieldSelector",
"description": "A selector to restrict the list of returned objects by their fields. Defaults to everything.",
"required": false,
"allowMultiple": false
},
{
"type": "boolean",
"paramType": "query",
"name": "watch",
"description": "Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.",
"required": false,
"allowMultiple": false
},
{
"type": "string",
"paramType": "query",
"name": "resourceVersion",
"description": "When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history.",
"required": false,
"allowMultiple": false
},
{
"type": "integer",
"paramType": "query",
"name": "timeoutSeconds",
"description": "Timeout for the list/watch call.",
"required": false,
"allowMultiple": false
}
],
"responseMessages": [
{
"code": 200,
"message": "OK",
"responseModel": "v1beta1.StorageClassList"
}
],
"produces": [
"application/json",
"application/yaml",
"application/vnd.kubernetes.protobuf"
],
"consumes": [
"*/*"
]
},
{
"type": "v1beta1.StorageClass",
"method": "POST",
"summary": "create a StorageClass",
"nickname": "createStorageClass",
"parameters": [
{
"type": "string",
"paramType": "query",
"name": "pretty",
"description": "If 'true', then the output is pretty printed.",
"required": false,
"allowMultiple": false
},
{
"type": "v1beta1.StorageClass",
"paramType": "body",
"name": "body",
"description": "",
"required": true,
"allowMultiple": false
}
],
"responseMessages": [
{
"code": 200,
"message": "OK",
"responseModel": "v1beta1.StorageClass"
}
],
"produces": [
"application/json",
"application/yaml",
"application/vnd.kubernetes.protobuf"
],
"consumes": [
"*/*"
]
},
{
"type": "unversioned.Status",
"method": "DELETE",
"summary": "delete collection of StorageClass",
"nickname": "deletecollectionStorageClass",
"parameters": [
{
"type": "string",
"paramType": "query",
"name": "pretty",
"description": "If 'true', then the output is pretty printed.",
"required": false,
"allowMultiple": false
},
{
"type": "string",
"paramType": "query",
"name": "labelSelector",
"description": "A selector to restrict the list of returned objects by their labels. Defaults to everything.",
"required": false,
"allowMultiple": false
},
{
"type": "string",
"paramType": "query",
"name": "fieldSelector",
"description": "A selector to restrict the list of returned objects by their fields. Defaults to everything.",
"required": false,
"allowMultiple": false
},
{
"type": "boolean",
"paramType": "query",
"name": "watch",
"description": "Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.",
"required": false,
"allowMultiple": false
},
{
"type": "string",
"paramType": "query",
"name": "resourceVersion",
"description": "When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history.",
"required": false,
"allowMultiple": false
},
{
"type": "integer",
"paramType": "query",
"name": "timeoutSeconds",
"description": "Timeout for the list/watch call.",
"required": false,
"allowMultiple": false
}
],
"responseMessages": [
{
"code": 200,
"message": "OK",
"responseModel": "unversioned.Status"
}
],
"produces": [
"application/json",
"application/yaml",
"application/vnd.kubernetes.protobuf"
],
"consumes": [
"*/*"
]
}
]
},
{
"path": "/apis/extensions/v1beta1/watch/storageclasses",
"description": "API at /apis/extensions/v1beta1",
"operations": [
{
"type": "*versioned.Event",
"method": "GET",
"summary": "watch individual changes to a list of StorageClass",
"nickname": "watchStorageClassList",
"parameters": [
{
"type": "string",
"paramType": "query",
"name": "pretty",
"description": "If 'true', then the output is pretty printed.",
"required": false,
"allowMultiple": false
},
{
"type": "string",
"paramType": "query",
"name": "labelSelector",
"description": "A selector to restrict the list of returned objects by their labels. Defaults to everything.",
"required": false,
"allowMultiple": false
},
{
"type": "string",
"paramType": "query",
"name": "fieldSelector",
"description": "A selector to restrict the list of returned objects by their fields. Defaults to everything.",
"required": false,
"allowMultiple": false
},
{
"type": "boolean",
"paramType": "query",
"name": "watch",
"description": "Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.",
"required": false,
"allowMultiple": false
},
{
"type": "string",
"paramType": "query",
"name": "resourceVersion",
"description": "When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history.",
"required": false,
"allowMultiple": false
},
{
"type": "integer",
"paramType": "query",
"name": "timeoutSeconds",
"description": "Timeout for the list/watch call.",
"required": false,
"allowMultiple": false
}
],
"responseMessages": [
{
"code": 200,
"message": "OK",
"responseModel": "*versioned.Event"
}
],
"produces": [
"application/json",
"application/json;stream=watch",
"application/vnd.kubernetes.protobuf",
"application/vnd.kubernetes.protobuf;stream=watch"
],
"consumes": [
"*/*"
]
}
]
},
{
"path": "/apis/extensions/v1beta1/storageclasses/{name}",
"description": "API at /apis/extensions/v1beta1",
"operations": [
{
"type": "v1beta1.StorageClass",
"method": "GET",
"summary": "read the specified StorageClass",
"nickname": "readStorageClass",
"parameters": [
{
"type": "string",
"paramType": "query",
"name": "pretty",
"description": "If 'true', then the output is pretty printed.",
"required": false,
"allowMultiple": false
},
{
"type": "boolean",
"paramType": "query",
"name": "export",
"description": "Should this value be exported. Export strips fields that a user can not specify.",
"required": false,
"allowMultiple": false
},
{
"type": "boolean",
"paramType": "query",
"name": "exact",
"description": "Should the export be exact. Exact export maintains cluster-specific fields like 'Namespace'",
"required": false,
"allowMultiple": false
},
{
"type": "string",
"paramType": "path",
"name": "name",
"description": "name of the StorageClass",
"required": true,
"allowMultiple": false
}
],
"responseMessages": [
{
"code": 200,
"message": "OK",
"responseModel": "v1beta1.StorageClass"
}
],
"produces": [
"application/json",
"application/yaml",
"application/vnd.kubernetes.protobuf"
],
"consumes": [
"*/*"
]
},
{
"type": "v1beta1.StorageClass",
"method": "PUT",
"summary": "replace the specified StorageClass",
"nickname": "replaceStorageClass",
"parameters": [
{
"type": "string",
"paramType": "query",
"name": "pretty",
"description": "If 'true', then the output is pretty printed.",
"required": false,
"allowMultiple": false
},
{
"type": "v1beta1.StorageClass",
"paramType": "body",
"name": "body",
"description": "",
"required": true,
"allowMultiple": false
},
{
"type": "string",
"paramType": "path",
"name": "name",
"description": "name of the StorageClass",
"required": true,
"allowMultiple": false
}
],
"responseMessages": [
{
"code": 200,
"message": "OK",
"responseModel": "v1beta1.StorageClass"
}
],
"produces": [
"application/json",
"application/yaml",
"application/vnd.kubernetes.protobuf"
],
"consumes": [
"*/*"
]
},
{
"type": "v1beta1.StorageClass",
"method": "PATCH",
"summary": "partially update the specified StorageClass",
"nickname": "patchStorageClass",
"parameters": [
{
"type": "string",
"paramType": "query",
"name": "pretty",
"description": "If 'true', then the output is pretty printed.",
"required": false,
"allowMultiple": false
},
{
"type": "unversioned.Patch",
"paramType": "body",
"name": "body",
"description": "",
"required": true,
"allowMultiple": false
},
{
"type": "string",
"paramType": "path",
"name": "name",
"description": "name of the StorageClass",
"required": true,
"allowMultiple": false
}
],
"responseMessages": [
{
"code": 200,
"message": "OK",
"responseModel": "v1beta1.StorageClass"
}
],
"produces": [
"application/json",
"application/yaml",
"application/vnd.kubernetes.protobuf"
],
"consumes": [
"application/json-patch+json",
"application/merge-patch+json",
"application/strategic-merge-patch+json"
]
},
{
"type": "unversioned.Status",
"method": "DELETE",
"summary": "delete a StorageClass",
"nickname": "deleteStorageClass",
"parameters": [
{
"type": "string",
"paramType": "query",
"name": "pretty",
"description": "If 'true', then the output is pretty printed.",
"required": false,
"allowMultiple": false
},
{
"type": "v1.DeleteOptions",
"paramType": "body",
"name": "body",
"description": "",
"required": true,
"allowMultiple": false
},
{
"type": "string",
"paramType": "path",
"name": "name",
"description": "name of the StorageClass",
"required": true,
"allowMultiple": false
}
],
"responseMessages": [
{
"code": 200,
"message": "OK",
"responseModel": "unversioned.Status"
}
],
"produces": [
"application/json",
"application/yaml",
"application/vnd.kubernetes.protobuf"
],
"consumes": [
"*/*"
]
}
]
},
{
"path": "/apis/extensions/v1beta1/watch/storageclasses/{name}",
"description": "API at /apis/extensions/v1beta1",
"operations": [
{
"type": "*versioned.Event",
"method": "GET",
"summary": "watch changes to an object of kind StorageClass",
"nickname": "watchStorageClass",
"parameters": [
{
"type": "string",
"paramType": "query",
"name": "pretty",
"description": "If 'true', then the output is pretty printed.",
"required": false,
"allowMultiple": false
},
{
"type": "string",
"paramType": "query",
"name": "labelSelector",
"description": "A selector to restrict the list of returned objects by their labels. Defaults to everything.",
"required": false,
"allowMultiple": false
},
{
"type": "string",
"paramType": "query",
"name": "fieldSelector",
"description": "A selector to restrict the list of returned objects by their fields. Defaults to everything.",
"required": false,
"allowMultiple": false
},
{
"type": "boolean",
"paramType": "query",
"name": "watch",
"description": "Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.",
"required": false,
"allowMultiple": false
},
{
"type": "string",
"paramType": "query",
"name": "resourceVersion",
"description": "When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history.",
"required": false,
"allowMultiple": false
},
{
"type": "integer",
"paramType": "query",
"name": "timeoutSeconds",
"description": "Timeout for the list/watch call.",
"required": false,
"allowMultiple": false
},
{
"type": "string",
"paramType": "path",
"name": "name",
"description": "name of the StorageClass",
"required": true,
"allowMultiple": false
}
],
"responseMessages": [
{
"code": 200,
"message": "OK",
"responseModel": "*versioned.Event"
}
],
"produces": [
"application/json",
"application/json;stream=watch",
"application/vnd.kubernetes.protobuf",
"application/vnd.kubernetes.protobuf;stream=watch"
],
"consumes": [
"*/*"
]
}
]
},
{
"path": "/apis/extensions/v1beta1/thirdpartyresources",
"description": "API at /apis/extensions/v1beta1",
@ -10884,63 +10329,6 @@
}
}
},
"v1beta1.StorageClassList": {
"id": "v1beta1.StorageClassList",
"description": "StorageClassList is a collection of storage classes.",
"required": [
"items"
],
"properties": {
"kind": {
"type": "string",
"description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds"
},
"apiVersion": {
"type": "string",
"description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#resources"
},
"metadata": {
"$ref": "unversioned.ListMeta",
"description": "Standard list metadata More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata"
},
"items": {
"type": "array",
"items": {
"$ref": "v1beta1.StorageClass"
},
"description": "Items is the list of StorageClasses"
}
}
},
"v1beta1.StorageClass": {
"id": "v1beta1.StorageClass",
"description": "StorageClass describes the parameters for a class of storage for which PersistentVolumes can be dynamically provisioned.\n\nStorageClasses are non-namespaced; the name of the storage class according to etcd is in ObjectMeta.Name.",
"required": [
"provisioner"
],
"properties": {
"kind": {
"type": "string",
"description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds"
},
"apiVersion": {
"type": "string",
"description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#resources"
},
"metadata": {
"$ref": "v1.ObjectMeta",
"description": "Standard object's metadata. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata"
},
"provisioner": {
"type": "string",
"description": "Provisioner indicates the type of the provisioner."
},
"parameters": {
"type": "object",
"description": "Parameters holds the parameters for the provisioner that should create volumes of this storage class."
}
}
},
"v1beta1.ThirdPartyResourceList": {
"id": "v1beta1.ThirdPartyResourceList",
"description": "ThirdPartyResourceList is a list of ThirdPartyResources.",

View File

@ -96,6 +96,14 @@
{
"path": "/apis/rbac.authorization.k8s.io",
"description": "get information of a group"
},
{
"path": "/apis/storage.k8s.io/v1beta1",
"description": "API at /apis/storage.k8s.io/v1beta1"
},
{
"path": "/apis/storage.k8s.io",
"description": "get information of a group"
}
],
"apiVersion": "",

View File

@ -0,0 +1 @@

View File

@ -0,0 +1,114 @@
{
"swaggerVersion": "1.2",
"apiVersion": "",
"basePath": "https://10.10.10.10:6443",
"resourcePath": "/apis/storage.k8s.io",
"info": {
"title": "",
"description": ""
},
"apis": [
{
"path": "/apis/storage.k8s.io",
"description": "get information of a group",
"operations": [
{
"type": "unversioned.APIGroup",
"method": "GET",
"summary": "get information of a group",
"nickname": "getAPIGroup",
"parameters": [],
"produces": [
"application/json",
"application/yaml",
"application/vnd.kubernetes.protobuf"
],
"consumes": [
"application/json",
"application/yaml",
"application/vnd.kubernetes.protobuf"
]
}
]
}
],
"models": {
"unversioned.APIGroup": {
"id": "unversioned.APIGroup",
"description": "APIGroup contains the name, the supported versions, and the preferred version of a group.",
"required": [
"name",
"versions",
"serverAddressByClientCIDRs"
],
"properties": {
"kind": {
"type": "string",
"description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds"
},
"apiVersion": {
"type": "string",
"description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#resources"
},
"name": {
"type": "string",
"description": "name is the name of the group."
},
"versions": {
"type": "array",
"items": {
"$ref": "unversioned.GroupVersionForDiscovery"
},
"description": "versions are the versions supported in this group."
},
"preferredVersion": {
"$ref": "unversioned.GroupVersionForDiscovery",
"description": "preferredVersion is the version preferred by the API server, which probably is the storage version."
},
"serverAddressByClientCIDRs": {
"type": "array",
"items": {
"$ref": "unversioned.ServerAddressByClientCIDR"
},
"description": "a map of client CIDR to server address that is serving this group. This is to help clients reach servers in the most network-efficient way possible. Clients can use the appropriate server address as per the CIDR that they match. In case of multiple matches, clients should use the longest matching CIDR. The server returns only those CIDRs that it thinks that the client can match. For example: the master will return an internal IP CIDR only, if the client reaches the server using an internal IP. Server looks at X-Forwarded-For header or X-Real-Ip header or request.RemoteAddr (in that order) to get the client IP."
}
}
},
"unversioned.GroupVersionForDiscovery": {
"id": "unversioned.GroupVersionForDiscovery",
"description": "GroupVersion contains the \"group/version\" and \"version\" string of a version. It is made a struct to keep extensibility.",
"required": [
"groupVersion",
"version"
],
"properties": {
"groupVersion": {
"type": "string",
"description": "groupVersion specifies the API group and version in the form \"group/version\""
},
"version": {
"type": "string",
"description": "version specifies the version in the form of \"version\". This is to save the clients the trouble of splitting the GroupVersion."
}
}
},
"unversioned.ServerAddressByClientCIDR": {
"id": "unversioned.ServerAddressByClientCIDR",
"description": "ServerAddressByClientCIDR helps the client to determine the server address that they should use, depending on the clientCIDR that they match.",
"required": [
"clientCIDR",
"serverAddress"
],
"properties": {
"clientCIDR": {
"type": "string",
"description": "The CIDR with which clients can match their IP to figure out the server address that they should use."
},
"serverAddress": {
"type": "string",
"description": "Address of this server, suitable for a client that matches the above CIDR. This can be a hostname, hostname:port, IP or IP:port."
}
}
}
}
}

View File

@ -0,0 +1,960 @@
{
"swaggerVersion": "1.2",
"apiVersion": "storage.k8s.io/v1beta1",
"basePath": "https://10.10.10.10:6443",
"resourcePath": "/apis/storage.k8s.io/v1beta1",
"info": {
"title": "",
"description": ""
},
"apis": [
{
"path": "/apis/storage.k8s.io/v1beta1/storageclasses",
"description": "API at /apis/storage.k8s.io/v1beta1",
"operations": [
{
"type": "v1beta1.StorageClassList",
"method": "GET",
"summary": "list or watch objects of kind StorageClass",
"nickname": "listStorageClass",
"parameters": [
{
"type": "string",
"paramType": "query",
"name": "pretty",
"description": "If 'true', then the output is pretty printed.",
"required": false,
"allowMultiple": false
},
{
"type": "string",
"paramType": "query",
"name": "labelSelector",
"description": "A selector to restrict the list of returned objects by their labels. Defaults to everything.",
"required": false,
"allowMultiple": false
},
{
"type": "string",
"paramType": "query",
"name": "fieldSelector",
"description": "A selector to restrict the list of returned objects by their fields. Defaults to everything.",
"required": false,
"allowMultiple": false
},
{
"type": "boolean",
"paramType": "query",
"name": "watch",
"description": "Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.",
"required": false,
"allowMultiple": false
},
{
"type": "string",
"paramType": "query",
"name": "resourceVersion",
"description": "When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history.",
"required": false,
"allowMultiple": false
},
{
"type": "integer",
"paramType": "query",
"name": "timeoutSeconds",
"description": "Timeout for the list/watch call.",
"required": false,
"allowMultiple": false
}
],
"responseMessages": [
{
"code": 200,
"message": "OK",
"responseModel": "v1beta1.StorageClassList"
}
],
"produces": [
"application/json",
"application/yaml",
"application/vnd.kubernetes.protobuf"
],
"consumes": [
"*/*"
]
},
{
"type": "v1beta1.StorageClass",
"method": "POST",
"summary": "create a StorageClass",
"nickname": "createStorageClass",
"parameters": [
{
"type": "string",
"paramType": "query",
"name": "pretty",
"description": "If 'true', then the output is pretty printed.",
"required": false,
"allowMultiple": false
},
{
"type": "v1beta1.StorageClass",
"paramType": "body",
"name": "body",
"description": "",
"required": true,
"allowMultiple": false
}
],
"responseMessages": [
{
"code": 200,
"message": "OK",
"responseModel": "v1beta1.StorageClass"
}
],
"produces": [
"application/json",
"application/yaml",
"application/vnd.kubernetes.protobuf"
],
"consumes": [
"*/*"
]
},
{
"type": "unversioned.Status",
"method": "DELETE",
"summary": "delete collection of StorageClass",
"nickname": "deletecollectionStorageClass",
"parameters": [
{
"type": "string",
"paramType": "query",
"name": "pretty",
"description": "If 'true', then the output is pretty printed.",
"required": false,
"allowMultiple": false
},
{
"type": "string",
"paramType": "query",
"name": "labelSelector",
"description": "A selector to restrict the list of returned objects by their labels. Defaults to everything.",
"required": false,
"allowMultiple": false
},
{
"type": "string",
"paramType": "query",
"name": "fieldSelector",
"description": "A selector to restrict the list of returned objects by their fields. Defaults to everything.",
"required": false,
"allowMultiple": false
},
{
"type": "boolean",
"paramType": "query",
"name": "watch",
"description": "Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.",
"required": false,
"allowMultiple": false
},
{
"type": "string",
"paramType": "query",
"name": "resourceVersion",
"description": "When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history.",
"required": false,
"allowMultiple": false
},
{
"type": "integer",
"paramType": "query",
"name": "timeoutSeconds",
"description": "Timeout for the list/watch call.",
"required": false,
"allowMultiple": false
}
],
"responseMessages": [
{
"code": 200,
"message": "OK",
"responseModel": "unversioned.Status"
}
],
"produces": [
"application/json",
"application/yaml",
"application/vnd.kubernetes.protobuf"
],
"consumes": [
"*/*"
]
}
]
},
{
"path": "/apis/storage.k8s.io/v1beta1/watch/storageclasses",
"description": "API at /apis/storage.k8s.io/v1beta1",
"operations": [
{
"type": "*versioned.Event",
"method": "GET",
"summary": "watch individual changes to a list of StorageClass",
"nickname": "watchStorageClassList",
"parameters": [
{
"type": "string",
"paramType": "query",
"name": "pretty",
"description": "If 'true', then the output is pretty printed.",
"required": false,
"allowMultiple": false
},
{
"type": "string",
"paramType": "query",
"name": "labelSelector",
"description": "A selector to restrict the list of returned objects by their labels. Defaults to everything.",
"required": false,
"allowMultiple": false
},
{
"type": "string",
"paramType": "query",
"name": "fieldSelector",
"description": "A selector to restrict the list of returned objects by their fields. Defaults to everything.",
"required": false,
"allowMultiple": false
},
{
"type": "boolean",
"paramType": "query",
"name": "watch",
"description": "Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.",
"required": false,
"allowMultiple": false
},
{
"type": "string",
"paramType": "query",
"name": "resourceVersion",
"description": "When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history.",
"required": false,
"allowMultiple": false
},
{
"type": "integer",
"paramType": "query",
"name": "timeoutSeconds",
"description": "Timeout for the list/watch call.",
"required": false,
"allowMultiple": false
}
],
"responseMessages": [
{
"code": 200,
"message": "OK",
"responseModel": "*versioned.Event"
}
],
"produces": [
"application/json",
"application/json;stream=watch",
"application/vnd.kubernetes.protobuf",
"application/vnd.kubernetes.protobuf;stream=watch"
],
"consumes": [
"*/*"
]
}
]
},
{
"path": "/apis/storage.k8s.io/v1beta1/storageclasses/{name}",
"description": "API at /apis/storage.k8s.io/v1beta1",
"operations": [
{
"type": "v1beta1.StorageClass",
"method": "GET",
"summary": "read the specified StorageClass",
"nickname": "readStorageClass",
"parameters": [
{
"type": "string",
"paramType": "query",
"name": "pretty",
"description": "If 'true', then the output is pretty printed.",
"required": false,
"allowMultiple": false
},
{
"type": "boolean",
"paramType": "query",
"name": "export",
"description": "Should this value be exported. Export strips fields that a user can not specify.",
"required": false,
"allowMultiple": false
},
{
"type": "boolean",
"paramType": "query",
"name": "exact",
"description": "Should the export be exact. Exact export maintains cluster-specific fields like 'Namespace'",
"required": false,
"allowMultiple": false
},
{
"type": "string",
"paramType": "path",
"name": "name",
"description": "name of the StorageClass",
"required": true,
"allowMultiple": false
}
],
"responseMessages": [
{
"code": 200,
"message": "OK",
"responseModel": "v1beta1.StorageClass"
}
],
"produces": [
"application/json",
"application/yaml",
"application/vnd.kubernetes.protobuf"
],
"consumes": [
"*/*"
]
},
{
"type": "v1beta1.StorageClass",
"method": "PUT",
"summary": "replace the specified StorageClass",
"nickname": "replaceStorageClass",
"parameters": [
{
"type": "string",
"paramType": "query",
"name": "pretty",
"description": "If 'true', then the output is pretty printed.",
"required": false,
"allowMultiple": false
},
{
"type": "v1beta1.StorageClass",
"paramType": "body",
"name": "body",
"description": "",
"required": true,
"allowMultiple": false
},
{
"type": "string",
"paramType": "path",
"name": "name",
"description": "name of the StorageClass",
"required": true,
"allowMultiple": false
}
],
"responseMessages": [
{
"code": 200,
"message": "OK",
"responseModel": "v1beta1.StorageClass"
}
],
"produces": [
"application/json",
"application/yaml",
"application/vnd.kubernetes.protobuf"
],
"consumes": [
"*/*"
]
},
{
"type": "v1beta1.StorageClass",
"method": "PATCH",
"summary": "partially update the specified StorageClass",
"nickname": "patchStorageClass",
"parameters": [
{
"type": "string",
"paramType": "query",
"name": "pretty",
"description": "If 'true', then the output is pretty printed.",
"required": false,
"allowMultiple": false
},
{
"type": "unversioned.Patch",
"paramType": "body",
"name": "body",
"description": "",
"required": true,
"allowMultiple": false
},
{
"type": "string",
"paramType": "path",
"name": "name",
"description": "name of the StorageClass",
"required": true,
"allowMultiple": false
}
],
"responseMessages": [
{
"code": 200,
"message": "OK",
"responseModel": "v1beta1.StorageClass"
}
],
"produces": [
"application/json",
"application/yaml",
"application/vnd.kubernetes.protobuf"
],
"consumes": [
"application/json-patch+json",
"application/merge-patch+json",
"application/strategic-merge-patch+json"
]
},
{
"type": "unversioned.Status",
"method": "DELETE",
"summary": "delete a StorageClass",
"nickname": "deleteStorageClass",
"parameters": [
{
"type": "string",
"paramType": "query",
"name": "pretty",
"description": "If 'true', then the output is pretty printed.",
"required": false,
"allowMultiple": false
},
{
"type": "v1.DeleteOptions",
"paramType": "body",
"name": "body",
"description": "",
"required": true,
"allowMultiple": false
},
{
"type": "string",
"paramType": "path",
"name": "name",
"description": "name of the StorageClass",
"required": true,
"allowMultiple": false
}
],
"responseMessages": [
{
"code": 200,
"message": "OK",
"responseModel": "unversioned.Status"
}
],
"produces": [
"application/json",
"application/yaml",
"application/vnd.kubernetes.protobuf"
],
"consumes": [
"*/*"
]
}
]
},
{
"path": "/apis/storage.k8s.io/v1beta1/watch/storageclasses/{name}",
"description": "API at /apis/storage.k8s.io/v1beta1",
"operations": [
{
"type": "*versioned.Event",
"method": "GET",
"summary": "watch changes to an object of kind StorageClass",
"nickname": "watchStorageClass",
"parameters": [
{
"type": "string",
"paramType": "query",
"name": "pretty",
"description": "If 'true', then the output is pretty printed.",
"required": false,
"allowMultiple": false
},
{
"type": "string",
"paramType": "query",
"name": "labelSelector",
"description": "A selector to restrict the list of returned objects by their labels. Defaults to everything.",
"required": false,
"allowMultiple": false
},
{
"type": "string",
"paramType": "query",
"name": "fieldSelector",
"description": "A selector to restrict the list of returned objects by their fields. Defaults to everything.",
"required": false,
"allowMultiple": false
},
{
"type": "boolean",
"paramType": "query",
"name": "watch",
"description": "Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.",
"required": false,
"allowMultiple": false
},
{
"type": "string",
"paramType": "query",
"name": "resourceVersion",
"description": "When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history.",
"required": false,
"allowMultiple": false
},
{
"type": "integer",
"paramType": "query",
"name": "timeoutSeconds",
"description": "Timeout for the list/watch call.",
"required": false,
"allowMultiple": false
},
{
"type": "string",
"paramType": "path",
"name": "name",
"description": "name of the StorageClass",
"required": true,
"allowMultiple": false
}
],
"responseMessages": [
{
"code": 200,
"message": "OK",
"responseModel": "*versioned.Event"
}
],
"produces": [
"application/json",
"application/json;stream=watch",
"application/vnd.kubernetes.protobuf",
"application/vnd.kubernetes.protobuf;stream=watch"
],
"consumes": [
"*/*"
]
}
]
},
{
"path": "/apis/storage.k8s.io/v1beta1",
"description": "API at /apis/storage.k8s.io/v1beta1",
"operations": [
{
"type": "unversioned.APIResourceList",
"method": "GET",
"summary": "get available resources",
"nickname": "getAPIResources",
"parameters": [],
"produces": [
"application/json",
"application/yaml",
"application/vnd.kubernetes.protobuf"
],
"consumes": [
"application/json",
"application/yaml",
"application/vnd.kubernetes.protobuf"
]
}
]
}
],
"models": {
"v1beta1.StorageClassList": {
"id": "v1beta1.StorageClassList",
"description": "StorageClassList is a collection of storage classes.",
"required": [
"items"
],
"properties": {
"kind": {
"type": "string",
"description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds"
},
"apiVersion": {
"type": "string",
"description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#resources"
},
"metadata": {
"$ref": "unversioned.ListMeta",
"description": "Standard list metadata More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata"
},
"items": {
"type": "array",
"items": {
"$ref": "v1beta1.StorageClass"
},
"description": "Items is the list of StorageClasses"
}
}
},
"unversioned.ListMeta": {
"id": "unversioned.ListMeta",
"description": "ListMeta describes metadata that synthetic resources must have, including lists and various status objects. A resource may have only one of {ObjectMeta, ListMeta}.",
"properties": {
"selfLink": {
"type": "string",
"description": "SelfLink is a URL representing this object. Populated by the system. Read-only."
},
"resourceVersion": {
"type": "string",
"description": "String that identifies the server's internal version of this object that can be used by clients to determine when objects have changed. Value must be treated as opaque by clients and passed unmodified back to the server. Populated by the system. Read-only. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#concurrency-control-and-consistency"
}
}
},
"v1beta1.StorageClass": {
"id": "v1beta1.StorageClass",
"description": "StorageClass describes the parameters for a class of storage for which PersistentVolumes can be dynamically provisioned.\n\nStorageClasses are non-namespaced; the name of the storage class according to etcd is in ObjectMeta.Name.",
"required": [
"provisioner"
],
"properties": {
"kind": {
"type": "string",
"description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds"
},
"apiVersion": {
"type": "string",
"description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#resources"
},
"metadata": {
"$ref": "v1.ObjectMeta",
"description": "Standard object's metadata. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata"
},
"provisioner": {
"type": "string",
"description": "Provisioner indicates the type of the provisioner."
},
"parameters": {
"type": "object",
"description": "Parameters holds the parameters for the provisioner that should create volumes of this storage class."
}
}
},
"v1.ObjectMeta": {
"id": "v1.ObjectMeta",
"description": "ObjectMeta is metadata that all persisted resources must have, which includes all objects users must create.",
"properties": {
"name": {
"type": "string",
"description": "Name must be unique within a namespace. Is required when creating resources, although some resources may allow a client to request the generation of an appropriate name automatically. Name is primarily intended for creation idempotence and configuration definition. Cannot be updated. More info: http://releases.k8s.io/HEAD/docs/user-guide/identifiers.md#names"
},
"generateName": {
"type": "string",
"description": "GenerateName is an optional prefix, used by the server, to generate a unique name ONLY IF the Name field has not been provided. If this field is used, the name returned to the client will be different than the name passed. This value will also be combined with a unique suffix. The provided value has the same validation rules as the Name field, and may be truncated by the length of the suffix required to make the value unique on the server.\n\nIf this field is specified and the generated name exists, the server will NOT return a 409 - instead, it will either return 201 Created or 500 with Reason ServerTimeout indicating a unique name could not be found in the time allotted, and the client should retry (optionally after the time indicated in the Retry-After header).\n\nApplied only if Name is not specified. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#idempotency"
},
"namespace": {
"type": "string",
"description": "Namespace defines the space within each name must be unique. An empty namespace is equivalent to the \"default\" namespace, but \"default\" is the canonical representation. Not all objects are required to be scoped to a namespace - the value of this field for those objects will be empty.\n\nMust be a DNS_LABEL. Cannot be updated. More info: http://releases.k8s.io/HEAD/docs/user-guide/namespaces.md"
},
"selfLink": {
"type": "string",
"description": "SelfLink is a URL representing this object. Populated by the system. Read-only."
},
"uid": {
"type": "string",
"description": "UID is the unique in time and space value for this object. It is typically generated by the server on successful creation of a resource and is not allowed to change on PUT operations.\n\nPopulated by the system. Read-only. More info: http://releases.k8s.io/HEAD/docs/user-guide/identifiers.md#uids"
},
"resourceVersion": {
"type": "string",
"description": "An opaque value that represents the internal version of this object that can be used by clients to determine when objects have changed. May be used for optimistic concurrency, change detection, and the watch operation on a resource or set of resources. Clients must treat these values as opaque and passed unmodified back to the server. They may only be valid for a particular resource or set of resources.\n\nPopulated by the system. Read-only. Value must be treated as opaque by clients and . More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#concurrency-control-and-consistency"
},
"generation": {
"type": "integer",
"format": "int64",
"description": "A sequence number representing a specific generation of the desired state. Populated by the system. Read-only."
},
"creationTimestamp": {
"type": "string",
"format": "date-time",
"description": "CreationTimestamp is a timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC.\n\nPopulated by the system. Read-only. Null for lists. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata"
},
"deletionTimestamp": {
"type": "string",
"format": "date-time",
"description": "DeletionTimestamp is RFC 3339 date and time at which this resource will be deleted. This field is set by the server when a graceful deletion is requested by the user, and is not directly settable by a client. The resource will be deleted (no longer visible from resource lists, and not reachable by name) after the time in this field. Once set, this value may not be unset or be set further into the future, although it may be shortened or the resource may be deleted prior to this time. For example, a user may request that a pod is deleted in 30 seconds. The Kubelet will react by sending a graceful termination signal to the containers in the pod. Once the resource is deleted in the API, the Kubelet will send a hard termination signal to the container. If not set, graceful deletion of the object has not been requested.\n\nPopulated by the system when a graceful deletion is requested. Read-only. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata"
},
"deletionGracePeriodSeconds": {
"type": "integer",
"format": "int64",
"description": "Number of seconds allowed for this object to gracefully terminate before it will be removed from the system. Only set when deletionTimestamp is also set. May only be shortened. Read-only."
},
"labels": {
"type": "object",
"description": "Map of string keys and values that can be used to organize and categorize (scope and select) objects. May match selectors of replication controllers and services. More info: http://releases.k8s.io/HEAD/docs/user-guide/labels.md"
},
"annotations": {
"type": "object",
"description": "Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects. More info: http://releases.k8s.io/HEAD/docs/user-guide/annotations.md"
},
"ownerReferences": {
"type": "array",
"items": {
"$ref": "v1.OwnerReference"
},
"description": "List of objects depended by this object. If ALL objects in the list have been deleted, this object will be garbage collected. If this object is managed by a controller, then an entry in this list will point to this controller, with the controller field set to true. There cannot be more than one managing controller."
},
"finalizers": {
"type": "array",
"items": {
"type": "string"
},
"description": "Must be empty before the object is deleted from the registry. Each entry is an identifier for the responsible component that will remove the entry from the list. If the deletionTimestamp of the object is non-nil, entries in this list can only be removed."
},
"clusterName": {
"type": "string",
"description": "The name of the cluster which the object belongs to. This is used to distinguish resources with same name and namespace in different clusters. This field is not set anywhere right now and apiserver is going to ignore it if set in create or update request."
}
}
},
"v1.OwnerReference": {
"id": "v1.OwnerReference",
"description": "OwnerReference contains enough information to let you identify an owning object. Currently, an owning object must be in the same namespace, so there is no namespace field.",
"required": [
"apiVersion",
"kind",
"name",
"uid"
],
"properties": {
"apiVersion": {
"type": "string",
"description": "API version of the referent."
},
"kind": {
"type": "string",
"description": "Kind of the referent. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds"
},
"name": {
"type": "string",
"description": "Name of the referent. More info: http://releases.k8s.io/HEAD/docs/user-guide/identifiers.md#names"
},
"uid": {
"type": "string",
"description": "UID of the referent. More info: http://releases.k8s.io/HEAD/docs/user-guide/identifiers.md#uids"
},
"controller": {
"type": "boolean",
"description": "If true, this reference points to the managing controller."
}
}
},
"unversioned.Status": {
"id": "unversioned.Status",
"description": "Status is a return value for calls that don't return other objects.",
"properties": {
"kind": {
"type": "string",
"description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds"
},
"apiVersion": {
"type": "string",
"description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#resources"
},
"metadata": {
"$ref": "unversioned.ListMeta",
"description": "Standard list metadata. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds"
},
"status": {
"type": "string",
"description": "Status of the operation. One of: \"Success\" or \"Failure\". More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status"
},
"message": {
"type": "string",
"description": "A human-readable description of the status of this operation."
},
"reason": {
"type": "string",
"description": "A machine-readable description of why this operation is in the \"Failure\" status. If this value is empty there is no information available. A Reason clarifies an HTTP status code but does not override it."
},
"details": {
"$ref": "unversioned.StatusDetails",
"description": "Extended data associated with the reason. Each reason may define its own extended details. This field is optional and the data returned is not guaranteed to conform to any schema except that defined by the reason type."
},
"code": {
"type": "integer",
"format": "int32",
"description": "Suggested HTTP return code for this status, 0 if not set."
}
}
},
"unversioned.StatusDetails": {
"id": "unversioned.StatusDetails",
"description": "StatusDetails is a set of additional properties that MAY be set by the server to provide additional information about a response. The Reason field of a Status object defines what attributes will be set. Clients must ignore fields that do not match the defined type of each attribute, and should assume that any attribute may be empty, invalid, or under defined.",
"properties": {
"name": {
"type": "string",
"description": "The name attribute of the resource associated with the status StatusReason (when there is a single name which can be described)."
},
"group": {
"type": "string",
"description": "The group attribute of the resource associated with the status StatusReason."
},
"kind": {
"type": "string",
"description": "The kind attribute of the resource associated with the status StatusReason. On some operations may differ from the requested resource Kind. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds"
},
"causes": {
"type": "array",
"items": {
"$ref": "unversioned.StatusCause"
},
"description": "The Causes array includes more details associated with the StatusReason failure. Not all StatusReasons may provide detailed causes."
},
"retryAfterSeconds": {
"type": "integer",
"format": "int32",
"description": "If specified, the time in seconds before the operation should be retried."
}
}
},
"unversioned.StatusCause": {
"id": "unversioned.StatusCause",
"description": "StatusCause provides more information about an api.Status failure, including cases when multiple errors are encountered.",
"properties": {
"reason": {
"type": "string",
"description": "A machine-readable description of the cause of the error. If this value is empty there is no information available."
},
"message": {
"type": "string",
"description": "A human-readable description of the cause of the error. This field may be presented as-is to a reader."
},
"field": {
"type": "string",
"description": "The field of the resource that has caused this error, as named by its JSON serialization. May include dot and postfix notation for nested attributes. Arrays are zero-indexed. Fields may appear more than once in an array of causes due to fields having multiple errors. Optional.\n\nExamples:\n \"name\" - the field \"name\" on the current resource\n \"items[0].name\" - the field \"name\" on the first array entry in \"items\""
}
}
},
"*versioned.Event": {
"id": "*versioned.Event",
"properties": {}
},
"unversioned.Patch": {
"id": "unversioned.Patch",
"description": "Patch is provided to give a concrete name and type to the Kubernetes PATCH request body.",
"properties": {}
},
"v1.DeleteOptions": {
"id": "v1.DeleteOptions",
"description": "DeleteOptions may be provided when deleting an API object",
"properties": {
"kind": {
"type": "string",
"description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds"
},
"apiVersion": {
"type": "string",
"description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#resources"
},
"gracePeriodSeconds": {
"type": "integer",
"format": "int64",
"description": "The duration in seconds before the object should be deleted. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately."
},
"preconditions": {
"$ref": "v1.Preconditions",
"description": "Must be fulfilled before a deletion is carried out. If not possible, a 409 Conflict status will be returned."
},
"orphanDependents": {
"type": "boolean",
"description": "Should the dependent objects be orphaned. If true/false, the \"orphan\" finalizer will be added to/removed from the object's finalizers list."
}
}
},
"v1.Preconditions": {
"id": "v1.Preconditions",
"description": "Preconditions must be fulfilled before an operation (update, delete, etc.) is carried out.",
"properties": {
"uid": {
"$ref": "types.UID",
"description": "Specifies the target UID."
}
}
},
"types.UID": {
"id": "types.UID",
"properties": {}
},
"unversioned.APIResourceList": {
"id": "unversioned.APIResourceList",
"description": "APIResourceList is a list of APIResource, it is used to expose the name of the resources supported in a specific group and version, and if the resource is namespaced.",
"required": [
"groupVersion",
"resources"
],
"properties": {
"kind": {
"type": "string",
"description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds"
},
"apiVersion": {
"type": "string",
"description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#resources"
},
"groupVersion": {
"type": "string",
"description": "groupVersion is the group and version this APIResourceList is for."
},
"resources": {
"type": "array",
"items": {
"$ref": "unversioned.APIResource"
},
"description": "resources contains the name of the resources and if they are namespaced."
}
}
},
"unversioned.APIResource": {
"id": "unversioned.APIResource",
"description": "APIResource specifies the name of a resource and whether it is namespaced.",
"required": [
"name",
"namespaced",
"kind"
],
"properties": {
"name": {
"type": "string",
"description": "name is the name of the resource."
},
"namespaced": {
"type": "boolean",
"description": "namespaced indicates if a resource is namespaced or not."
},
"kind": {
"type": "string",
"description": "kind is the kind for the resource (e.g. 'Foo' is the kind for a resource 'foo')"
}
}
}
}
}

View File

@ -42,6 +42,7 @@ var (
"certificates/",
"extensions/",
"rbac/",
"storage/",
}, "group/versions that client-gen will generate clients for. At most one version per group is allowed. Specified in the format \"group1/version1,group2/version2...\". Default to \"api/,extensions/,autoscaling/,batch/,rbac/\"")
includedTypesOverrides = flag.StringSlice("included-types-overrides", []string{}, "list of group/version/type for which client should be generated. By default, client is generated for all types which have genclient=true in types.go. This overrides that. For each groupVersion in this list, only the types mentioned here will be included. The default check of genclient=true will be used for other group versions.")
basePath = flag.String("input-base", "k8s.io/kubernetes/pkg/apis", "base path to look for the api group. Default to \"k8s.io/kubernetes/pkg/apis\"")

View File

@ -78,6 +78,7 @@ func New() *Generator {
`k8s.io/kubernetes/federation/apis/federation/v1beta1`,
`k8s.io/kubernetes/pkg/apis/certificates/v1alpha1`,
`k8s.io/kubernetes/pkg/apis/imagepolicy/v1alpha1`,
`k8s.io/kubernetes/pkg/apis/storage/v1beta1`,
}, ","),
DropEmbeddedFields: "k8s.io/kubernetes/pkg/api/unversioned.TypeMeta",
}

View File

@ -423,12 +423,6 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
<li>
<p><a href="#_v1beta1_networkpolicylist">v1beta1.NetworkPolicyList</a></p>
</li>
<li>
<p><a href="#_v1beta1_storageclass">v1beta1.StorageClass</a></p>
</li>
<li>
<p><a href="#_v1beta1_storageclasslist">v1beta1.StorageClassList</a></p>
</li>
</ul>
</div>
</div>
@ -1567,71 +1561,6 @@ Examples:<br>
</tbody>
</table>
</div>
<div class="sect2">
<h3 id="_v1beta1_storageclass">v1beta1.StorageClass</h3>
<div class="paragraph">
<p>StorageClass describes the parameters for a class of storage for which PersistentVolumes can be dynamically provisioned.</p>
</div>
<div class="paragraph">
<p>StorageClasses are non-namespaced; the name of the storage class according to etcd is in ObjectMeta.Name.</p>
</div>
<table class="tableblock frame-all grid-all" style="width:100%; ">
<colgroup>
<col style="width:20%;">
<col style="width:20%;">
<col style="width:20%;">
<col style="width:20%;">
<col style="width:20%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">Name</th>
<th class="tableblock halign-left valign-top">Description</th>
<th class="tableblock halign-left valign-top">Required</th>
<th class="tableblock halign-left valign-top">Schema</th>
<th class="tableblock halign-left valign-top">Default</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">kind</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: <a href="http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds">http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds</a></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">apiVersion</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: <a href="http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#resources">http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#resources</a></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">metadata</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Standard object&#8217;s metadata. More info: <a href="http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata">http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata</a></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_v1_objectmeta">v1.ObjectMeta</a></p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">provisioner</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Provisioner indicates the type of the provisioner.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">parameters</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Parameters holds the parameters for the provisioner that should create volumes of this storage class.</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">object</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
</tbody>
</table>
</div>
<div class="sect2">
<h3 id="_v1_execaction">v1.ExecAction</h3>
@ -2213,61 +2142,6 @@ Populated by the system when a graceful deletion is requested. Read-only. More i
<div class="paragraph">
<p>Patch is provided to give a concrete name and type to the Kubernetes PATCH request body.</p>
</div>
</div>
<div class="sect2">
<h3 id="_v1beta1_storageclasslist">v1beta1.StorageClassList</h3>
<div class="paragraph">
<p>StorageClassList is a collection of storage classes.</p>
</div>
<table class="tableblock frame-all grid-all" style="width:100%; ">
<colgroup>
<col style="width:20%;">
<col style="width:20%;">
<col style="width:20%;">
<col style="width:20%;">
<col style="width:20%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">Name</th>
<th class="tableblock halign-left valign-top">Description</th>
<th class="tableblock halign-left valign-top">Required</th>
<th class="tableblock halign-left valign-top">Schema</th>
<th class="tableblock halign-left valign-top">Default</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">kind</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: <a href="http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds">http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds</a></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">apiVersion</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: <a href="http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#resources">http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#resources</a></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">metadata</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Standard list metadata More info: <a href="http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata">http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata</a></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">false</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_unversioned_listmeta">unversioned.ListMeta</a></p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">items</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Items is the list of StorageClasses</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="#_v1beta1_storageclass">v1beta1.StorageClass</a> array</p></td>
<td class="tableblock halign-left valign-top"></td>
</tr>
</tbody>
</table>
</div>
<div class="sect2">
<h3 id="_v1_flockervolumesource">v1.FlockerVolumeSource</h3>
@ -6682,7 +6556,7 @@ Both these may change in the future. Incoming requests are matched against the h
</div>
<div id="footer">
<div id="footer-text">
Last updated 2016-08-23 16:31:23 UTC
Last updated 2016-09-01 17:31:18 UTC
</div>
</div>
</body>

File diff suppressed because it is too large Load Diff

View File

@ -72,6 +72,8 @@ pkg/apis/extensions/v1beta1
pkg/apis/imagepolicy/install
pkg/apis/policy/install
pkg/apis/rbac/install
pkg/apis/storage/install
pkg/apis/storage/validation
pkg/apiserver/audit
pkg/auth/authenticator
pkg/auth/authorizer/union

View File

@ -2388,7 +2388,7 @@ __EOF__
kubectl create -f - "${kube_flags[@]}" << __EOF__
{
"kind": "StorageClass",
"apiVersion": "extensions/v1beta1",
"apiVersion": "storage.k8s.io/v1beta1",
"metadata": {
"name": "storage-class-name"
},

View File

@ -27,7 +27,7 @@ source "${KUBE_ROOT}/hack/lib/init.sh"
# KUBE_TEST_API_VERSIONS=${KUBE_TEST_API_VERSIONS:-"v1,extensions/v1beta1"}
# FIXME: due to current implementation of a test client (see: pkg/api/testapi/testapi.go)
# ONLY the last version is tested in each group.
KUBE_TEST_API_VERSIONS=${KUBE_TEST_API_VERSIONS:-"v1,authorization.k8s.io/v1beta1,autoscaling/v1,batch/v1,apps/v1alpha1,policy/v1alpha1,extensions/v1beta1,rbac.authorization.k8s.io/v1alpha1,certificates.k8s.io/v1alpha1"}
KUBE_TEST_API_VERSIONS=${KUBE_TEST_API_VERSIONS:-"v1,authorization.k8s.io/v1beta1,autoscaling/v1,batch/v1,apps/v1alpha1,policy/v1alpha1,extensions/v1beta1,rbac.authorization.k8s.io/v1alpha1,certificates.k8s.io/v1alpha1,storage.k8s.io/v1beta1"}
# Give integration tests longer to run
# TODO: allow a larger value to be passed in

View File

@ -66,7 +66,7 @@ KUBE_GOVERALLS_BIN=${KUBE_GOVERALLS_BIN:-}
# "v1,compute/v1alpha1,experimental/v1alpha2;v1,compute/v2,experimental/v1alpha3"
# FIXME: due to current implementation of a test client (see: pkg/api/testapi/testapi.go)
# ONLY the last version is tested in each group.
KUBE_TEST_API_VERSIONS=${KUBE_TEST_API_VERSIONS:-"v1,apps/v1alpha1,authentication.k8s.io/v1beta1,authorization.k8s.io/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates.k8s.io/v1alpha1,extensions/v1beta1,federation/v1beta1,policy/v1alpha1,rbac.authorization.k8s.io/v1alpha1,imagepolicy.k8s.io/v1alpha1"}
KUBE_TEST_API_VERSIONS=${KUBE_TEST_API_VERSIONS:-"v1,apps/v1alpha1,authentication.k8s.io/v1beta1,authorization.k8s.io/v1beta1,autoscaling/v1,batch/v1,batch/v2alpha1,certificates.k8s.io/v1alpha1,extensions/v1beta1,federation/v1beta1,policy/v1alpha1,rbac.authorization.k8s.io/v1alpha1,imagepolicy.k8s.io/v1alpha1,storage.k8s.io/v1beta1"}
# once we have multiple group supports
# Create a junit-style XML test report in this directory if set.
KUBE_JUNIT_REPORT_DIR=${KUBE_JUNIT_REPORT_DIR:-}

View File

@ -28,7 +28,7 @@ source "${KUBE_ROOT}/hack/lib/swagger.sh"
kube::golang::setup_env
GROUP_VERSIONS=(unversioned v1 authentication/v1beta1 authorization/v1beta1 autoscaling/v1 batch/v1 batch/v2alpha1 extensions/v1beta1 apps/v1alpha1 policy/v1alpha1 rbac/v1alpha1 certificates/v1alpha1)
GROUP_VERSIONS=(unversioned v1 authentication/v1beta1 authorization/v1beta1 autoscaling/v1 batch/v1 batch/v2alpha1 extensions/v1beta1 apps/v1alpha1 policy/v1alpha1 rbac/v1alpha1 storage/v1beta1 certificates/v1alpha1)
# To avoid compile errors, remove the currently existing files.
for group_version in "${GROUP_VERSIONS[@]}"; do
rm -f "pkg/$(kube::util::group-version-to-pkg-path "${group_version}")/types_swagger_doc_generated.go"

View File

@ -73,7 +73,7 @@ APISERVER_PID=$!
kube::util::wait_for_url "${API_HOST}:${API_PORT}/healthz" "apiserver: "
SWAGGER_API_PATH="${API_HOST}:${API_PORT}/swaggerapi/"
DEFAULT_GROUP_VERSIONS="v1 apps/v1alpha1 authentication.k8s.io/v1beta1 authorization.k8s.io/v1beta1 autoscaling/v1 batch/v1 batch/v2alpha1 extensions/v1beta1 certificates.k8s.io/v1alpha1 policy/v1alpha1 rbac.authorization.k8s.io/v1alpha1"
DEFAULT_GROUP_VERSIONS="v1 apps/v1alpha1 authentication.k8s.io/v1beta1 authorization.k8s.io/v1beta1 autoscaling/v1 batch/v1 batch/v2alpha1 extensions/v1beta1 certificates.k8s.io/v1alpha1 policy/v1alpha1 rbac.authorization.k8s.io/v1alpha1 storage.k8s.io/v1beta1"
VERSIONS=${VERSIONS:-$DEFAULT_GROUP_VERSIONS}
kube::log::status "Updating " ${SWAGGER_ROOT_DIR}

View File

@ -37,6 +37,7 @@ import (
"k8s.io/kubernetes/pkg/apis/imagepolicy"
"k8s.io/kubernetes/pkg/apis/policy"
"k8s.io/kubernetes/pkg/apis/rbac"
"k8s.io/kubernetes/pkg/apis/storage"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/runtime/serializer/recognizer"
@ -53,6 +54,7 @@ import (
_ "k8s.io/kubernetes/pkg/apis/imagepolicy/install"
_ "k8s.io/kubernetes/pkg/apis/policy/install"
_ "k8s.io/kubernetes/pkg/apis/rbac/install"
_ "k8s.io/kubernetes/pkg/apis/storage/install"
)
var (
@ -66,6 +68,7 @@ var (
Federation TestGroup
Rbac TestGroup
Certificates TestGroup
Storage TestGroup
ImagePolicy TestGroup
serializer runtime.SerializerInfo
@ -218,6 +221,15 @@ func init() {
externalTypes: api.Scheme.KnownTypes(externalGroupVersion),
}
}
if _, ok := Groups[storage.GroupName]; !ok {
externalGroupVersion := unversioned.GroupVersion{Group: storage.GroupName, Version: registered.GroupOrDie(storage.GroupName).GroupVersion.Version}
Groups[storage.GroupName] = TestGroup{
externalGroupVersion: externalGroupVersion,
internalGroupVersion: storage.SchemeGroupVersion,
internalTypes: api.Scheme.KnownTypes(storage.SchemeGroupVersion),
externalTypes: api.Scheme.KnownTypes(externalGroupVersion),
}
}
if _, ok := Groups[certificates.GroupName]; !ok {
externalGroupVersion := unversioned.GroupVersion{Group: certificates.GroupName, Version: registered.GroupOrDie(certificates.GroupName).GroupVersion.Version}
Groups[certificates.GroupName] = TestGroup{
@ -247,6 +259,7 @@ func init() {
Extensions = Groups[extensions.GroupName]
Federation = Groups[federation.GroupName]
Rbac = Groups[rbac.GroupName]
Storage = Groups[storage.GroupName]
ImagePolicy = Groups[imagepolicy.GroupName]
}

View File

@ -76,8 +76,6 @@ func addKnownTypes(scheme *runtime.Scheme) error {
&PodSecurityPolicyList{},
&NetworkPolicy{},
&NetworkPolicyList{},
&StorageClass{},
&StorageClassList{},
)
return nil
}

File diff suppressed because it is too large Load Diff

View File

@ -911,41 +911,3 @@ type NetworkPolicyList struct {
Items []NetworkPolicy `json:"items"`
}
// +genclient=true
// +nonNamespaced=true
// StorageClass describes a named "class" of storage offered in a cluster.
// Different classes might map to quality-of-service levels, or to backup policies,
// or to arbitrary policies determined by the cluster administrators. Kubernetes
// itself is unopinionated about what classes represent. This concept is sometimes
// called "profiles" in other storage systems.
// The name of a StorageClass object is significant, and is how users can request a particular class.
type StorageClass struct {
unversioned.TypeMeta `json:",inline"`
api.ObjectMeta `json:"metadata,omitempty"`
// provisioner is the driver expected to handle this StorageClass.
// This is an optionally-prefixed name, like a label key.
// For example: "kubernetes.io/gce-pd" or "kubernetes.io/aws-ebs".
// This value may not be empty.
Provisioner string `json:"provisioner"`
// parameters holds parameters for the provisioner.
// These values are opaque to the system and are passed directly
// to the provisioner. The only validation done on keys is that they are
// not empty. The maximum number of parameters is
// 512, with a cumulative max size of 256K
Parameters map[string]string `json:"parameters,omitempty"`
}
// StorageClassList is a collection of storage classes.
type StorageClassList struct {
unversioned.TypeMeta `json:",inline"`
// Standard list metadata
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
unversioned.ListMeta `json:"metadata,omitempty"`
// Items is the list of StorageClasses
Items []StorageClass `json:"items"`
}

File diff suppressed because it is too large Load Diff

View File

@ -945,34 +945,6 @@ message ScaleStatus {
optional string targetSelector = 3;
}
// StorageClass describes the parameters for a class of storage for
// which PersistentVolumes can be dynamically provisioned.
//
// StorageClasses are non-namespaced; the name of the storage class
// according to etcd is in ObjectMeta.Name.
message StorageClass {
// Standard object's metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
optional k8s.io.kubernetes.pkg.api.v1.ObjectMeta metadata = 1;
// Provisioner indicates the type of the provisioner.
optional string provisioner = 2;
// Parameters holds the parameters for the provisioner that should
// create volumes of this storage class.
map<string, string> parameters = 3;
}
// StorageClassList is a collection of storage classes.
message StorageClassList {
// Standard list metadata
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
optional k8s.io.kubernetes.pkg.api.unversioned.ListMeta metadata = 1;
// Items is the list of StorageClasses
repeated StorageClass items = 2;
}
// SubresourceReference contains enough information to let you inspect or modify the referred subresource.
message SubresourceReference {
// Kind of the referent; More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds

View File

@ -62,8 +62,6 @@ func addKnownTypes(scheme *runtime.Scheme) error {
&PodSecurityPolicyList{},
&NetworkPolicy{},
&NetworkPolicyList{},
&StorageClass{},
&StorageClassList{},
)
// Add the watch version that applies
versionedwatch.AddToGroupVersion(scheme, SchemeGroupVersion)

File diff suppressed because it is too large Load Diff

View File

@ -1199,36 +1199,3 @@ type NetworkPolicyList struct {
// Items is a list of schema objects.
Items []NetworkPolicy `json:"items" protobuf:"bytes,2,rep,name=items"`
}
// +genclient=true
// +nonNamespaced=true
// StorageClass describes the parameters for a class of storage for
// which PersistentVolumes can be dynamically provisioned.
//
// StorageClasses are non-namespaced; the name of the storage class
// according to etcd is in ObjectMeta.Name.
type StorageClass struct {
unversioned.TypeMeta `json:",inline"`
// Standard object's metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
v1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// Provisioner indicates the type of the provisioner.
Provisioner string `json:"provisioner" protobuf:"bytes,2,opt,name=provisioner"`
// Parameters holds the parameters for the provisioner that should
// create volumes of this storage class.
Parameters map[string]string `json:"parameters,omitempty" protobuf:"bytes,3,rep,name=parameters"`
}
// StorageClassList is a collection of storage classes.
type StorageClassList struct {
unversioned.TypeMeta `json:",inline"`
// Standard list metadata
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
unversioned.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// Items is the list of StorageClasses
Items []StorageClass `json:"items" protobuf:"bytes,2,rep,name=items"`
}

View File

@ -675,27 +675,6 @@ func (ScaleStatus) SwaggerDoc() map[string]string {
return map_ScaleStatus
}
var map_StorageClass = map[string]string{
"": "StorageClass describes the parameters for a class of storage for which PersistentVolumes can be dynamically provisioned.\n\nStorageClasses are non-namespaced; the name of the storage class according to etcd is in ObjectMeta.Name.",
"metadata": "Standard object's metadata. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata",
"provisioner": "Provisioner indicates the type of the provisioner.",
"parameters": "Parameters holds the parameters for the provisioner that should create volumes of this storage class.",
}
func (StorageClass) SwaggerDoc() map[string]string {
return map_StorageClass
}
var map_StorageClassList = map[string]string{
"": "StorageClassList is a collection of storage classes.",
"metadata": "Standard list metadata More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata",
"items": "Items is the list of StorageClasses",
}
func (StorageClassList) SwaggerDoc() map[string]string {
return map_StorageClassList
}
var map_SubresourceReference = map[string]string{
"": "SubresourceReference contains enough information to let you inspect or modify the referred subresource.",
"kind": "Kind of the referent; More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds",

View File

@ -163,10 +163,6 @@ func RegisterConversions(scheme *runtime.Scheme) error {
Convert_extensions_ScaleSpec_To_v1beta1_ScaleSpec,
Convert_v1beta1_ScaleStatus_To_extensions_ScaleStatus,
Convert_extensions_ScaleStatus_To_v1beta1_ScaleStatus,
Convert_v1beta1_StorageClass_To_extensions_StorageClass,
Convert_extensions_StorageClass_To_v1beta1_StorageClass,
Convert_v1beta1_StorageClassList_To_extensions_StorageClassList,
Convert_extensions_StorageClassList_To_v1beta1_StorageClassList,
Convert_v1beta1_SupplementalGroupsStrategyOptions_To_extensions_SupplementalGroupsStrategyOptions,
Convert_extensions_SupplementalGroupsStrategyOptions_To_v1beta1_SupplementalGroupsStrategyOptions,
Convert_v1beta1_ThirdPartyResource_To_extensions_ThirdPartyResource,
@ -2424,90 +2420,6 @@ func Convert_extensions_ScaleSpec_To_v1beta1_ScaleSpec(in *extensions.ScaleSpec,
return autoConvert_extensions_ScaleSpec_To_v1beta1_ScaleSpec(in, out, s)
}
func autoConvert_v1beta1_StorageClass_To_extensions_StorageClass(in *StorageClass, out *extensions.StorageClass, s conversion.Scope) error {
if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil {
return err
}
// TODO: Inefficient conversion - can we improve it?
if err := s.Convert(&in.ObjectMeta, &out.ObjectMeta, 0); err != nil {
return err
}
out.Provisioner = in.Provisioner
out.Parameters = in.Parameters
return nil
}
func Convert_v1beta1_StorageClass_To_extensions_StorageClass(in *StorageClass, out *extensions.StorageClass, s conversion.Scope) error {
return autoConvert_v1beta1_StorageClass_To_extensions_StorageClass(in, out, s)
}
func autoConvert_extensions_StorageClass_To_v1beta1_StorageClass(in *extensions.StorageClass, out *StorageClass, s conversion.Scope) error {
if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil {
return err
}
// TODO: Inefficient conversion - can we improve it?
if err := s.Convert(&in.ObjectMeta, &out.ObjectMeta, 0); err != nil {
return err
}
out.Provisioner = in.Provisioner
out.Parameters = in.Parameters
return nil
}
func Convert_extensions_StorageClass_To_v1beta1_StorageClass(in *extensions.StorageClass, out *StorageClass, s conversion.Scope) error {
return autoConvert_extensions_StorageClass_To_v1beta1_StorageClass(in, out, s)
}
func autoConvert_v1beta1_StorageClassList_To_extensions_StorageClassList(in *StorageClassList, out *extensions.StorageClassList, s conversion.Scope) error {
if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil {
return err
}
if err := api.Convert_unversioned_ListMeta_To_unversioned_ListMeta(&in.ListMeta, &out.ListMeta, s); err != nil {
return err
}
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]extensions.StorageClass, len(*in))
for i := range *in {
if err := Convert_v1beta1_StorageClass_To_extensions_StorageClass(&(*in)[i], &(*out)[i], s); err != nil {
return err
}
}
} else {
out.Items = nil
}
return nil
}
func Convert_v1beta1_StorageClassList_To_extensions_StorageClassList(in *StorageClassList, out *extensions.StorageClassList, s conversion.Scope) error {
return autoConvert_v1beta1_StorageClassList_To_extensions_StorageClassList(in, out, s)
}
func autoConvert_extensions_StorageClassList_To_v1beta1_StorageClassList(in *extensions.StorageClassList, out *StorageClassList, s conversion.Scope) error {
if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil {
return err
}
if err := api.Convert_unversioned_ListMeta_To_unversioned_ListMeta(&in.ListMeta, &out.ListMeta, s); err != nil {
return err
}
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]StorageClass, len(*in))
for i := range *in {
if err := Convert_extensions_StorageClass_To_v1beta1_StorageClass(&(*in)[i], &(*out)[i], s); err != nil {
return err
}
}
} else {
out.Items = nil
}
return nil
}
func Convert_extensions_StorageClassList_To_v1beta1_StorageClassList(in *extensions.StorageClassList, out *StorageClassList, s conversion.Scope) error {
return autoConvert_extensions_StorageClassList_To_v1beta1_StorageClassList(in, out, s)
}
func autoConvert_v1beta1_SupplementalGroupsStrategyOptions_To_extensions_SupplementalGroupsStrategyOptions(in *SupplementalGroupsStrategyOptions, out *extensions.SupplementalGroupsStrategyOptions, s conversion.Scope) error {
out.Rule = extensions.SupplementalGroupsStrategyType(in.Rule)
if in.Ranges != nil {

View File

@ -100,8 +100,6 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error {
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1beta1_Scale, InType: reflect.TypeOf(&Scale{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1beta1_ScaleSpec, InType: reflect.TypeOf(&ScaleSpec{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1beta1_ScaleStatus, InType: reflect.TypeOf(&ScaleStatus{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1beta1_StorageClass, InType: reflect.TypeOf(&StorageClass{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1beta1_StorageClassList, InType: reflect.TypeOf(&StorageClassList{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1beta1_SubresourceReference, InType: reflect.TypeOf(&SubresourceReference{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1beta1_SupplementalGroupsStrategyOptions, InType: reflect.TypeOf(&SupplementalGroupsStrategyOptions{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1beta1_ThirdPartyResource, InType: reflect.TypeOf(&ThirdPartyResource{})},
@ -1339,49 +1337,6 @@ func DeepCopy_v1beta1_ScaleStatus(in interface{}, out interface{}, c *conversion
}
}
func DeepCopy_v1beta1_StorageClass(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*StorageClass)
out := out.(*StorageClass)
out.TypeMeta = in.TypeMeta
if err := v1.DeepCopy_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
out.Provisioner = in.Provisioner
if in.Parameters != nil {
in, out := &in.Parameters, &out.Parameters
*out = make(map[string]string)
for key, val := range *in {
(*out)[key] = val
}
} else {
out.Parameters = nil
}
return nil
}
}
func DeepCopy_v1beta1_StorageClassList(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*StorageClassList)
out := out.(*StorageClassList)
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]StorageClass, len(*in))
for i := range *in {
if err := DeepCopy_v1beta1_StorageClass(&(*in)[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.Items = nil
}
return nil
}
}
func DeepCopy_v1beta1_SubresourceReference(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*SubresourceReference)

View File

@ -822,65 +822,3 @@ func ValidateNetworkPolicyUpdate(update, old *extensions.NetworkPolicy) field.Er
}
return allErrs
}
// ValidateStorageClass validates a StorageClass.
func ValidateStorageClass(storageClass *extensions.StorageClass) field.ErrorList {
allErrs := apivalidation.ValidateObjectMeta(&storageClass.ObjectMeta, false, apivalidation.NameIsDNSSubdomain, field.NewPath("metadata"))
allErrs = append(allErrs, validateProvisioner(storageClass.Provisioner, field.NewPath("provisioner"))...)
allErrs = append(allErrs, validateParameters(storageClass.Parameters, field.NewPath("parameters"))...)
return allErrs
}
// ValidateStorageClassUpdate tests if an update to StorageClass is valid.
func ValidateStorageClassUpdate(storageClass, oldStorageClass *extensions.StorageClass) field.ErrorList {
allErrs := apivalidation.ValidateObjectMetaUpdate(&storageClass.ObjectMeta, &oldStorageClass.ObjectMeta, field.NewPath("metadata"))
if !reflect.DeepEqual(oldStorageClass.Parameters, storageClass.Parameters) {
allErrs = append(allErrs, field.Forbidden(field.NewPath("parameters"), "updates to parameters are forbidden."))
}
if strings.Compare(storageClass.Provisioner, oldStorageClass.Provisioner) != 0 {
allErrs = append(allErrs, field.Forbidden(field.NewPath("provisioner"), "updates to provisioner are forbidden."))
}
return allErrs
}
// validateProvisioner tests if provisioner is a valid qualified name.
func validateProvisioner(provisioner string, fldPath *field.Path) field.ErrorList {
allErrs := field.ErrorList{}
if len(provisioner) == 0 {
allErrs = append(allErrs, field.Required(fldPath, provisioner))
}
if len(provisioner) > 0 {
for _, msg := range validation.IsQualifiedName(strings.ToLower(provisioner)) {
allErrs = append(allErrs, field.Invalid(fldPath, provisioner, msg))
}
}
return allErrs
}
const maxProvisionerParameterSize = 256 * (1 << 10) // 256 kB
const maxProvisionerParameterLen = 512
// validateParameters tests that keys are qualified names and that provisionerParameter are < 256kB.
func validateParameters(params map[string]string, fldPath *field.Path) field.ErrorList {
var totalSize int64
allErrs := field.ErrorList{}
if len(params) > maxProvisionerParameterLen {
allErrs = append(allErrs, field.TooLong(fldPath, "Provisioner Parameters exceeded max allowed", maxProvisionerParameterLen))
return allErrs
}
for k, v := range params {
if len(k) < 1 {
allErrs = append(allErrs, field.Invalid(fldPath, k, "field can not be empty."))
}
totalSize += (int64)(len(k)) + (int64)(len(v))
}
if totalSize > maxProvisionerParameterSize {
allErrs = append(allErrs, field.TooLong(fldPath, "", maxProvisionerParameterSize))
}
return allErrs
}

View File

@ -2133,80 +2133,3 @@ func newBool(val bool) *bool {
*p = val
return p
}
func TestValidateStorageClass(t *testing.T) {
successCases := []extensions.StorageClass{
{
// empty parameters
ObjectMeta: api.ObjectMeta{Name: "foo"},
Provisioner: "kubernetes.io/foo-provisioner",
Parameters: map[string]string{},
},
{
// nil parameters
ObjectMeta: api.ObjectMeta{Name: "foo"},
Provisioner: "kubernetes.io/foo-provisioner",
},
{
// some parameters
ObjectMeta: api.ObjectMeta{Name: "foo"},
Provisioner: "kubernetes.io/foo-provisioner",
Parameters: map[string]string{
"kubernetes.io/foo-parameter": "free/form/string",
"foo-parameter": "free-form-string",
"foo-parameter2": "{\"embedded\": \"json\", \"with\": {\"structures\":\"inside\"}}",
},
},
}
// Success cases are expected to pass validation.
for k, v := range successCases {
if errs := ValidateStorageClass(&v); len(errs) != 0 {
t.Errorf("Expected success for %d, got %v", k, errs)
}
}
// generate a map longer than maxProvisionerParameterSize
longParameters := make(map[string]string)
totalSize := 0
for totalSize < maxProvisionerParameterSize {
k := fmt.Sprintf("param/%d", totalSize)
v := fmt.Sprintf("value-%d", totalSize)
longParameters[k] = v
totalSize = totalSize + len(k) + len(v)
}
errorCases := map[string]extensions.StorageClass{
"namespace is present": {
ObjectMeta: api.ObjectMeta{Name: "foo", Namespace: "bar"},
Provisioner: "kubernetes.io/foo-provisioner",
},
"invalid provisioner": {
ObjectMeta: api.ObjectMeta{Name: "foo"},
Provisioner: "kubernetes.io/invalid/provisioner",
},
"invalid empty parameter name": {
ObjectMeta: api.ObjectMeta{Name: "foo"},
Provisioner: "kubernetes.io/foo",
Parameters: map[string]string{
"": "value",
},
},
"provisioner: Required value": {
ObjectMeta: api.ObjectMeta{Name: "foo"},
Provisioner: "",
},
"too long parameters": {
ObjectMeta: api.ObjectMeta{Name: "foo"},
Provisioner: "kubernetes.io/foo",
Parameters: longParameters,
},
}
// Error cases are not expected to pass validation.
for testName, storageClass := range errorCases {
if errs := ValidateStorageClass(&storageClass); len(errs) == 0 {
t.Errorf("Expected failure for test: %s", testName)
}
}
}

View File

@ -86,8 +86,6 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error {
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_extensions_Scale, InType: reflect.TypeOf(&Scale{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_extensions_ScaleSpec, InType: reflect.TypeOf(&ScaleSpec{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_extensions_ScaleStatus, InType: reflect.TypeOf(&ScaleStatus{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_extensions_StorageClass, InType: reflect.TypeOf(&StorageClass{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_extensions_StorageClassList, InType: reflect.TypeOf(&StorageClassList{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_extensions_SupplementalGroupsStrategyOptions, InType: reflect.TypeOf(&SupplementalGroupsStrategyOptions{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_extensions_ThirdPartyResource, InType: reflect.TypeOf(&ThirdPartyResource{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_extensions_ThirdPartyResourceData, InType: reflect.TypeOf(&ThirdPartyResourceData{})},
@ -981,49 +979,6 @@ func DeepCopy_extensions_ScaleStatus(in interface{}, out interface{}, c *convers
}
}
func DeepCopy_extensions_StorageClass(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*StorageClass)
out := out.(*StorageClass)
out.TypeMeta = in.TypeMeta
if err := api.DeepCopy_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
out.Provisioner = in.Provisioner
if in.Parameters != nil {
in, out := &in.Parameters, &out.Parameters
*out = make(map[string]string)
for key, val := range *in {
(*out)[key] = val
}
} else {
out.Parameters = nil
}
return nil
}
}
func DeepCopy_extensions_StorageClassList(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*StorageClassList)
out := out.(*StorageClassList)
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]StorageClass, len(*in))
for i := range *in {
if err := DeepCopy_extensions_StorageClass(&(*in)[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.Items = nil
}
return nil
}
}
func DeepCopy_extensions_SupplementalGroupsStrategyOptions(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*SupplementalGroupsStrategyOptions)

19
pkg/apis/storage/doc.go Normal file
View File

@ -0,0 +1,19 @@
/*
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// +k8s:deepcopy-gen=package,register
// +groupName=storage.k8s.io
package storage // import "k8s.io/kubernetes/pkg/apis/storage"

View File

@ -0,0 +1,137 @@
/*
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Package install installs the experimental API group, making it available as
// an option to all of the API encoding/decoding machinery.
package install
import (
"fmt"
"github.com/golang/glog"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/meta"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/apimachinery"
"k8s.io/kubernetes/pkg/apimachinery/registered"
"k8s.io/kubernetes/pkg/apis/storage"
"k8s.io/kubernetes/pkg/apis/storage/v1beta1"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/util/sets"
)
const importPrefix = "k8s.io/kubernetes/pkg/apis/storage"
var accessor = meta.NewAccessor()
// availableVersions lists all known external versions for this group from most preferred to least preferred
var availableVersions = []unversioned.GroupVersion{v1beta1.SchemeGroupVersion}
func init() {
registered.RegisterVersions(availableVersions)
externalVersions := []unversioned.GroupVersion{}
for _, v := range availableVersions {
if registered.IsAllowedVersion(v) {
externalVersions = append(externalVersions, v)
}
}
if len(externalVersions) == 0 {
glog.V(4).Infof("No version is registered for group %v", storage.GroupName)
return
}
if err := registered.EnableVersions(externalVersions...); err != nil {
glog.V(4).Infof("%v", err)
return
}
if err := enableVersions(externalVersions); err != nil {
glog.V(4).Infof("%v", err)
return
}
}
// TODO: enableVersions should be centralized rather than spread in each API
// group.
// We can combine registered.RegisterVersions, registered.EnableVersions and
// registered.RegisterGroup once we have moved enableVersions there.
func enableVersions(externalVersions []unversioned.GroupVersion) error {
addVersionsToScheme(externalVersions...)
preferredExternalVersion := externalVersions[0]
groupMeta := apimachinery.GroupMeta{
GroupVersion: preferredExternalVersion,
GroupVersions: externalVersions,
RESTMapper: newRESTMapper(externalVersions),
SelfLinker: runtime.SelfLinker(accessor),
InterfacesFor: interfacesFor,
}
if err := registered.RegisterGroup(groupMeta); err != nil {
return err
}
api.RegisterRESTMapper(groupMeta.RESTMapper)
return nil
}
func newRESTMapper(externalVersions []unversioned.GroupVersion) meta.RESTMapper {
// the list of kinds that are scoped at the root of the api hierarchy
// if a kind is not enumerated here, it is assumed to have a namespace scope
rootScoped := sets.NewString(
"StorageClass",
)
ignoredKinds := sets.NewString()
return api.NewDefaultRESTMapper(externalVersions, interfacesFor, importPrefix, ignoredKinds, rootScoped)
}
// interfacesFor returns the default Codec and ResourceVersioner for a given version
// string, or an error if the version is not known.
func interfacesFor(version unversioned.GroupVersion) (*meta.VersionInterfaces, error) {
switch version {
case v1beta1.SchemeGroupVersion:
return &meta.VersionInterfaces{
ObjectConvertor: api.Scheme,
MetadataAccessor: accessor,
}, nil
default:
g, _ := registered.Group(storage.GroupName)
return nil, fmt.Errorf("unsupported storage version: %s (valid: %v)", version, g.GroupVersions)
}
}
func addVersionsToScheme(externalVersions ...unversioned.GroupVersion) {
// add the internal version to Scheme
if err := storage.AddToScheme(api.Scheme); err != nil {
// Programmer error, detect immediately
panic(err)
}
// add the enabled external versions to Scheme
for _, v := range externalVersions {
if !registered.IsEnabledVersion(v) {
glog.Errorf("Version %s is not enabled, so it will not be added to the Scheme.", v)
continue
}
switch v {
case v1beta1.SchemeGroupVersion:
if err := v1beta1.AddToScheme(api.Scheme); err != nil {
// Programmer error, detect immediately
panic(err)
}
}
}
}

View File

@ -0,0 +1,56 @@
/*
Copyright 2015 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package storage
import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/runtime"
)
// GroupName is the group name use in this package
const GroupName = "storage.k8s.io"
// SchemeGroupVersion is group version used to register these objects
var SchemeGroupVersion = unversioned.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal}
// Kind takes an unqualified kind and returns a Group qualified GroupKind
func Kind(kind string) unversioned.GroupKind {
return SchemeGroupVersion.WithKind(kind).GroupKind()
}
// Resource takes an unqualified resource and returns a Group qualified GroupResource
func Resource(resource string) unversioned.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource()
}
var (
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
AddToScheme = SchemeBuilder.AddToScheme
)
func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
&api.ListOptions{},
&api.DeleteOptions{},
&api.ExportOptions{},
&StorageClass{},
&StorageClassList{},
)
return nil
}

View File

@ -0,0 +1,900 @@
/*
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// ************************************************************
// DO NOT EDIT.
// THIS FILE IS AUTO-GENERATED BY codecgen.
// ************************************************************
package storage
import (
"errors"
"fmt"
codec1978 "github.com/ugorji/go/codec"
pkg2_api "k8s.io/kubernetes/pkg/api"
pkg1_unversioned "k8s.io/kubernetes/pkg/api/unversioned"
pkg3_types "k8s.io/kubernetes/pkg/types"
"reflect"
"runtime"
time "time"
)
const (
// ----- content types ----
codecSelferC_UTF81234 = 1
codecSelferC_RAW1234 = 0
// ----- value types used ----
codecSelferValueTypeArray1234 = 10
codecSelferValueTypeMap1234 = 9
// ----- containerStateValues ----
codecSelfer_containerMapKey1234 = 2
codecSelfer_containerMapValue1234 = 3
codecSelfer_containerMapEnd1234 = 4
codecSelfer_containerArrayElem1234 = 6
codecSelfer_containerArrayEnd1234 = 7
)
var (
codecSelferBitsize1234 = uint8(reflect.TypeOf(uint(0)).Bits())
codecSelferOnlyMapOrArrayEncodeToStructErr1234 = errors.New(`only encoded map or array can be decoded into a struct`)
)
type codecSelfer1234 struct{}
func init() {
if codec1978.GenVersion != 5 {
_, file, _, _ := runtime.Caller(0)
err := fmt.Errorf("codecgen version mismatch: current: %v, need %v. Re-generate file: %v",
5, codec1978.GenVersion, file)
panic(err)
}
if false { // reference the types, but skip this branch at build/run time
var v0 pkg2_api.ObjectMeta
var v1 pkg1_unversioned.TypeMeta
var v2 pkg3_types.UID
var v3 time.Time
_, _, _, _ = v0, v1, v2, v3
}
}
func (x *StorageClass) CodecEncodeSelf(e *codec1978.Encoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperEncoder(e)
_, _, _ = h, z, r
if x == nil {
r.EncodeNil()
} else {
yym1 := z.EncBinary()
_ = yym1
if false {
} else if z.HasExtensions() && z.EncExt(x) {
} else {
yysep2 := !z.EncBinary()
yy2arr2 := z.EncBasicHandle().StructToArray
var yyq2 [5]bool
_, _, _ = yysep2, yyq2, yy2arr2
const yyr2 bool = false
yyq2[0] = x.Kind != ""
yyq2[1] = x.APIVersion != ""
yyq2[2] = true
yyq2[4] = len(x.Parameters) != 0
var yynn2 int
if yyr2 || yy2arr2 {
r.EncodeArrayStart(5)
} else {
yynn2 = 1
for _, b := range yyq2 {
if b {
yynn2++
}
}
r.EncodeMapStart(yynn2)
yynn2 = 0
}
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq2[0] {
yym4 := z.EncBinary()
_ = yym4
if false {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.Kind))
}
} else {
r.EncodeString(codecSelferC_UTF81234, "")
}
} else {
if yyq2[0] {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("kind"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
yym5 := z.EncBinary()
_ = yym5
if false {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.Kind))
}
}
}
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq2[1] {
yym7 := z.EncBinary()
_ = yym7
if false {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion))
}
} else {
r.EncodeString(codecSelferC_UTF81234, "")
}
} else {
if yyq2[1] {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("apiVersion"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
yym8 := z.EncBinary()
_ = yym8
if false {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion))
}
}
}
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq2[2] {
yy10 := &x.ObjectMeta
yy10.CodecEncodeSelf(e)
} else {
r.EncodeNil()
}
} else {
if yyq2[2] {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("metadata"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
yy11 := &x.ObjectMeta
yy11.CodecEncodeSelf(e)
}
}
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
yym13 := z.EncBinary()
_ = yym13
if false {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.Provisioner))
}
} else {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("provisioner"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
yym14 := z.EncBinary()
_ = yym14
if false {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.Provisioner))
}
}
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq2[4] {
if x.Parameters == nil {
r.EncodeNil()
} else {
yym16 := z.EncBinary()
_ = yym16
if false {
} else {
z.F.EncMapStringStringV(x.Parameters, false, e)
}
}
} else {
r.EncodeNil()
}
} else {
if yyq2[4] {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("parameters"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
if x.Parameters == nil {
r.EncodeNil()
} else {
yym17 := z.EncBinary()
_ = yym17
if false {
} else {
z.F.EncMapStringStringV(x.Parameters, false, e)
}
}
}
}
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayEnd1234)
} else {
z.EncSendContainerState(codecSelfer_containerMapEnd1234)
}
}
}
}
func (x *StorageClass) CodecDecodeSelf(d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
yym18 := z.DecBinary()
_ = yym18
if false {
} else if z.HasExtensions() && z.DecExt(x) {
} else {
yyct19 := r.ContainerType()
if yyct19 == codecSelferValueTypeMap1234 {
yyl19 := r.ReadMapStart()
if yyl19 == 0 {
z.DecSendContainerState(codecSelfer_containerMapEnd1234)
} else {
x.codecDecodeSelfFromMap(yyl19, d)
}
} else if yyct19 == codecSelferValueTypeArray1234 {
yyl19 := r.ReadArrayStart()
if yyl19 == 0 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
} else {
x.codecDecodeSelfFromArray(yyl19, d)
}
} else {
panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234)
}
}
}
func (x *StorageClass) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
var yys20Slc = z.DecScratchBuffer() // default slice to decode into
_ = yys20Slc
var yyhl20 bool = l >= 0
for yyj20 := 0; ; yyj20++ {
if yyhl20 {
if yyj20 >= l {
break
}
} else {
if r.CheckBreak() {
break
}
}
z.DecSendContainerState(codecSelfer_containerMapKey1234)
yys20Slc = r.DecodeBytes(yys20Slc, true, true)
yys20 := string(yys20Slc)
z.DecSendContainerState(codecSelfer_containerMapValue1234)
switch yys20 {
case "kind":
if r.TryDecodeAsNil() {
x.Kind = ""
} else {
x.Kind = string(r.DecodeString())
}
case "apiVersion":
if r.TryDecodeAsNil() {
x.APIVersion = ""
} else {
x.APIVersion = string(r.DecodeString())
}
case "metadata":
if r.TryDecodeAsNil() {
x.ObjectMeta = pkg2_api.ObjectMeta{}
} else {
yyv23 := &x.ObjectMeta
yyv23.CodecDecodeSelf(d)
}
case "provisioner":
if r.TryDecodeAsNil() {
x.Provisioner = ""
} else {
x.Provisioner = string(r.DecodeString())
}
case "parameters":
if r.TryDecodeAsNil() {
x.Parameters = nil
} else {
yyv25 := &x.Parameters
yym26 := z.DecBinary()
_ = yym26
if false {
} else {
z.F.DecMapStringStringX(yyv25, false, d)
}
}
default:
z.DecStructFieldNotFound(-1, yys20)
} // end switch yys20
} // end for yyj20
z.DecSendContainerState(codecSelfer_containerMapEnd1234)
}
func (x *StorageClass) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
var yyj27 int
var yyb27 bool
var yyhl27 bool = l >= 0
yyj27++
if yyhl27 {
yyb27 = yyj27 > l
} else {
yyb27 = r.CheckBreak()
}
if yyb27 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.Kind = ""
} else {
x.Kind = string(r.DecodeString())
}
yyj27++
if yyhl27 {
yyb27 = yyj27 > l
} else {
yyb27 = r.CheckBreak()
}
if yyb27 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.APIVersion = ""
} else {
x.APIVersion = string(r.DecodeString())
}
yyj27++
if yyhl27 {
yyb27 = yyj27 > l
} else {
yyb27 = r.CheckBreak()
}
if yyb27 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.ObjectMeta = pkg2_api.ObjectMeta{}
} else {
yyv30 := &x.ObjectMeta
yyv30.CodecDecodeSelf(d)
}
yyj27++
if yyhl27 {
yyb27 = yyj27 > l
} else {
yyb27 = r.CheckBreak()
}
if yyb27 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.Provisioner = ""
} else {
x.Provisioner = string(r.DecodeString())
}
yyj27++
if yyhl27 {
yyb27 = yyj27 > l
} else {
yyb27 = r.CheckBreak()
}
if yyb27 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.Parameters = nil
} else {
yyv32 := &x.Parameters
yym33 := z.DecBinary()
_ = yym33
if false {
} else {
z.F.DecMapStringStringX(yyv32, false, d)
}
}
for {
yyj27++
if yyhl27 {
yyb27 = yyj27 > l
} else {
yyb27 = r.CheckBreak()
}
if yyb27 {
break
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
z.DecStructFieldNotFound(yyj27-1, "")
}
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
}
func (x *StorageClassList) CodecEncodeSelf(e *codec1978.Encoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperEncoder(e)
_, _, _ = h, z, r
if x == nil {
r.EncodeNil()
} else {
yym34 := z.EncBinary()
_ = yym34
if false {
} else if z.HasExtensions() && z.EncExt(x) {
} else {
yysep35 := !z.EncBinary()
yy2arr35 := z.EncBasicHandle().StructToArray
var yyq35 [4]bool
_, _, _ = yysep35, yyq35, yy2arr35
const yyr35 bool = false
yyq35[0] = x.Kind != ""
yyq35[1] = x.APIVersion != ""
yyq35[2] = true
var yynn35 int
if yyr35 || yy2arr35 {
r.EncodeArrayStart(4)
} else {
yynn35 = 1
for _, b := range yyq35 {
if b {
yynn35++
}
}
r.EncodeMapStart(yynn35)
yynn35 = 0
}
if yyr35 || yy2arr35 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq35[0] {
yym37 := z.EncBinary()
_ = yym37
if false {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.Kind))
}
} else {
r.EncodeString(codecSelferC_UTF81234, "")
}
} else {
if yyq35[0] {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("kind"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
yym38 := z.EncBinary()
_ = yym38
if false {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.Kind))
}
}
}
if yyr35 || yy2arr35 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq35[1] {
yym40 := z.EncBinary()
_ = yym40
if false {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion))
}
} else {
r.EncodeString(codecSelferC_UTF81234, "")
}
} else {
if yyq35[1] {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("apiVersion"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
yym41 := z.EncBinary()
_ = yym41
if false {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion))
}
}
}
if yyr35 || yy2arr35 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq35[2] {
yy43 := &x.ListMeta
yym44 := z.EncBinary()
_ = yym44
if false {
} else if z.HasExtensions() && z.EncExt(yy43) {
} else {
z.EncFallback(yy43)
}
} else {
r.EncodeNil()
}
} else {
if yyq35[2] {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("metadata"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
yy45 := &x.ListMeta
yym46 := z.EncBinary()
_ = yym46
if false {
} else if z.HasExtensions() && z.EncExt(yy45) {
} else {
z.EncFallback(yy45)
}
}
}
if yyr35 || yy2arr35 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if x.Items == nil {
r.EncodeNil()
} else {
yym48 := z.EncBinary()
_ = yym48
if false {
} else {
h.encSliceStorageClass(([]StorageClass)(x.Items), e)
}
}
} else {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("items"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
if x.Items == nil {
r.EncodeNil()
} else {
yym49 := z.EncBinary()
_ = yym49
if false {
} else {
h.encSliceStorageClass(([]StorageClass)(x.Items), e)
}
}
}
if yyr35 || yy2arr35 {
z.EncSendContainerState(codecSelfer_containerArrayEnd1234)
} else {
z.EncSendContainerState(codecSelfer_containerMapEnd1234)
}
}
}
}
func (x *StorageClassList) CodecDecodeSelf(d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
yym50 := z.DecBinary()
_ = yym50
if false {
} else if z.HasExtensions() && z.DecExt(x) {
} else {
yyct51 := r.ContainerType()
if yyct51 == codecSelferValueTypeMap1234 {
yyl51 := r.ReadMapStart()
if yyl51 == 0 {
z.DecSendContainerState(codecSelfer_containerMapEnd1234)
} else {
x.codecDecodeSelfFromMap(yyl51, d)
}
} else if yyct51 == codecSelferValueTypeArray1234 {
yyl51 := r.ReadArrayStart()
if yyl51 == 0 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
} else {
x.codecDecodeSelfFromArray(yyl51, d)
}
} else {
panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234)
}
}
}
func (x *StorageClassList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
var yys52Slc = z.DecScratchBuffer() // default slice to decode into
_ = yys52Slc
var yyhl52 bool = l >= 0
for yyj52 := 0; ; yyj52++ {
if yyhl52 {
if yyj52 >= l {
break
}
} else {
if r.CheckBreak() {
break
}
}
z.DecSendContainerState(codecSelfer_containerMapKey1234)
yys52Slc = r.DecodeBytes(yys52Slc, true, true)
yys52 := string(yys52Slc)
z.DecSendContainerState(codecSelfer_containerMapValue1234)
switch yys52 {
case "kind":
if r.TryDecodeAsNil() {
x.Kind = ""
} else {
x.Kind = string(r.DecodeString())
}
case "apiVersion":
if r.TryDecodeAsNil() {
x.APIVersion = ""
} else {
x.APIVersion = string(r.DecodeString())
}
case "metadata":
if r.TryDecodeAsNil() {
x.ListMeta = pkg1_unversioned.ListMeta{}
} else {
yyv55 := &x.ListMeta
yym56 := z.DecBinary()
_ = yym56
if false {
} else if z.HasExtensions() && z.DecExt(yyv55) {
} else {
z.DecFallback(yyv55, false)
}
}
case "items":
if r.TryDecodeAsNil() {
x.Items = nil
} else {
yyv57 := &x.Items
yym58 := z.DecBinary()
_ = yym58
if false {
} else {
h.decSliceStorageClass((*[]StorageClass)(yyv57), d)
}
}
default:
z.DecStructFieldNotFound(-1, yys52)
} // end switch yys52
} // end for yyj52
z.DecSendContainerState(codecSelfer_containerMapEnd1234)
}
func (x *StorageClassList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
var yyj59 int
var yyb59 bool
var yyhl59 bool = l >= 0
yyj59++
if yyhl59 {
yyb59 = yyj59 > l
} else {
yyb59 = r.CheckBreak()
}
if yyb59 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.Kind = ""
} else {
x.Kind = string(r.DecodeString())
}
yyj59++
if yyhl59 {
yyb59 = yyj59 > l
} else {
yyb59 = r.CheckBreak()
}
if yyb59 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.APIVersion = ""
} else {
x.APIVersion = string(r.DecodeString())
}
yyj59++
if yyhl59 {
yyb59 = yyj59 > l
} else {
yyb59 = r.CheckBreak()
}
if yyb59 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.ListMeta = pkg1_unversioned.ListMeta{}
} else {
yyv62 := &x.ListMeta
yym63 := z.DecBinary()
_ = yym63
if false {
} else if z.HasExtensions() && z.DecExt(yyv62) {
} else {
z.DecFallback(yyv62, false)
}
}
yyj59++
if yyhl59 {
yyb59 = yyj59 > l
} else {
yyb59 = r.CheckBreak()
}
if yyb59 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.Items = nil
} else {
yyv64 := &x.Items
yym65 := z.DecBinary()
_ = yym65
if false {
} else {
h.decSliceStorageClass((*[]StorageClass)(yyv64), d)
}
}
for {
yyj59++
if yyhl59 {
yyb59 = yyj59 > l
} else {
yyb59 = r.CheckBreak()
}
if yyb59 {
break
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
z.DecStructFieldNotFound(yyj59-1, "")
}
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
}
func (x codecSelfer1234) encSliceStorageClass(v []StorageClass, e *codec1978.Encoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperEncoder(e)
_, _, _ = h, z, r
r.EncodeArrayStart(len(v))
for _, yyv66 := range v {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
yy67 := &yyv66
yy67.CodecEncodeSelf(e)
}
z.EncSendContainerState(codecSelfer_containerArrayEnd1234)
}
func (x codecSelfer1234) decSliceStorageClass(v *[]StorageClass, d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
yyv68 := *v
yyh68, yyl68 := z.DecSliceHelperStart()
var yyc68 bool
if yyl68 == 0 {
if yyv68 == nil {
yyv68 = []StorageClass{}
yyc68 = true
} else if len(yyv68) != 0 {
yyv68 = yyv68[:0]
yyc68 = true
}
} else if yyl68 > 0 {
var yyrr68, yyrl68 int
var yyrt68 bool
if yyl68 > cap(yyv68) {
yyrg68 := len(yyv68) > 0
yyv268 := yyv68
yyrl68, yyrt68 = z.DecInferLen(yyl68, z.DecBasicHandle().MaxInitLen, 280)
if yyrt68 {
if yyrl68 <= cap(yyv68) {
yyv68 = yyv68[:yyrl68]
} else {
yyv68 = make([]StorageClass, yyrl68)
}
} else {
yyv68 = make([]StorageClass, yyrl68)
}
yyc68 = true
yyrr68 = len(yyv68)
if yyrg68 {
copy(yyv68, yyv268)
}
} else if yyl68 != len(yyv68) {
yyv68 = yyv68[:yyl68]
yyc68 = true
}
yyj68 := 0
for ; yyj68 < yyrr68; yyj68++ {
yyh68.ElemContainerState(yyj68)
if r.TryDecodeAsNil() {
yyv68[yyj68] = StorageClass{}
} else {
yyv69 := &yyv68[yyj68]
yyv69.CodecDecodeSelf(d)
}
}
if yyrt68 {
for ; yyj68 < yyl68; yyj68++ {
yyv68 = append(yyv68, StorageClass{})
yyh68.ElemContainerState(yyj68)
if r.TryDecodeAsNil() {
yyv68[yyj68] = StorageClass{}
} else {
yyv70 := &yyv68[yyj68]
yyv70.CodecDecodeSelf(d)
}
}
}
} else {
yyj68 := 0
for ; !r.CheckBreak(); yyj68++ {
if yyj68 >= len(yyv68) {
yyv68 = append(yyv68, StorageClass{}) // var yyz68 StorageClass
yyc68 = true
}
yyh68.ElemContainerState(yyj68)
if yyj68 < len(yyv68) {
if r.TryDecodeAsNil() {
yyv68[yyj68] = StorageClass{}
} else {
yyv71 := &yyv68[yyj68]
yyv71.CodecDecodeSelf(d)
}
} else {
z.DecSwallow()
}
}
if yyj68 < len(yyv68) {
yyv68 = yyv68[:yyj68]
yyc68 = true
} else if yyj68 == 0 && yyv68 == nil {
yyv68 = []StorageClass{}
yyc68 = true
}
}
yyh68.End()
if yyc68 {
*v = yyv68
}
}

60
pkg/apis/storage/types.go Normal file
View File

@ -0,0 +1,60 @@
/*
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package storage
import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
)
// +genclient=true
// +nonNamespaced=true
// StorageClass describes a named "class" of storage offered in a cluster.
// Different classes might map to quality-of-service levels, or to backup policies,
// or to arbitrary policies determined by the cluster administrators. Kubernetes
// itself is unopinionated about what classes represent. This concept is sometimes
// called "profiles" in other storage systems.
// The name of a StorageClass object is significant, and is how users can request a particular class.
type StorageClass struct {
unversioned.TypeMeta `json:",inline"`
api.ObjectMeta `json:"metadata,omitempty"`
// provisioner is the driver expected to handle this StorageClass.
// This is an optionally-prefixed name, like a label key.
// For example: "kubernetes.io/gce-pd" or "kubernetes.io/aws-ebs".
// This value may not be empty.
Provisioner string `json:"provisioner"`
// parameters holds parameters for the provisioner.
// These values are opaque to the system and are passed directly
// to the provisioner. The only validation done on keys is that they are
// not empty. The maximum number of parameters is
// 512, with a cumulative max size of 256K
Parameters map[string]string `json:"parameters,omitempty"`
}
// StorageClassList is a collection of storage classes.
type StorageClassList struct {
unversioned.TypeMeta `json:",inline"`
// Standard list metadata
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
unversioned.ListMeta `json:"metadata,omitempty"`
// Items is the list of StorageClasses
Items []StorageClass `json:"items"`
}

View File

@ -0,0 +1,20 @@
/*
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// +k8s:deepcopy-gen=package,register
// +k8s:conversion-gen=k8s.io/kubernetes/pkg/apis/storage
// +groupName=storage.k8s.io
package v1beta1 // import "k8s.io/kubernetes/pkg/apis/storage/v1beta1"

View File

@ -0,0 +1,729 @@
/*
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by protoc-gen-gogo.
// source: k8s.io/kubernetes/pkg/apis/storage/v1beta1/generated.proto
// DO NOT EDIT!
/*
Package v1beta1 is a generated protocol buffer package.
It is generated from these files:
k8s.io/kubernetes/pkg/apis/storage/v1beta1/generated.proto
It has these top-level messages:
StorageClass
StorageClassList
*/
package v1beta1
import proto "github.com/gogo/protobuf/proto"
import fmt "fmt"
import math "math"
import strings "strings"
import reflect "reflect"
import github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys"
import io "io"
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
const _ = proto.GoGoProtoPackageIsVersion1
func (m *StorageClass) Reset() { *m = StorageClass{} }
func (*StorageClass) ProtoMessage() {}
func (*StorageClass) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{0} }
func (m *StorageClassList) Reset() { *m = StorageClassList{} }
func (*StorageClassList) ProtoMessage() {}
func (*StorageClassList) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{1} }
func init() {
proto.RegisterType((*StorageClass)(nil), "k8s.io.kubernetes.pkg.apis.storage.v1beta1.StorageClass")
proto.RegisterType((*StorageClassList)(nil), "k8s.io.kubernetes.pkg.apis.storage.v1beta1.StorageClassList")
}
func (m *StorageClass) Marshal() (data []byte, err error) {
size := m.Size()
data = make([]byte, size)
n, err := m.MarshalTo(data)
if err != nil {
return nil, err
}
return data[:n], nil
}
func (m *StorageClass) MarshalTo(data []byte) (int, error) {
var i int
_ = i
var l int
_ = l
data[i] = 0xa
i++
i = encodeVarintGenerated(data, i, uint64(m.ObjectMeta.Size()))
n1, err := m.ObjectMeta.MarshalTo(data[i:])
if err != nil {
return 0, err
}
i += n1
data[i] = 0x12
i++
i = encodeVarintGenerated(data, i, uint64(len(m.Provisioner)))
i += copy(data[i:], m.Provisioner)
if len(m.Parameters) > 0 {
for k := range m.Parameters {
data[i] = 0x1a
i++
v := m.Parameters[k]
mapSize := 1 + len(k) + sovGenerated(uint64(len(k))) + 1 + len(v) + sovGenerated(uint64(len(v)))
i = encodeVarintGenerated(data, i, uint64(mapSize))
data[i] = 0xa
i++
i = encodeVarintGenerated(data, i, uint64(len(k)))
i += copy(data[i:], k)
data[i] = 0x12
i++
i = encodeVarintGenerated(data, i, uint64(len(v)))
i += copy(data[i:], v)
}
}
return i, nil
}
func (m *StorageClassList) Marshal() (data []byte, err error) {
size := m.Size()
data = make([]byte, size)
n, err := m.MarshalTo(data)
if err != nil {
return nil, err
}
return data[:n], nil
}
func (m *StorageClassList) MarshalTo(data []byte) (int, error) {
var i int
_ = i
var l int
_ = l
data[i] = 0xa
i++
i = encodeVarintGenerated(data, i, uint64(m.ListMeta.Size()))
n2, err := m.ListMeta.MarshalTo(data[i:])
if err != nil {
return 0, err
}
i += n2
if len(m.Items) > 0 {
for _, msg := range m.Items {
data[i] = 0x12
i++
i = encodeVarintGenerated(data, i, uint64(msg.Size()))
n, err := msg.MarshalTo(data[i:])
if err != nil {
return 0, err
}
i += n
}
}
return i, nil
}
func encodeFixed64Generated(data []byte, offset int, v uint64) int {
data[offset] = uint8(v)
data[offset+1] = uint8(v >> 8)
data[offset+2] = uint8(v >> 16)
data[offset+3] = uint8(v >> 24)
data[offset+4] = uint8(v >> 32)
data[offset+5] = uint8(v >> 40)
data[offset+6] = uint8(v >> 48)
data[offset+7] = uint8(v >> 56)
return offset + 8
}
func encodeFixed32Generated(data []byte, offset int, v uint32) int {
data[offset] = uint8(v)
data[offset+1] = uint8(v >> 8)
data[offset+2] = uint8(v >> 16)
data[offset+3] = uint8(v >> 24)
return offset + 4
}
func encodeVarintGenerated(data []byte, offset int, v uint64) int {
for v >= 1<<7 {
data[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
data[offset] = uint8(v)
return offset + 1
}
func (m *StorageClass) Size() (n int) {
var l int
_ = l
l = m.ObjectMeta.Size()
n += 1 + l + sovGenerated(uint64(l))
l = len(m.Provisioner)
n += 1 + l + sovGenerated(uint64(l))
if len(m.Parameters) > 0 {
for k, v := range m.Parameters {
_ = k
_ = v
mapEntrySize := 1 + len(k) + sovGenerated(uint64(len(k))) + 1 + len(v) + sovGenerated(uint64(len(v)))
n += mapEntrySize + 1 + sovGenerated(uint64(mapEntrySize))
}
}
return n
}
func (m *StorageClassList) Size() (n int) {
var l int
_ = l
l = m.ListMeta.Size()
n += 1 + l + sovGenerated(uint64(l))
if len(m.Items) > 0 {
for _, e := range m.Items {
l = e.Size()
n += 1 + l + sovGenerated(uint64(l))
}
}
return n
}
func sovGenerated(x uint64) (n int) {
for {
n++
x >>= 7
if x == 0 {
break
}
}
return n
}
func sozGenerated(x uint64) (n int) {
return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (this *StorageClass) String() string {
if this == nil {
return "nil"
}
keysForParameters := make([]string, 0, len(this.Parameters))
for k := range this.Parameters {
keysForParameters = append(keysForParameters, k)
}
github_com_gogo_protobuf_sortkeys.Strings(keysForParameters)
mapStringForParameters := "map[string]string{"
for _, k := range keysForParameters {
mapStringForParameters += fmt.Sprintf("%v: %v,", k, this.Parameters[k])
}
mapStringForParameters += "}"
s := strings.Join([]string{`&StorageClass{`,
`ObjectMeta:` + strings.Replace(strings.Replace(this.ObjectMeta.String(), "ObjectMeta", "k8s_io_kubernetes_pkg_api_v1.ObjectMeta", 1), `&`, ``, 1) + `,`,
`Provisioner:` + fmt.Sprintf("%v", this.Provisioner) + `,`,
`Parameters:` + mapStringForParameters + `,`,
`}`,
}, "")
return s
}
func (this *StorageClassList) String() string {
if this == nil {
return "nil"
}
s := strings.Join([]string{`&StorageClassList{`,
`ListMeta:` + strings.Replace(strings.Replace(this.ListMeta.String(), "ListMeta", "k8s_io_kubernetes_pkg_api_unversioned.ListMeta", 1), `&`, ``, 1) + `,`,
`Items:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Items), "StorageClass", "StorageClass", 1), `&`, ``, 1) + `,`,
`}`,
}, "")
return s
}
func valueToStringGenerated(v interface{}) string {
rv := reflect.ValueOf(v)
if rv.IsNil() {
return "nil"
}
pv := reflect.Indirect(rv).Interface()
return fmt.Sprintf("*%v", pv)
}
func (m *StorageClass) Unmarshal(data []byte) error {
l := len(data)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenerated
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := data[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: StorageClass: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: StorageClass: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenerated
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := data[iNdEx]
iNdEx++
msglen |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthGenerated
}
postIndex := iNdEx + msglen
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.ObjectMeta.Unmarshal(data[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Provisioner", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenerated
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := data[iNdEx]
iNdEx++
stringLen |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthGenerated
}
postIndex := iNdEx + intStringLen
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Provisioner = string(data[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Parameters", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenerated
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := data[iNdEx]
iNdEx++
msglen |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthGenerated
}
postIndex := iNdEx + msglen
if postIndex > l {
return io.ErrUnexpectedEOF
}
var keykey uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenerated
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := data[iNdEx]
iNdEx++
keykey |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
var stringLenmapkey uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenerated
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := data[iNdEx]
iNdEx++
stringLenmapkey |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
intStringLenmapkey := int(stringLenmapkey)
if intStringLenmapkey < 0 {
return ErrInvalidLengthGenerated
}
postStringIndexmapkey := iNdEx + intStringLenmapkey
if postStringIndexmapkey > l {
return io.ErrUnexpectedEOF
}
mapkey := string(data[iNdEx:postStringIndexmapkey])
iNdEx = postStringIndexmapkey
var valuekey uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenerated
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := data[iNdEx]
iNdEx++
valuekey |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
var stringLenmapvalue uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenerated
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := data[iNdEx]
iNdEx++
stringLenmapvalue |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
intStringLenmapvalue := int(stringLenmapvalue)
if intStringLenmapvalue < 0 {
return ErrInvalidLengthGenerated
}
postStringIndexmapvalue := iNdEx + intStringLenmapvalue
if postStringIndexmapvalue > l {
return io.ErrUnexpectedEOF
}
mapvalue := string(data[iNdEx:postStringIndexmapvalue])
iNdEx = postStringIndexmapvalue
if m.Parameters == nil {
m.Parameters = make(map[string]string)
}
m.Parameters[mapkey] = mapvalue
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipGenerated(data[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthGenerated
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *StorageClassList) Unmarshal(data []byte) error {
l := len(data)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenerated
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := data[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: StorageClassList: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: StorageClassList: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenerated
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := data[iNdEx]
iNdEx++
msglen |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthGenerated
}
postIndex := iNdEx + msglen
if postIndex > l {
return io.ErrUnexpectedEOF
}
if err := m.ListMeta.Unmarshal(data[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowGenerated
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := data[iNdEx]
iNdEx++
msglen |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthGenerated
}
postIndex := iNdEx + msglen
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Items = append(m.Items, StorageClass{})
if err := m.Items[len(m.Items)-1].Unmarshal(data[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipGenerated(data[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthGenerated
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipGenerated(data []byte) (n int, err error) {
l := len(data)
iNdEx := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowGenerated
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := data[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowGenerated
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if data[iNdEx-1] < 0x80 {
break
}
}
return iNdEx, nil
case 1:
iNdEx += 8
return iNdEx, nil
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowGenerated
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := data[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
iNdEx += length
if length < 0 {
return 0, ErrInvalidLengthGenerated
}
return iNdEx, nil
case 3:
for {
var innerWire uint64
var start int = iNdEx
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowGenerated
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := data[iNdEx]
iNdEx++
innerWire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
innerWireType := int(innerWire & 0x7)
if innerWireType == 4 {
break
}
next, err := skipGenerated(data[start:])
if err != nil {
return 0, err
}
iNdEx = start + next
}
return iNdEx, nil
case 4:
return iNdEx, nil
case 5:
iNdEx += 4
return iNdEx, nil
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
}
panic("unreachable")
}
var (
ErrInvalidLengthGenerated = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowGenerated = fmt.Errorf("proto: integer overflow")
)
var fileDescriptorGenerated = []byte{
// 455 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x9c, 0x92, 0x4d, 0x6b, 0x13, 0x41,
0x18, 0xc7, 0xb3, 0x09, 0xc1, 0x76, 0xa2, 0x18, 0x46, 0x0f, 0x61, 0x0f, 0x69, 0xe9, 0xa9, 0x8a,
0x9d, 0x21, 0x85, 0x42, 0x28, 0x78, 0x59, 0x11, 0x14, 0x14, 0xcb, 0x7a, 0x11, 0xa1, 0x87, 0xd9,
0xe4, 0x71, 0x1d, 0x37, 0xbb, 0xb3, 0xcc, 0xcb, 0x42, 0xc1, 0x83, 0x1f, 0xc1, 0x8f, 0x95, 0x63,
0x8e, 0x1e, 0xa4, 0x68, 0xfd, 0x22, 0xce, 0xbe, 0xd8, 0x5d, 0xb2, 0x59, 0x11, 0x0f, 0x0f, 0xcc,
0xdb, 0xef, 0xff, 0xfc, 0x9f, 0x3f, 0x83, 0xce, 0xa3, 0xb9, 0x22, 0x5c, 0xd0, 0xc8, 0x04, 0x20,
0x13, 0xd0, 0xa0, 0x68, 0x1a, 0x85, 0x94, 0xa5, 0x5c, 0x51, 0xa5, 0x85, 0x64, 0x21, 0xd0, 0x6c,
0x16, 0x80, 0x66, 0x33, 0x1a, 0x42, 0x02, 0x92, 0x69, 0x58, 0x92, 0x54, 0x0a, 0x2d, 0xf0, 0xe3,
0x92, 0x25, 0x35, 0x4b, 0x2c, 0x4b, 0x72, 0x96, 0x54, 0x2c, 0xa9, 0x58, 0xf7, 0x24, 0xe4, 0xfa,
0xa3, 0x09, 0xc8, 0x42, 0xc4, 0x34, 0x14, 0xa1, 0xa0, 0x85, 0x44, 0x60, 0x3e, 0x14, 0xbb, 0x62,
0x53, 0xac, 0x4a, 0x69, 0xf7, 0xb4, 0xd3, 0x16, 0x95, 0xa0, 0x84, 0x91, 0x0b, 0xd8, 0xb6, 0xe3,
0x9e, 0x75, 0x33, 0x26, 0xc9, 0x40, 0x2a, 0x2e, 0x12, 0x58, 0xb6, 0xb0, 0x27, 0xdd, 0x58, 0xd6,
0x9a, 0xd9, 0x3d, 0xd9, 0xfd, 0x5a, 0x9a, 0x44, 0xf3, 0xb8, 0xed, 0x69, 0xb6, 0xfb, 0xb9, 0xd1,
0x7c, 0x45, 0x79, 0xa2, 0x95, 0x96, 0xdb, 0xc8, 0xd1, 0xf7, 0x3e, 0xba, 0xfb, 0xb6, 0x4c, 0xef,
0xd9, 0x8a, 0x29, 0x85, 0xdf, 0xa1, 0xbd, 0xd8, 0x66, 0xb8, 0x64, 0x9a, 0x4d, 0x9c, 0x43, 0xe7,
0x78, 0x74, 0x7a, 0x4c, 0x3a, 0x93, 0xb7, 0x81, 0x93, 0x37, 0xc1, 0x27, 0x58, 0xe8, 0xd7, 0x96,
0xf1, 0xf0, 0xfa, 0xfa, 0xa0, 0x77, 0x73, 0x7d, 0x80, 0xea, 0x33, 0xff, 0x56, 0x0d, 0x9f, 0xa1,
0x91, 0xed, 0x99, 0xf1, 0x22, 0x19, 0x39, 0xe9, 0x5b, 0xf1, 0x7d, 0xef, 0x41, 0x85, 0x8c, 0x2e,
0xea, 0x2b, 0xbf, 0xf9, 0x0e, 0x7f, 0x46, 0x28, 0x65, 0x92, 0x59, 0x19, 0x1b, 0xea, 0x64, 0x70,
0x38, 0xb0, 0x96, 0x5e, 0x90, 0x7f, 0xff, 0x0c, 0xa4, 0x39, 0x1e, 0xb9, 0xb8, 0x95, 0x7a, 0x9e,
0x68, 0x79, 0x55, 0x5b, 0xae, 0x2f, 0xfc, 0x46, 0x3f, 0xf7, 0x29, 0xba, 0xbf, 0x85, 0xe0, 0x31,
0x1a, 0x44, 0x70, 0x55, 0x84, 0xb3, 0xef, 0xe7, 0x4b, 0xfc, 0x10, 0x0d, 0x33, 0xb6, 0x32, 0x50,
0xce, 0xe4, 0x97, 0x9b, 0xf3, 0xfe, 0xdc, 0x39, 0xda, 0x38, 0x68, 0xdc, 0xec, 0xff, 0x8a, 0x2b,
0x8d, 0x2f, 0x5b, 0x11, 0xd3, 0xbf, 0x44, 0xdc, 0xf8, 0x4d, 0x24, 0xc7, 0x8b, 0xa4, 0xc7, 0x95,
0xed, 0xbd, 0x3f, 0x27, 0x8d, 0x9c, 0x2f, 0xd1, 0x90, 0x6b, 0x88, 0x95, 0x75, 0x93, 0x67, 0x35,
0xff, 0xdf, 0xac, 0xbc, 0x7b, 0x55, 0x93, 0xe1, 0xcb, 0x5c, 0xce, 0x2f, 0x55, 0xbd, 0x47, 0xeb,
0x9f, 0xd3, 0xde, 0xc6, 0xd6, 0x37, 0x5b, 0x5f, 0x6e, 0xa6, 0xce, 0xda, 0xd6, 0xc6, 0xd6, 0x0f,
0x5b, 0x5f, 0x7f, 0x4d, 0x7b, 0xef, 0xef, 0x54, 0x6a, 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, 0x86,
0x21, 0xa9, 0x43, 0xef, 0x03, 0x00, 0x00,
}

View File

@ -0,0 +1,60 @@
/*
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// This file was autogenerated by go-to-protobuf. Do not edit it manually!
syntax = 'proto2';
package k8s.io.kubernetes.pkg.apis.storage.v1beta1;
import "k8s.io/kubernetes/pkg/api/resource/generated.proto";
import "k8s.io/kubernetes/pkg/api/unversioned/generated.proto";
import "k8s.io/kubernetes/pkg/api/v1/generated.proto";
import "k8s.io/kubernetes/pkg/runtime/generated.proto";
import "k8s.io/kubernetes/pkg/util/intstr/generated.proto";
// Package-wide variables from generator "generated".
option go_package = "v1beta1";
// StorageClass describes the parameters for a class of storage for
// which PersistentVolumes can be dynamically provisioned.
//
// StorageClasses are non-namespaced; the name of the storage class
// according to etcd is in ObjectMeta.Name.
message StorageClass {
// Standard object's metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
optional k8s.io.kubernetes.pkg.api.v1.ObjectMeta metadata = 1;
// Provisioner indicates the type of the provisioner.
optional string provisioner = 2;
// Parameters holds the parameters for the provisioner that should
// create volumes of this storage class.
map<string, string> parameters = 3;
}
// StorageClassList is a collection of storage classes.
message StorageClassList {
// Standard list metadata
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
optional k8s.io.kubernetes.pkg.api.unversioned.ListMeta metadata = 1;
// Items is the list of StorageClasses
repeated StorageClass items = 2;
}

View File

@ -0,0 +1,50 @@
/*
Copyright 2015 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1beta1
import (
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/runtime"
versionedwatch "k8s.io/kubernetes/pkg/watch/versioned"
)
// GroupName is the group name use in this package
const GroupName = "storage.k8s.io"
// SchemeGroupVersion is group version used to register these objects
var SchemeGroupVersion = unversioned.GroupVersion{Group: GroupName, Version: "v1beta1"}
var (
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
AddToScheme = SchemeBuilder.AddToScheme
)
// Adds the list of known types to api.Scheme.
func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
&v1.ListOptions{},
&v1.DeleteOptions{},
&v1.ExportOptions{},
&StorageClass{},
&StorageClassList{},
)
versionedwatch.AddToGroupVersion(scheme, SchemeGroupVersion)
return nil
}

View File

@ -0,0 +1,900 @@
/*
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// ************************************************************
// DO NOT EDIT.
// THIS FILE IS AUTO-GENERATED BY codecgen.
// ************************************************************
package v1beta1
import (
"errors"
"fmt"
codec1978 "github.com/ugorji/go/codec"
pkg1_unversioned "k8s.io/kubernetes/pkg/api/unversioned"
pkg2_v1 "k8s.io/kubernetes/pkg/api/v1"
pkg3_types "k8s.io/kubernetes/pkg/types"
"reflect"
"runtime"
time "time"
)
const (
// ----- content types ----
codecSelferC_UTF81234 = 1
codecSelferC_RAW1234 = 0
// ----- value types used ----
codecSelferValueTypeArray1234 = 10
codecSelferValueTypeMap1234 = 9
// ----- containerStateValues ----
codecSelfer_containerMapKey1234 = 2
codecSelfer_containerMapValue1234 = 3
codecSelfer_containerMapEnd1234 = 4
codecSelfer_containerArrayElem1234 = 6
codecSelfer_containerArrayEnd1234 = 7
)
var (
codecSelferBitsize1234 = uint8(reflect.TypeOf(uint(0)).Bits())
codecSelferOnlyMapOrArrayEncodeToStructErr1234 = errors.New(`only encoded map or array can be decoded into a struct`)
)
type codecSelfer1234 struct{}
func init() {
if codec1978.GenVersion != 5 {
_, file, _, _ := runtime.Caller(0)
err := fmt.Errorf("codecgen version mismatch: current: %v, need %v. Re-generate file: %v",
5, codec1978.GenVersion, file)
panic(err)
}
if false { // reference the types, but skip this branch at build/run time
var v0 pkg1_unversioned.TypeMeta
var v1 pkg2_v1.ObjectMeta
var v2 pkg3_types.UID
var v3 time.Time
_, _, _, _ = v0, v1, v2, v3
}
}
func (x *StorageClass) CodecEncodeSelf(e *codec1978.Encoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperEncoder(e)
_, _, _ = h, z, r
if x == nil {
r.EncodeNil()
} else {
yym1 := z.EncBinary()
_ = yym1
if false {
} else if z.HasExtensions() && z.EncExt(x) {
} else {
yysep2 := !z.EncBinary()
yy2arr2 := z.EncBasicHandle().StructToArray
var yyq2 [5]bool
_, _, _ = yysep2, yyq2, yy2arr2
const yyr2 bool = false
yyq2[0] = x.Kind != ""
yyq2[1] = x.APIVersion != ""
yyq2[2] = true
yyq2[4] = len(x.Parameters) != 0
var yynn2 int
if yyr2 || yy2arr2 {
r.EncodeArrayStart(5)
} else {
yynn2 = 1
for _, b := range yyq2 {
if b {
yynn2++
}
}
r.EncodeMapStart(yynn2)
yynn2 = 0
}
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq2[0] {
yym4 := z.EncBinary()
_ = yym4
if false {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.Kind))
}
} else {
r.EncodeString(codecSelferC_UTF81234, "")
}
} else {
if yyq2[0] {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("kind"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
yym5 := z.EncBinary()
_ = yym5
if false {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.Kind))
}
}
}
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq2[1] {
yym7 := z.EncBinary()
_ = yym7
if false {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion))
}
} else {
r.EncodeString(codecSelferC_UTF81234, "")
}
} else {
if yyq2[1] {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("apiVersion"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
yym8 := z.EncBinary()
_ = yym8
if false {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion))
}
}
}
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq2[2] {
yy10 := &x.ObjectMeta
yy10.CodecEncodeSelf(e)
} else {
r.EncodeNil()
}
} else {
if yyq2[2] {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("metadata"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
yy11 := &x.ObjectMeta
yy11.CodecEncodeSelf(e)
}
}
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
yym13 := z.EncBinary()
_ = yym13
if false {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.Provisioner))
}
} else {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("provisioner"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
yym14 := z.EncBinary()
_ = yym14
if false {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.Provisioner))
}
}
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq2[4] {
if x.Parameters == nil {
r.EncodeNil()
} else {
yym16 := z.EncBinary()
_ = yym16
if false {
} else {
z.F.EncMapStringStringV(x.Parameters, false, e)
}
}
} else {
r.EncodeNil()
}
} else {
if yyq2[4] {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("parameters"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
if x.Parameters == nil {
r.EncodeNil()
} else {
yym17 := z.EncBinary()
_ = yym17
if false {
} else {
z.F.EncMapStringStringV(x.Parameters, false, e)
}
}
}
}
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayEnd1234)
} else {
z.EncSendContainerState(codecSelfer_containerMapEnd1234)
}
}
}
}
func (x *StorageClass) CodecDecodeSelf(d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
yym18 := z.DecBinary()
_ = yym18
if false {
} else if z.HasExtensions() && z.DecExt(x) {
} else {
yyct19 := r.ContainerType()
if yyct19 == codecSelferValueTypeMap1234 {
yyl19 := r.ReadMapStart()
if yyl19 == 0 {
z.DecSendContainerState(codecSelfer_containerMapEnd1234)
} else {
x.codecDecodeSelfFromMap(yyl19, d)
}
} else if yyct19 == codecSelferValueTypeArray1234 {
yyl19 := r.ReadArrayStart()
if yyl19 == 0 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
} else {
x.codecDecodeSelfFromArray(yyl19, d)
}
} else {
panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234)
}
}
}
func (x *StorageClass) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
var yys20Slc = z.DecScratchBuffer() // default slice to decode into
_ = yys20Slc
var yyhl20 bool = l >= 0
for yyj20 := 0; ; yyj20++ {
if yyhl20 {
if yyj20 >= l {
break
}
} else {
if r.CheckBreak() {
break
}
}
z.DecSendContainerState(codecSelfer_containerMapKey1234)
yys20Slc = r.DecodeBytes(yys20Slc, true, true)
yys20 := string(yys20Slc)
z.DecSendContainerState(codecSelfer_containerMapValue1234)
switch yys20 {
case "kind":
if r.TryDecodeAsNil() {
x.Kind = ""
} else {
x.Kind = string(r.DecodeString())
}
case "apiVersion":
if r.TryDecodeAsNil() {
x.APIVersion = ""
} else {
x.APIVersion = string(r.DecodeString())
}
case "metadata":
if r.TryDecodeAsNil() {
x.ObjectMeta = pkg2_v1.ObjectMeta{}
} else {
yyv23 := &x.ObjectMeta
yyv23.CodecDecodeSelf(d)
}
case "provisioner":
if r.TryDecodeAsNil() {
x.Provisioner = ""
} else {
x.Provisioner = string(r.DecodeString())
}
case "parameters":
if r.TryDecodeAsNil() {
x.Parameters = nil
} else {
yyv25 := &x.Parameters
yym26 := z.DecBinary()
_ = yym26
if false {
} else {
z.F.DecMapStringStringX(yyv25, false, d)
}
}
default:
z.DecStructFieldNotFound(-1, yys20)
} // end switch yys20
} // end for yyj20
z.DecSendContainerState(codecSelfer_containerMapEnd1234)
}
func (x *StorageClass) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
var yyj27 int
var yyb27 bool
var yyhl27 bool = l >= 0
yyj27++
if yyhl27 {
yyb27 = yyj27 > l
} else {
yyb27 = r.CheckBreak()
}
if yyb27 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.Kind = ""
} else {
x.Kind = string(r.DecodeString())
}
yyj27++
if yyhl27 {
yyb27 = yyj27 > l
} else {
yyb27 = r.CheckBreak()
}
if yyb27 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.APIVersion = ""
} else {
x.APIVersion = string(r.DecodeString())
}
yyj27++
if yyhl27 {
yyb27 = yyj27 > l
} else {
yyb27 = r.CheckBreak()
}
if yyb27 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.ObjectMeta = pkg2_v1.ObjectMeta{}
} else {
yyv30 := &x.ObjectMeta
yyv30.CodecDecodeSelf(d)
}
yyj27++
if yyhl27 {
yyb27 = yyj27 > l
} else {
yyb27 = r.CheckBreak()
}
if yyb27 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.Provisioner = ""
} else {
x.Provisioner = string(r.DecodeString())
}
yyj27++
if yyhl27 {
yyb27 = yyj27 > l
} else {
yyb27 = r.CheckBreak()
}
if yyb27 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.Parameters = nil
} else {
yyv32 := &x.Parameters
yym33 := z.DecBinary()
_ = yym33
if false {
} else {
z.F.DecMapStringStringX(yyv32, false, d)
}
}
for {
yyj27++
if yyhl27 {
yyb27 = yyj27 > l
} else {
yyb27 = r.CheckBreak()
}
if yyb27 {
break
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
z.DecStructFieldNotFound(yyj27-1, "")
}
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
}
func (x *StorageClassList) CodecEncodeSelf(e *codec1978.Encoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperEncoder(e)
_, _, _ = h, z, r
if x == nil {
r.EncodeNil()
} else {
yym34 := z.EncBinary()
_ = yym34
if false {
} else if z.HasExtensions() && z.EncExt(x) {
} else {
yysep35 := !z.EncBinary()
yy2arr35 := z.EncBasicHandle().StructToArray
var yyq35 [4]bool
_, _, _ = yysep35, yyq35, yy2arr35
const yyr35 bool = false
yyq35[0] = x.Kind != ""
yyq35[1] = x.APIVersion != ""
yyq35[2] = true
var yynn35 int
if yyr35 || yy2arr35 {
r.EncodeArrayStart(4)
} else {
yynn35 = 1
for _, b := range yyq35 {
if b {
yynn35++
}
}
r.EncodeMapStart(yynn35)
yynn35 = 0
}
if yyr35 || yy2arr35 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq35[0] {
yym37 := z.EncBinary()
_ = yym37
if false {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.Kind))
}
} else {
r.EncodeString(codecSelferC_UTF81234, "")
}
} else {
if yyq35[0] {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("kind"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
yym38 := z.EncBinary()
_ = yym38
if false {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.Kind))
}
}
}
if yyr35 || yy2arr35 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq35[1] {
yym40 := z.EncBinary()
_ = yym40
if false {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion))
}
} else {
r.EncodeString(codecSelferC_UTF81234, "")
}
} else {
if yyq35[1] {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("apiVersion"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
yym41 := z.EncBinary()
_ = yym41
if false {
} else {
r.EncodeString(codecSelferC_UTF81234, string(x.APIVersion))
}
}
}
if yyr35 || yy2arr35 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq35[2] {
yy43 := &x.ListMeta
yym44 := z.EncBinary()
_ = yym44
if false {
} else if z.HasExtensions() && z.EncExt(yy43) {
} else {
z.EncFallback(yy43)
}
} else {
r.EncodeNil()
}
} else {
if yyq35[2] {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("metadata"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
yy45 := &x.ListMeta
yym46 := z.EncBinary()
_ = yym46
if false {
} else if z.HasExtensions() && z.EncExt(yy45) {
} else {
z.EncFallback(yy45)
}
}
}
if yyr35 || yy2arr35 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if x.Items == nil {
r.EncodeNil()
} else {
yym48 := z.EncBinary()
_ = yym48
if false {
} else {
h.encSliceStorageClass(([]StorageClass)(x.Items), e)
}
}
} else {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("items"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
if x.Items == nil {
r.EncodeNil()
} else {
yym49 := z.EncBinary()
_ = yym49
if false {
} else {
h.encSliceStorageClass(([]StorageClass)(x.Items), e)
}
}
}
if yyr35 || yy2arr35 {
z.EncSendContainerState(codecSelfer_containerArrayEnd1234)
} else {
z.EncSendContainerState(codecSelfer_containerMapEnd1234)
}
}
}
}
func (x *StorageClassList) CodecDecodeSelf(d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
yym50 := z.DecBinary()
_ = yym50
if false {
} else if z.HasExtensions() && z.DecExt(x) {
} else {
yyct51 := r.ContainerType()
if yyct51 == codecSelferValueTypeMap1234 {
yyl51 := r.ReadMapStart()
if yyl51 == 0 {
z.DecSendContainerState(codecSelfer_containerMapEnd1234)
} else {
x.codecDecodeSelfFromMap(yyl51, d)
}
} else if yyct51 == codecSelferValueTypeArray1234 {
yyl51 := r.ReadArrayStart()
if yyl51 == 0 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
} else {
x.codecDecodeSelfFromArray(yyl51, d)
}
} else {
panic(codecSelferOnlyMapOrArrayEncodeToStructErr1234)
}
}
}
func (x *StorageClassList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
var yys52Slc = z.DecScratchBuffer() // default slice to decode into
_ = yys52Slc
var yyhl52 bool = l >= 0
for yyj52 := 0; ; yyj52++ {
if yyhl52 {
if yyj52 >= l {
break
}
} else {
if r.CheckBreak() {
break
}
}
z.DecSendContainerState(codecSelfer_containerMapKey1234)
yys52Slc = r.DecodeBytes(yys52Slc, true, true)
yys52 := string(yys52Slc)
z.DecSendContainerState(codecSelfer_containerMapValue1234)
switch yys52 {
case "kind":
if r.TryDecodeAsNil() {
x.Kind = ""
} else {
x.Kind = string(r.DecodeString())
}
case "apiVersion":
if r.TryDecodeAsNil() {
x.APIVersion = ""
} else {
x.APIVersion = string(r.DecodeString())
}
case "metadata":
if r.TryDecodeAsNil() {
x.ListMeta = pkg1_unversioned.ListMeta{}
} else {
yyv55 := &x.ListMeta
yym56 := z.DecBinary()
_ = yym56
if false {
} else if z.HasExtensions() && z.DecExt(yyv55) {
} else {
z.DecFallback(yyv55, false)
}
}
case "items":
if r.TryDecodeAsNil() {
x.Items = nil
} else {
yyv57 := &x.Items
yym58 := z.DecBinary()
_ = yym58
if false {
} else {
h.decSliceStorageClass((*[]StorageClass)(yyv57), d)
}
}
default:
z.DecStructFieldNotFound(-1, yys52)
} // end switch yys52
} // end for yyj52
z.DecSendContainerState(codecSelfer_containerMapEnd1234)
}
func (x *StorageClassList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
var yyj59 int
var yyb59 bool
var yyhl59 bool = l >= 0
yyj59++
if yyhl59 {
yyb59 = yyj59 > l
} else {
yyb59 = r.CheckBreak()
}
if yyb59 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.Kind = ""
} else {
x.Kind = string(r.DecodeString())
}
yyj59++
if yyhl59 {
yyb59 = yyj59 > l
} else {
yyb59 = r.CheckBreak()
}
if yyb59 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.APIVersion = ""
} else {
x.APIVersion = string(r.DecodeString())
}
yyj59++
if yyhl59 {
yyb59 = yyj59 > l
} else {
yyb59 = r.CheckBreak()
}
if yyb59 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.ListMeta = pkg1_unversioned.ListMeta{}
} else {
yyv62 := &x.ListMeta
yym63 := z.DecBinary()
_ = yym63
if false {
} else if z.HasExtensions() && z.DecExt(yyv62) {
} else {
z.DecFallback(yyv62, false)
}
}
yyj59++
if yyhl59 {
yyb59 = yyj59 > l
} else {
yyb59 = r.CheckBreak()
}
if yyb59 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.Items = nil
} else {
yyv64 := &x.Items
yym65 := z.DecBinary()
_ = yym65
if false {
} else {
h.decSliceStorageClass((*[]StorageClass)(yyv64), d)
}
}
for {
yyj59++
if yyhl59 {
yyb59 = yyj59 > l
} else {
yyb59 = r.CheckBreak()
}
if yyb59 {
break
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
z.DecStructFieldNotFound(yyj59-1, "")
}
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
}
func (x codecSelfer1234) encSliceStorageClass(v []StorageClass, e *codec1978.Encoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperEncoder(e)
_, _, _ = h, z, r
r.EncodeArrayStart(len(v))
for _, yyv66 := range v {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
yy67 := &yyv66
yy67.CodecEncodeSelf(e)
}
z.EncSendContainerState(codecSelfer_containerArrayEnd1234)
}
func (x codecSelfer1234) decSliceStorageClass(v *[]StorageClass, d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
yyv68 := *v
yyh68, yyl68 := z.DecSliceHelperStart()
var yyc68 bool
if yyl68 == 0 {
if yyv68 == nil {
yyv68 = []StorageClass{}
yyc68 = true
} else if len(yyv68) != 0 {
yyv68 = yyv68[:0]
yyc68 = true
}
} else if yyl68 > 0 {
var yyrr68, yyrl68 int
var yyrt68 bool
if yyl68 > cap(yyv68) {
yyrg68 := len(yyv68) > 0
yyv268 := yyv68
yyrl68, yyrt68 = z.DecInferLen(yyl68, z.DecBasicHandle().MaxInitLen, 280)
if yyrt68 {
if yyrl68 <= cap(yyv68) {
yyv68 = yyv68[:yyrl68]
} else {
yyv68 = make([]StorageClass, yyrl68)
}
} else {
yyv68 = make([]StorageClass, yyrl68)
}
yyc68 = true
yyrr68 = len(yyv68)
if yyrg68 {
copy(yyv68, yyv268)
}
} else if yyl68 != len(yyv68) {
yyv68 = yyv68[:yyl68]
yyc68 = true
}
yyj68 := 0
for ; yyj68 < yyrr68; yyj68++ {
yyh68.ElemContainerState(yyj68)
if r.TryDecodeAsNil() {
yyv68[yyj68] = StorageClass{}
} else {
yyv69 := &yyv68[yyj68]
yyv69.CodecDecodeSelf(d)
}
}
if yyrt68 {
for ; yyj68 < yyl68; yyj68++ {
yyv68 = append(yyv68, StorageClass{})
yyh68.ElemContainerState(yyj68)
if r.TryDecodeAsNil() {
yyv68[yyj68] = StorageClass{}
} else {
yyv70 := &yyv68[yyj68]
yyv70.CodecDecodeSelf(d)
}
}
}
} else {
yyj68 := 0
for ; !r.CheckBreak(); yyj68++ {
if yyj68 >= len(yyv68) {
yyv68 = append(yyv68, StorageClass{}) // var yyz68 StorageClass
yyc68 = true
}
yyh68.ElemContainerState(yyj68)
if yyj68 < len(yyv68) {
if r.TryDecodeAsNil() {
yyv68[yyj68] = StorageClass{}
} else {
yyv71 := &yyv68[yyj68]
yyv71.CodecDecodeSelf(d)
}
} else {
z.DecSwallow()
}
}
if yyj68 < len(yyv68) {
yyv68 = yyv68[:yyj68]
yyc68 = true
} else if yyj68 == 0 && yyv68 == nil {
yyv68 = []StorageClass{}
yyc68 = true
}
}
yyh68.End()
if yyc68 {
*v = yyv68
}
}

View File

@ -0,0 +1,55 @@
/*
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1beta1
import (
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/api/v1"
)
// +genclient=true
// +nonNamespaced=true
// StorageClass describes the parameters for a class of storage for
// which PersistentVolumes can be dynamically provisioned.
//
// StorageClasses are non-namespaced; the name of the storage class
// according to etcd is in ObjectMeta.Name.
type StorageClass struct {
unversioned.TypeMeta `json:",inline"`
// Standard object's metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
v1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// Provisioner indicates the type of the provisioner.
Provisioner string `json:"provisioner" protobuf:"bytes,2,opt,name=provisioner"`
// Parameters holds the parameters for the provisioner that should
// create volumes of this storage class.
Parameters map[string]string `json:"parameters,omitempty" protobuf:"bytes,3,rep,name=parameters"`
}
// StorageClassList is a collection of storage classes.
type StorageClassList struct {
unversioned.TypeMeta `json:",inline"`
// Standard list metadata
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
unversioned.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// Items is the list of StorageClasses
Items []StorageClass `json:"items" protobuf:"bytes,2,rep,name=items"`
}

View File

@ -0,0 +1,51 @@
/*
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1beta1
// This file contains a collection of methods that can be used from go-restful to
// generate Swagger API documentation for its models. Please read this PR for more
// information on the implementation: https://github.com/emicklei/go-restful/pull/215
//
// TODOs are ignored from the parser (e.g. TODO(andronat):... || TODO:...) if and only if
// they are on one line! For multiple line or blocks that you want to ignore use ---.
// Any context after a --- is ignored.
//
// Those methods can be generated by using hack/update-generated-swagger-docs.sh
// AUTO-GENERATED FUNCTIONS START HERE
var map_StorageClass = map[string]string{
"": "StorageClass describes the parameters for a class of storage for which PersistentVolumes can be dynamically provisioned.\n\nStorageClasses are non-namespaced; the name of the storage class according to etcd is in ObjectMeta.Name.",
"metadata": "Standard object's metadata. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata",
"provisioner": "Provisioner indicates the type of the provisioner.",
"parameters": "Parameters holds the parameters for the provisioner that should create volumes of this storage class.",
}
func (StorageClass) SwaggerDoc() map[string]string {
return map_StorageClass
}
var map_StorageClassList = map[string]string{
"": "StorageClassList is a collection of storage classes.",
"metadata": "Standard list metadata More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata",
"items": "Items is the list of StorageClasses",
}
func (StorageClassList) SwaggerDoc() map[string]string {
return map_StorageClassList
}
// AUTO-GENERATED FUNCTIONS END HERE

View File

@ -0,0 +1,127 @@
// +build !ignore_autogenerated
/*
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// This file was autogenerated by conversion-gen. Do not edit it manually!
package v1beta1
import (
api "k8s.io/kubernetes/pkg/api"
storage "k8s.io/kubernetes/pkg/apis/storage"
conversion "k8s.io/kubernetes/pkg/conversion"
runtime "k8s.io/kubernetes/pkg/runtime"
)
func init() {
SchemeBuilder.Register(RegisterConversions)
}
// RegisterConversions adds conversion functions to the given scheme.
// Public to allow building arbitrary schemes.
func RegisterConversions(scheme *runtime.Scheme) error {
return scheme.AddGeneratedConversionFuncs(
Convert_v1beta1_StorageClass_To_storage_StorageClass,
Convert_storage_StorageClass_To_v1beta1_StorageClass,
Convert_v1beta1_StorageClassList_To_storage_StorageClassList,
Convert_storage_StorageClassList_To_v1beta1_StorageClassList,
)
}
func autoConvert_v1beta1_StorageClass_To_storage_StorageClass(in *StorageClass, out *storage.StorageClass, s conversion.Scope) error {
if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil {
return err
}
// TODO: Inefficient conversion - can we improve it?
if err := s.Convert(&in.ObjectMeta, &out.ObjectMeta, 0); err != nil {
return err
}
out.Provisioner = in.Provisioner
out.Parameters = in.Parameters
return nil
}
func Convert_v1beta1_StorageClass_To_storage_StorageClass(in *StorageClass, out *storage.StorageClass, s conversion.Scope) error {
return autoConvert_v1beta1_StorageClass_To_storage_StorageClass(in, out, s)
}
func autoConvert_storage_StorageClass_To_v1beta1_StorageClass(in *storage.StorageClass, out *StorageClass, s conversion.Scope) error {
if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil {
return err
}
// TODO: Inefficient conversion - can we improve it?
if err := s.Convert(&in.ObjectMeta, &out.ObjectMeta, 0); err != nil {
return err
}
out.Provisioner = in.Provisioner
out.Parameters = in.Parameters
return nil
}
func Convert_storage_StorageClass_To_v1beta1_StorageClass(in *storage.StorageClass, out *StorageClass, s conversion.Scope) error {
return autoConvert_storage_StorageClass_To_v1beta1_StorageClass(in, out, s)
}
func autoConvert_v1beta1_StorageClassList_To_storage_StorageClassList(in *StorageClassList, out *storage.StorageClassList, s conversion.Scope) error {
if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil {
return err
}
if err := api.Convert_unversioned_ListMeta_To_unversioned_ListMeta(&in.ListMeta, &out.ListMeta, s); err != nil {
return err
}
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]storage.StorageClass, len(*in))
for i := range *in {
if err := Convert_v1beta1_StorageClass_To_storage_StorageClass(&(*in)[i], &(*out)[i], s); err != nil {
return err
}
}
} else {
out.Items = nil
}
return nil
}
func Convert_v1beta1_StorageClassList_To_storage_StorageClassList(in *StorageClassList, out *storage.StorageClassList, s conversion.Scope) error {
return autoConvert_v1beta1_StorageClassList_To_storage_StorageClassList(in, out, s)
}
func autoConvert_storage_StorageClassList_To_v1beta1_StorageClassList(in *storage.StorageClassList, out *StorageClassList, s conversion.Scope) error {
if err := api.Convert_unversioned_TypeMeta_To_unversioned_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil {
return err
}
if err := api.Convert_unversioned_ListMeta_To_unversioned_ListMeta(&in.ListMeta, &out.ListMeta, s); err != nil {
return err
}
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]StorageClass, len(*in))
for i := range *in {
if err := Convert_storage_StorageClass_To_v1beta1_StorageClass(&(*in)[i], &(*out)[i], s); err != nil {
return err
}
}
} else {
out.Items = nil
}
return nil
}
func Convert_storage_StorageClassList_To_v1beta1_StorageClassList(in *storage.StorageClassList, out *StorageClassList, s conversion.Scope) error {
return autoConvert_storage_StorageClassList_To_v1beta1_StorageClassList(in, out, s)
}

View File

@ -0,0 +1,84 @@
// +build !ignore_autogenerated
/*
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// This file was autogenerated by deepcopy-gen. Do not edit it manually!
package v1beta1
import (
v1 "k8s.io/kubernetes/pkg/api/v1"
conversion "k8s.io/kubernetes/pkg/conversion"
runtime "k8s.io/kubernetes/pkg/runtime"
reflect "reflect"
)
func init() {
SchemeBuilder.Register(RegisterDeepCopies)
}
// RegisterDeepCopies adds deep-copy functions to the given scheme. Public
// to allow building arbitrary schemes.
func RegisterDeepCopies(scheme *runtime.Scheme) error {
return scheme.AddGeneratedDeepCopyFuncs(
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1beta1_StorageClass, InType: reflect.TypeOf(&StorageClass{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1beta1_StorageClassList, InType: reflect.TypeOf(&StorageClassList{})},
)
}
func DeepCopy_v1beta1_StorageClass(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*StorageClass)
out := out.(*StorageClass)
out.TypeMeta = in.TypeMeta
if err := v1.DeepCopy_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
out.Provisioner = in.Provisioner
if in.Parameters != nil {
in, out := &in.Parameters, &out.Parameters
*out = make(map[string]string)
for key, val := range *in {
(*out)[key] = val
}
} else {
out.Parameters = nil
}
return nil
}
}
func DeepCopy_v1beta1_StorageClassList(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*StorageClassList)
out := out.(*StorageClassList)
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]StorageClass, len(*in))
for i := range *in {
if err := DeepCopy_v1beta1_StorageClass(&(*in)[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.Items = nil
}
return nil
}
}

View File

@ -0,0 +1,89 @@
/*
Copyright 2015 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package validation
import (
"reflect"
"strings"
apivalidation "k8s.io/kubernetes/pkg/api/validation"
"k8s.io/kubernetes/pkg/apis/storage"
"k8s.io/kubernetes/pkg/util/validation"
"k8s.io/kubernetes/pkg/util/validation/field"
)
// ValidateStorageClass validates a StorageClass.
func ValidateStorageClass(storageClass *storage.StorageClass) field.ErrorList {
allErrs := apivalidation.ValidateObjectMeta(&storageClass.ObjectMeta, false, apivalidation.NameIsDNSSubdomain, field.NewPath("metadata"))
allErrs = append(allErrs, validateProvisioner(storageClass.Provisioner, field.NewPath("provisioner"))...)
allErrs = append(allErrs, validateParameters(storageClass.Parameters, field.NewPath("parameters"))...)
return allErrs
}
// ValidateStorageClassUpdate tests if an update to StorageClass is valid.
func ValidateStorageClassUpdate(storageClass, oldStorageClass *storage.StorageClass) field.ErrorList {
allErrs := apivalidation.ValidateObjectMetaUpdate(&storageClass.ObjectMeta, &oldStorageClass.ObjectMeta, field.NewPath("metadata"))
if !reflect.DeepEqual(oldStorageClass.Parameters, storageClass.Parameters) {
allErrs = append(allErrs, field.Forbidden(field.NewPath("parameters"), "updates to parameters are forbidden."))
}
if strings.Compare(storageClass.Provisioner, oldStorageClass.Provisioner) != 0 {
allErrs = append(allErrs, field.Forbidden(field.NewPath("provisioner"), "updates to provisioner are forbidden."))
}
return allErrs
}
// validateProvisioner tests if provisioner is a valid qualified name.
func validateProvisioner(provisioner string, fldPath *field.Path) field.ErrorList {
allErrs := field.ErrorList{}
if len(provisioner) == 0 {
allErrs = append(allErrs, field.Required(fldPath, provisioner))
}
if len(provisioner) > 0 {
for _, msg := range validation.IsQualifiedName(strings.ToLower(provisioner)) {
allErrs = append(allErrs, field.Invalid(fldPath, provisioner, msg))
}
}
return allErrs
}
const maxProvisionerParameterSize = 256 * (1 << 10) // 256 kB
const maxProvisionerParameterLen = 512
// validateParameters tests that keys are qualified names and that provisionerParameter are < 256kB.
func validateParameters(params map[string]string, fldPath *field.Path) field.ErrorList {
var totalSize int64
allErrs := field.ErrorList{}
if len(params) > maxProvisionerParameterLen {
allErrs = append(allErrs, field.TooLong(fldPath, "Provisioner Parameters exceeded max allowed", maxProvisionerParameterLen))
return allErrs
}
for k, v := range params {
if len(k) < 1 {
allErrs = append(allErrs, field.Invalid(fldPath, k, "field can not be empty."))
}
totalSize += (int64)(len(k)) + (int64)(len(v))
}
if totalSize > maxProvisionerParameterSize {
allErrs = append(allErrs, field.TooLong(fldPath, "", maxProvisionerParameterSize))
}
return allErrs
}

View File

@ -0,0 +1,102 @@
/*
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package validation
import (
"fmt"
"testing"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/storage"
)
func TestValidateStorageClass(t *testing.T) {
successCases := []storage.StorageClass{
{
// empty parameters
ObjectMeta: api.ObjectMeta{Name: "foo"},
Provisioner: "kubernetes.io/foo-provisioner",
Parameters: map[string]string{},
},
{
// nil parameters
ObjectMeta: api.ObjectMeta{Name: "foo"},
Provisioner: "kubernetes.io/foo-provisioner",
},
{
// some parameters
ObjectMeta: api.ObjectMeta{Name: "foo"},
Provisioner: "kubernetes.io/foo-provisioner",
Parameters: map[string]string{
"kubernetes.io/foo-parameter": "free/form/string",
"foo-parameter": "free-form-string",
"foo-parameter2": "{\"embedded\": \"json\", \"with\": {\"structures\":\"inside\"}}",
},
},
}
// Success cases are expected to pass validation.
for k, v := range successCases {
if errs := ValidateStorageClass(&v); len(errs) != 0 {
t.Errorf("Expected success for %d, got %v", k, errs)
}
}
// generate a map longer than maxProvisionerParameterSize
longParameters := make(map[string]string)
totalSize := 0
for totalSize < maxProvisionerParameterSize {
k := fmt.Sprintf("param/%d", totalSize)
v := fmt.Sprintf("value-%d", totalSize)
longParameters[k] = v
totalSize = totalSize + len(k) + len(v)
}
errorCases := map[string]storage.StorageClass{
"namespace is present": {
ObjectMeta: api.ObjectMeta{Name: "foo", Namespace: "bar"},
Provisioner: "kubernetes.io/foo-provisioner",
},
"invalid provisioner": {
ObjectMeta: api.ObjectMeta{Name: "foo"},
Provisioner: "kubernetes.io/invalid/provisioner",
},
"invalid empty parameter name": {
ObjectMeta: api.ObjectMeta{Name: "foo"},
Provisioner: "kubernetes.io/foo",
Parameters: map[string]string{
"": "value",
},
},
"provisioner: Required value": {
ObjectMeta: api.ObjectMeta{Name: "foo"},
Provisioner: "",
},
"too long parameters": {
ObjectMeta: api.ObjectMeta{Name: "foo"},
Provisioner: "kubernetes.io/foo",
Parameters: longParameters,
},
}
// Error cases are not expected to pass validation.
for testName, storageClass := range errorCases {
if errs := ValidateStorageClass(&storageClass); len(errs) == 0 {
t.Errorf("Expected failure for test: %s", testName)
}
}
}

View File

@ -0,0 +1,84 @@
// +build !ignore_autogenerated
/*
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// This file was autogenerated by deepcopy-gen. Do not edit it manually!
package storage
import (
api "k8s.io/kubernetes/pkg/api"
conversion "k8s.io/kubernetes/pkg/conversion"
runtime "k8s.io/kubernetes/pkg/runtime"
reflect "reflect"
)
func init() {
SchemeBuilder.Register(RegisterDeepCopies)
}
// RegisterDeepCopies adds deep-copy functions to the given scheme. Public
// to allow building arbitrary schemes.
func RegisterDeepCopies(scheme *runtime.Scheme) error {
return scheme.AddGeneratedDeepCopyFuncs(
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_storage_StorageClass, InType: reflect.TypeOf(&StorageClass{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_storage_StorageClassList, InType: reflect.TypeOf(&StorageClassList{})},
)
}
func DeepCopy_storage_StorageClass(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*StorageClass)
out := out.(*StorageClass)
out.TypeMeta = in.TypeMeta
if err := api.DeepCopy_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
out.Provisioner = in.Provisioner
if in.Parameters != nil {
in, out := &in.Parameters, &out.Parameters
*out = make(map[string]string)
for key, val := range *in {
(*out)[key] = val
}
} else {
out.Parameters = nil
}
return nil
}
}
func DeepCopy_storage_StorageClassList(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*StorageClassList)
out := out.(*StorageClassList)
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]StorageClass, len(*in))
for i := range *in {
if err := DeepCopy_storage_StorageClass(&(*in)[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.Items = nil
}
return nil
}
}

View File

@ -26,6 +26,7 @@ import (
unversionedcore "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/core/unversioned"
unversionedextensions "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/extensions/unversioned"
unversionedrbac "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/rbac/unversioned"
unversionedstorage "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/storage/unversioned"
restclient "k8s.io/kubernetes/pkg/client/restclient"
discovery "k8s.io/kubernetes/pkg/client/typed/discovery"
"k8s.io/kubernetes/pkg/util/flowcontrol"
@ -41,6 +42,7 @@ type Interface interface {
Certificates() unversionedcertificates.CertificatesInterface
Extensions() unversionedextensions.ExtensionsInterface
Rbac() unversionedrbac.RbacInterface
Storage() unversionedstorage.StorageInterface
}
// Clientset contains the clients for groups. Each group has exactly one
@ -55,6 +57,7 @@ type Clientset struct {
*unversionedcertificates.CertificatesClient
*unversionedextensions.ExtensionsClient
*unversionedrbac.RbacClient
*unversionedstorage.StorageClient
}
// Core retrieves the CoreClient
@ -121,6 +124,14 @@ func (c *Clientset) Rbac() unversionedrbac.RbacInterface {
return c.RbacClient
}
// Storage retrieves the StorageClient
func (c *Clientset) Storage() unversionedstorage.StorageInterface {
if c == nil {
return nil
}
return c.StorageClient
}
// Discovery retrieves the DiscoveryClient
func (c *Clientset) Discovery() discovery.DiscoveryInterface {
return c.DiscoveryClient
@ -166,6 +177,10 @@ func NewForConfig(c *restclient.Config) (*Clientset, error) {
if err != nil {
return nil, err
}
clientset.StorageClient, err = unversionedstorage.NewForConfig(&configShallowCopy)
if err != nil {
return nil, err
}
clientset.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy)
if err != nil {
@ -187,6 +202,7 @@ func NewForConfigOrDie(c *restclient.Config) *Clientset {
clientset.CertificatesClient = unversionedcertificates.NewForConfigOrDie(c)
clientset.ExtensionsClient = unversionedextensions.NewForConfigOrDie(c)
clientset.RbacClient = unversionedrbac.NewForConfigOrDie(c)
clientset.StorageClient = unversionedstorage.NewForConfigOrDie(c)
clientset.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
return &clientset
@ -203,6 +219,7 @@ func New(c *restclient.RESTClient) *Clientset {
clientset.CertificatesClient = unversionedcertificates.New(c)
clientset.ExtensionsClient = unversionedextensions.New(c)
clientset.RbacClient = unversionedrbac.New(c)
clientset.StorageClient = unversionedstorage.New(c)
clientset.DiscoveryClient = discovery.NewDiscoveryClient(c)
return &clientset

View File

@ -36,6 +36,8 @@ import (
fakeunversionedextensions "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/extensions/unversioned/fake"
unversionedrbac "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/rbac/unversioned"
fakeunversionedrbac "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/rbac/unversioned/fake"
unversionedstorage "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/storage/unversioned"
fakeunversionedstorage "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/storage/unversioned/fake"
"k8s.io/kubernetes/pkg/client/testing/core"
"k8s.io/kubernetes/pkg/client/typed/discovery"
fakediscovery "k8s.io/kubernetes/pkg/client/typed/discovery/fake"
@ -115,3 +117,8 @@ func (c *Clientset) Extensions() unversionedextensions.ExtensionsInterface {
func (c *Clientset) Rbac() unversionedrbac.RbacInterface {
return &fakeunversionedrbac.FakeRbac{Fake: &c.Fake}
}
// Storage retrieves the StorageClient
func (c *Clientset) Storage() unversionedstorage.StorageInterface {
return &fakeunversionedstorage.FakeStorage{Fake: &c.Fake}
}

View File

@ -32,6 +32,7 @@ import (
_ "k8s.io/kubernetes/pkg/apis/extensions/install"
_ "k8s.io/kubernetes/pkg/apis/policy/install"
_ "k8s.io/kubernetes/pkg/apis/rbac/install"
_ "k8s.io/kubernetes/pkg/apis/storage/install"
)
func init() {

View File

@ -30,7 +30,6 @@ type ExtensionsInterface interface {
PodSecurityPoliciesGetter
ReplicaSetsGetter
ScalesGetter
StorageClassesGetter
ThirdPartyResourcesGetter
}
@ -63,10 +62,6 @@ func (c *ExtensionsClient) Scales(namespace string) ScaleInterface {
return newScales(c, namespace)
}
func (c *ExtensionsClient) StorageClasses() StorageClassInterface {
return newStorageClasses(c)
}
func (c *ExtensionsClient) ThirdPartyResources() ThirdPartyResourceInterface {
return newThirdPartyResources(c)
}

View File

@ -50,10 +50,6 @@ func (c *FakeExtensions) Scales(namespace string) unversioned.ScaleInterface {
return &FakeScales{c, namespace}
}
func (c *FakeExtensions) StorageClasses() unversioned.StorageClassInterface {
return &FakeStorageClasses{c}
}
func (c *FakeExtensions) ThirdPartyResources() unversioned.ThirdPartyResourceInterface {
return &FakeThirdPartyResources{c}
}

View File

@ -1,109 +0,0 @@
/*
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package fake
import (
api "k8s.io/kubernetes/pkg/api"
unversioned "k8s.io/kubernetes/pkg/api/unversioned"
extensions "k8s.io/kubernetes/pkg/apis/extensions"
core "k8s.io/kubernetes/pkg/client/testing/core"
labels "k8s.io/kubernetes/pkg/labels"
watch "k8s.io/kubernetes/pkg/watch"
)
// FakeStorageClasses implements StorageClassInterface
type FakeStorageClasses struct {
Fake *FakeExtensions
}
var storageclassesResource = unversioned.GroupVersionResource{Group: "extensions", Version: "", Resource: "storageclasses"}
func (c *FakeStorageClasses) Create(storageClass *extensions.StorageClass) (result *extensions.StorageClass, err error) {
obj, err := c.Fake.
Invokes(core.NewRootCreateAction(storageclassesResource, storageClass), &extensions.StorageClass{})
if obj == nil {
return nil, err
}
return obj.(*extensions.StorageClass), err
}
func (c *FakeStorageClasses) Update(storageClass *extensions.StorageClass) (result *extensions.StorageClass, err error) {
obj, err := c.Fake.
Invokes(core.NewRootUpdateAction(storageclassesResource, storageClass), &extensions.StorageClass{})
if obj == nil {
return nil, err
}
return obj.(*extensions.StorageClass), err
}
func (c *FakeStorageClasses) Delete(name string, options *api.DeleteOptions) error {
_, err := c.Fake.
Invokes(core.NewRootDeleteAction(storageclassesResource, name), &extensions.StorageClass{})
return err
}
func (c *FakeStorageClasses) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error {
action := core.NewRootDeleteCollectionAction(storageclassesResource, listOptions)
_, err := c.Fake.Invokes(action, &extensions.StorageClassList{})
return err
}
func (c *FakeStorageClasses) Get(name string) (result *extensions.StorageClass, err error) {
obj, err := c.Fake.
Invokes(core.NewRootGetAction(storageclassesResource, name), &extensions.StorageClass{})
if obj == nil {
return nil, err
}
return obj.(*extensions.StorageClass), err
}
func (c *FakeStorageClasses) List(opts api.ListOptions) (result *extensions.StorageClassList, err error) {
obj, err := c.Fake.
Invokes(core.NewRootListAction(storageclassesResource, opts), &extensions.StorageClassList{})
if obj == nil {
return nil, err
}
label := opts.LabelSelector
if label == nil {
label = labels.Everything()
}
list := &extensions.StorageClassList{}
for _, item := range obj.(*extensions.StorageClassList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested storageClasses.
func (c *FakeStorageClasses) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(core.NewRootWatchAction(storageclassesResource, opts))
}
// Patch applies the patch and returns the patched storageClass.
func (c *FakeStorageClasses) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *extensions.StorageClass, err error) {
obj, err := c.Fake.
Invokes(core.NewRootPatchSubresourceAction(storageclassesResource, name, data, subresources...), &extensions.StorageClass{})
if obj == nil {
return nil, err
}
return obj.(*extensions.StorageClass), err
}

View File

@ -24,6 +24,4 @@ type PodSecurityPolicyExpansion interface{}
type ReplicaSetExpansion interface{}
type StorageClassExpansion interface{}
type ThirdPartyResourceExpansion interface{}

View File

@ -1,141 +0,0 @@
/*
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package unversioned
import (
api "k8s.io/kubernetes/pkg/api"
extensions "k8s.io/kubernetes/pkg/apis/extensions"
watch "k8s.io/kubernetes/pkg/watch"
)
// StorageClassesGetter has a method to return a StorageClassInterface.
// A group's client should implement this interface.
type StorageClassesGetter interface {
StorageClasses() StorageClassInterface
}
// StorageClassInterface has methods to work with StorageClass resources.
type StorageClassInterface interface {
Create(*extensions.StorageClass) (*extensions.StorageClass, error)
Update(*extensions.StorageClass) (*extensions.StorageClass, error)
Delete(name string, options *api.DeleteOptions) error
DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error
Get(name string) (*extensions.StorageClass, error)
List(opts api.ListOptions) (*extensions.StorageClassList, error)
Watch(opts api.ListOptions) (watch.Interface, error)
Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *extensions.StorageClass, err error)
StorageClassExpansion
}
// storageClasses implements StorageClassInterface
type storageClasses struct {
client *ExtensionsClient
}
// newStorageClasses returns a StorageClasses
func newStorageClasses(c *ExtensionsClient) *storageClasses {
return &storageClasses{
client: c,
}
}
// Create takes the representation of a storageClass and creates it. Returns the server's representation of the storageClass, and an error, if there is any.
func (c *storageClasses) Create(storageClass *extensions.StorageClass) (result *extensions.StorageClass, err error) {
result = &extensions.StorageClass{}
err = c.client.Post().
Resource("storageclasses").
Body(storageClass).
Do().
Into(result)
return
}
// Update takes the representation of a storageClass and updates it. Returns the server's representation of the storageClass, and an error, if there is any.
func (c *storageClasses) Update(storageClass *extensions.StorageClass) (result *extensions.StorageClass, err error) {
result = &extensions.StorageClass{}
err = c.client.Put().
Resource("storageclasses").
Name(storageClass.Name).
Body(storageClass).
Do().
Into(result)
return
}
// Delete takes name of the storageClass and deletes it. Returns an error if one occurs.
func (c *storageClasses) Delete(name string, options *api.DeleteOptions) error {
return c.client.Delete().
Resource("storageclasses").
Name(name).
Body(options).
Do().
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *storageClasses) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error {
return c.client.Delete().
Resource("storageclasses").
VersionedParams(&listOptions, api.ParameterCodec).
Body(options).
Do().
Error()
}
// Get takes name of the storageClass, and returns the corresponding storageClass object, and an error if there is any.
func (c *storageClasses) Get(name string) (result *extensions.StorageClass, err error) {
result = &extensions.StorageClass{}
err = c.client.Get().
Resource("storageclasses").
Name(name).
Do().
Into(result)
return
}
// List takes label and field selectors, and returns the list of StorageClasses that match those selectors.
func (c *storageClasses) List(opts api.ListOptions) (result *extensions.StorageClassList, err error) {
result = &extensions.StorageClassList{}
err = c.client.Get().
Resource("storageclasses").
VersionedParams(&opts, api.ParameterCodec).
Do().
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested storageClasses.
func (c *storageClasses) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.client.Get().
Prefix("watch").
Resource("storageclasses").
VersionedParams(&opts, api.ParameterCodec).
Watch()
}
// Patch applies the patch and returns the patched storageClass.
func (c *storageClasses) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *extensions.StorageClass, err error) {
result = &extensions.StorageClass{}
err = c.client.Patch(pt).
Resource("storageclasses").
SubResource(subresources...).
Name(name).
Body(data).
Do().
Into(result)
return
}

View File

@ -0,0 +1,20 @@
/*
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// This package is generated by client-gen with the default arguments.
// This package has the automatically generated typed clients.
package unversioned

View File

@ -0,0 +1,20 @@
/*
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// This package is generated by client-gen with the default arguments.
// Package fake has the automatically generated clients.
package fake

View File

@ -0,0 +1,37 @@
/*
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package fake
import (
unversioned "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/storage/unversioned"
restclient "k8s.io/kubernetes/pkg/client/restclient"
core "k8s.io/kubernetes/pkg/client/testing/core"
)
type FakeStorage struct {
*core.Fake
}
func (c *FakeStorage) StorageClasses() unversioned.StorageClassInterface {
return &FakeStorageClasses{c}
}
// GetRESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *FakeStorage) GetRESTClient() *restclient.RESTClient {
return nil
}

View File

@ -19,7 +19,7 @@ package fake
import (
api "k8s.io/kubernetes/pkg/api"
unversioned "k8s.io/kubernetes/pkg/api/unversioned"
v1beta1 "k8s.io/kubernetes/pkg/apis/extensions/v1beta1"
storage "k8s.io/kubernetes/pkg/apis/storage"
core "k8s.io/kubernetes/pkg/client/testing/core"
labels "k8s.io/kubernetes/pkg/labels"
watch "k8s.io/kubernetes/pkg/watch"
@ -27,54 +27,54 @@ import (
// FakeStorageClasses implements StorageClassInterface
type FakeStorageClasses struct {
Fake *FakeExtensions
Fake *FakeStorage
}
var storageclassesResource = unversioned.GroupVersionResource{Group: "extensions", Version: "v1beta1", Resource: "storageclasses"}
var storageclassesResource = unversioned.GroupVersionResource{Group: "storage.k8s.io", Version: "", Resource: "storageclasses"}
func (c *FakeStorageClasses) Create(storageClass *v1beta1.StorageClass) (result *v1beta1.StorageClass, err error) {
func (c *FakeStorageClasses) Create(storageClass *storage.StorageClass) (result *storage.StorageClass, err error) {
obj, err := c.Fake.
Invokes(core.NewRootCreateAction(storageclassesResource, storageClass), &v1beta1.StorageClass{})
Invokes(core.NewRootCreateAction(storageclassesResource, storageClass), &storage.StorageClass{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.StorageClass), err
return obj.(*storage.StorageClass), err
}
func (c *FakeStorageClasses) Update(storageClass *v1beta1.StorageClass) (result *v1beta1.StorageClass, err error) {
func (c *FakeStorageClasses) Update(storageClass *storage.StorageClass) (result *storage.StorageClass, err error) {
obj, err := c.Fake.
Invokes(core.NewRootUpdateAction(storageclassesResource, storageClass), &v1beta1.StorageClass{})
Invokes(core.NewRootUpdateAction(storageclassesResource, storageClass), &storage.StorageClass{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.StorageClass), err
return obj.(*storage.StorageClass), err
}
func (c *FakeStorageClasses) Delete(name string, options *api.DeleteOptions) error {
_, err := c.Fake.
Invokes(core.NewRootDeleteAction(storageclassesResource, name), &v1beta1.StorageClass{})
Invokes(core.NewRootDeleteAction(storageclassesResource, name), &storage.StorageClass{})
return err
}
func (c *FakeStorageClasses) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error {
action := core.NewRootDeleteCollectionAction(storageclassesResource, listOptions)
_, err := c.Fake.Invokes(action, &v1beta1.StorageClassList{})
_, err := c.Fake.Invokes(action, &storage.StorageClassList{})
return err
}
func (c *FakeStorageClasses) Get(name string) (result *v1beta1.StorageClass, err error) {
func (c *FakeStorageClasses) Get(name string) (result *storage.StorageClass, err error) {
obj, err := c.Fake.
Invokes(core.NewRootGetAction(storageclassesResource, name), &v1beta1.StorageClass{})
Invokes(core.NewRootGetAction(storageclassesResource, name), &storage.StorageClass{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.StorageClass), err
return obj.(*storage.StorageClass), err
}
func (c *FakeStorageClasses) List(opts api.ListOptions) (result *v1beta1.StorageClassList, err error) {
func (c *FakeStorageClasses) List(opts api.ListOptions) (result *storage.StorageClassList, err error) {
obj, err := c.Fake.
Invokes(core.NewRootListAction(storageclassesResource, opts), &v1beta1.StorageClassList{})
Invokes(core.NewRootListAction(storageclassesResource, opts), &storage.StorageClassList{})
if obj == nil {
return nil, err
}
@ -83,8 +83,8 @@ func (c *FakeStorageClasses) List(opts api.ListOptions) (result *v1beta1.Storage
if label == nil {
label = labels.Everything()
}
list := &v1beta1.StorageClassList{}
for _, item := range obj.(*v1beta1.StorageClassList).Items {
list := &storage.StorageClassList{}
for _, item := range obj.(*storage.StorageClassList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
@ -99,11 +99,11 @@ func (c *FakeStorageClasses) Watch(opts api.ListOptions) (watch.Interface, error
}
// Patch applies the patch and returns the patched storageClass.
func (c *FakeStorageClasses) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1beta1.StorageClass, err error) {
func (c *FakeStorageClasses) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *storage.StorageClass, err error) {
obj, err := c.Fake.
Invokes(core.NewRootPatchSubresourceAction(storageclassesResource, name, data, subresources...), &v1beta1.StorageClass{})
Invokes(core.NewRootPatchSubresourceAction(storageclassesResource, name, data, subresources...), &storage.StorageClass{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.StorageClass), err
return obj.(*storage.StorageClass), err
}

View File

@ -0,0 +1,19 @@
/*
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package unversioned
type StorageClassExpansion interface{}

View File

@ -0,0 +1,101 @@
/*
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package unversioned
import (
api "k8s.io/kubernetes/pkg/api"
registered "k8s.io/kubernetes/pkg/apimachinery/registered"
restclient "k8s.io/kubernetes/pkg/client/restclient"
)
type StorageInterface interface {
GetRESTClient() *restclient.RESTClient
StorageClassesGetter
}
// StorageClient is used to interact with features provided by the Storage group.
type StorageClient struct {
*restclient.RESTClient
}
func (c *StorageClient) StorageClasses() StorageClassInterface {
return newStorageClasses(c)
}
// NewForConfig creates a new StorageClient for the given config.
func NewForConfig(c *restclient.Config) (*StorageClient, error) {
config := *c
if err := setConfigDefaults(&config); err != nil {
return nil, err
}
client, err := restclient.RESTClientFor(&config)
if err != nil {
return nil, err
}
return &StorageClient{client}, nil
}
// NewForConfigOrDie creates a new StorageClient for the given config and
// panics if there is an error in the config.
func NewForConfigOrDie(c *restclient.Config) *StorageClient {
client, err := NewForConfig(c)
if err != nil {
panic(err)
}
return client
}
// New creates a new StorageClient for the given RESTClient.
func New(c *restclient.RESTClient) *StorageClient {
return &StorageClient{c}
}
func setConfigDefaults(config *restclient.Config) error {
// if storage group is not registered, return an error
g, err := registered.Group("storage.k8s.io")
if err != nil {
return err
}
config.APIPath = "/apis"
if config.UserAgent == "" {
config.UserAgent = restclient.DefaultKubernetesUserAgent()
}
// TODO: Unconditionally set the config.Version, until we fix the config.
//if config.Version == "" {
copyGroupVersion := g.GroupVersion
config.GroupVersion = &copyGroupVersion
//}
config.NegotiatedSerializer = api.Codecs
if config.QPS == 0 {
config.QPS = 5
}
if config.Burst == 0 {
config.Burst = 10
}
return nil
}
// GetRESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *StorageClient) GetRESTClient() *restclient.RESTClient {
if c == nil {
return nil
}
return c.RESTClient
}

View File

@ -14,11 +14,11 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package v1beta1
package unversioned
import (
api "k8s.io/kubernetes/pkg/api"
v1beta1 "k8s.io/kubernetes/pkg/apis/extensions/v1beta1"
storage "k8s.io/kubernetes/pkg/apis/storage"
watch "k8s.io/kubernetes/pkg/watch"
)
@ -30,32 +30,32 @@ type StorageClassesGetter interface {
// StorageClassInterface has methods to work with StorageClass resources.
type StorageClassInterface interface {
Create(*v1beta1.StorageClass) (*v1beta1.StorageClass, error)
Update(*v1beta1.StorageClass) (*v1beta1.StorageClass, error)
Create(*storage.StorageClass) (*storage.StorageClass, error)
Update(*storage.StorageClass) (*storage.StorageClass, error)
Delete(name string, options *api.DeleteOptions) error
DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error
Get(name string) (*v1beta1.StorageClass, error)
List(opts api.ListOptions) (*v1beta1.StorageClassList, error)
Get(name string) (*storage.StorageClass, error)
List(opts api.ListOptions) (*storage.StorageClassList, error)
Watch(opts api.ListOptions) (watch.Interface, error)
Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1beta1.StorageClass, err error)
Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *storage.StorageClass, err error)
StorageClassExpansion
}
// storageClasses implements StorageClassInterface
type storageClasses struct {
client *ExtensionsClient
client *StorageClient
}
// newStorageClasses returns a StorageClasses
func newStorageClasses(c *ExtensionsClient) *storageClasses {
func newStorageClasses(c *StorageClient) *storageClasses {
return &storageClasses{
client: c,
}
}
// Create takes the representation of a storageClass and creates it. Returns the server's representation of the storageClass, and an error, if there is any.
func (c *storageClasses) Create(storageClass *v1beta1.StorageClass) (result *v1beta1.StorageClass, err error) {
result = &v1beta1.StorageClass{}
func (c *storageClasses) Create(storageClass *storage.StorageClass) (result *storage.StorageClass, err error) {
result = &storage.StorageClass{}
err = c.client.Post().
Resource("storageclasses").
Body(storageClass).
@ -65,8 +65,8 @@ func (c *storageClasses) Create(storageClass *v1beta1.StorageClass) (result *v1b
}
// Update takes the representation of a storageClass and updates it. Returns the server's representation of the storageClass, and an error, if there is any.
func (c *storageClasses) Update(storageClass *v1beta1.StorageClass) (result *v1beta1.StorageClass, err error) {
result = &v1beta1.StorageClass{}
func (c *storageClasses) Update(storageClass *storage.StorageClass) (result *storage.StorageClass, err error) {
result = &storage.StorageClass{}
err = c.client.Put().
Resource("storageclasses").
Name(storageClass.Name).
@ -97,8 +97,8 @@ func (c *storageClasses) DeleteCollection(options *api.DeleteOptions, listOption
}
// Get takes name of the storageClass, and returns the corresponding storageClass object, and an error if there is any.
func (c *storageClasses) Get(name string) (result *v1beta1.StorageClass, err error) {
result = &v1beta1.StorageClass{}
func (c *storageClasses) Get(name string) (result *storage.StorageClass, err error) {
result = &storage.StorageClass{}
err = c.client.Get().
Resource("storageclasses").
Name(name).
@ -108,8 +108,8 @@ func (c *storageClasses) Get(name string) (result *v1beta1.StorageClass, err err
}
// List takes label and field selectors, and returns the list of StorageClasses that match those selectors.
func (c *storageClasses) List(opts api.ListOptions) (result *v1beta1.StorageClassList, err error) {
result = &v1beta1.StorageClassList{}
func (c *storageClasses) List(opts api.ListOptions) (result *storage.StorageClassList, err error) {
result = &storage.StorageClassList{}
err = c.client.Get().
Resource("storageclasses").
VersionedParams(&opts, api.ParameterCodec).
@ -128,8 +128,8 @@ func (c *storageClasses) Watch(opts api.ListOptions) (watch.Interface, error) {
}
// Patch applies the patch and returns the patched storageClass.
func (c *storageClasses) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v1beta1.StorageClass, err error) {
result = &v1beta1.StorageClass{}
func (c *storageClasses) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *storage.StorageClass, err error) {
result = &storage.StorageClass{}
err = c.client.Patch(pt).
Resource("storageclasses").
SubResource(subresources...).

View File

@ -27,6 +27,7 @@ import (
_ "k8s.io/kubernetes/pkg/apis/batch/install"
_ "k8s.io/kubernetes/pkg/apis/extensions/install"
_ "k8s.io/kubernetes/pkg/apis/policy/install"
_ "k8s.io/kubernetes/pkg/apis/storage/install"
)
func init() {

View File

@ -32,7 +32,6 @@ type ExtensionsInterface interface {
PodSecurityPoliciesGetter
ReplicaSetsGetter
ScalesGetter
StorageClassesGetter
ThirdPartyResourcesGetter
}
@ -69,10 +68,6 @@ func (c *ExtensionsClient) Scales(namespace string) ScaleInterface {
return newScales(c, namespace)
}
func (c *ExtensionsClient) StorageClasses() StorageClassInterface {
return newStorageClasses(c)
}
func (c *ExtensionsClient) ThirdPartyResources() ThirdPartyResourceInterface {
return newThirdPartyResources(c)
}

View File

@ -54,10 +54,6 @@ func (c *FakeExtensions) Scales(namespace string) v1beta1.ScaleInterface {
return &FakeScales{c, namespace}
}
func (c *FakeExtensions) StorageClasses() v1beta1.StorageClassInterface {
return &FakeStorageClasses{c}
}
func (c *FakeExtensions) ThirdPartyResources() v1beta1.ThirdPartyResourceInterface {
return &FakeThirdPartyResources{c}
}

View File

@ -26,6 +26,4 @@ type PodSecurityPolicyExpansion interface{}
type ReplicaSetExpansion interface{}
type StorageClassExpansion interface{}
type ThirdPartyResourceExpansion interface{}

View File

@ -24,6 +24,7 @@ import (
unversionedbatch "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/batch/unversioned"
unversionedcore "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/core/unversioned"
unversionedextensions "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/extensions/unversioned"
unversionedstorage "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/storage/unversioned"
"k8s.io/kubernetes/pkg/client/typed/discovery"
"k8s.io/kubernetes/pkg/client/unversioned"
)
@ -68,6 +69,11 @@ func FromUnversionedClient(c *unversioned.Client) *internalclientset.Clientset {
} else {
clientset.DiscoveryClient = discovery.NewDiscoveryClient(nil)
}
if c != nil && c.StorageClient != nil {
clientset.StorageClient = unversionedstorage.New(c.StorageClient.RESTClient)
} else {
clientset.StorageClient = unversionedstorage.New(nil)
}
return &clientset
}

View File

@ -53,6 +53,7 @@ type Interface interface {
Rbac() RbacInterface
Discovery() discovery.DiscoveryInterface
Certificates() CertificatesInterface
Storage() StorageInterface
}
func (c *Client) ReplicationControllers(namespace string) ReplicationControllerInterface {
@ -131,6 +132,7 @@ type Client struct {
*RbacClient
*discovery.DiscoveryClient
*CertificatesClient
*StorageClient
}
// IsTimeout tests if this is a timeout error in the underlying transport.
@ -194,3 +196,7 @@ func (c *Client) Discovery() discovery.DiscoveryInterface {
func (c *Client) Certificates() CertificatesInterface {
return c.CertificatesClient
}
func (c *Client) Storage() StorageInterface {
return c.StorageClient
}

View File

@ -35,7 +35,6 @@ type ExtensionsInterface interface {
ThirdPartyResourceNamespacer
ReplicaSetsNamespacer
PodSecurityPoliciesInterface
StorageClassesInterface
}
// ExtensionsClient is used to interact with experimental Kubernetes features.
@ -81,10 +80,6 @@ func (c *ExtensionsClient) ReplicaSets(namespace string) ReplicaSetInterface {
return newReplicaSets(c, namespace)
}
func (c *ExtensionsClient) StorageClasses() StorageClassInterface {
return newStorageClasses(c)
}
// NewExtensions creates a new ExtensionsClient for the given config. This client
// provides access to experimental Kubernetes features.
// Features of Extensions group are not supported and may be changed or removed in

View File

@ -31,6 +31,7 @@ import (
"k8s.io/kubernetes/pkg/apis/extensions"
"k8s.io/kubernetes/pkg/apis/policy"
"k8s.io/kubernetes/pkg/apis/rbac"
"k8s.io/kubernetes/pkg/apis/storage"
"k8s.io/kubernetes/pkg/client/restclient"
"k8s.io/kubernetes/pkg/client/typed/discovery"
"k8s.io/kubernetes/pkg/util/sets"
@ -143,6 +144,15 @@ func New(c *restclient.Config) (*Client, error) {
}
}
var storageClient *StorageClient
if registered.IsRegistered(storage.GroupName) {
storageConfig := *c
storageClient, err = NewStorage(&storageConfig)
if err != nil {
return nil, err
}
}
return &Client{
RESTClient: client,
AppsClient: appsClient,
@ -155,6 +165,7 @@ func New(c *restclient.Config) (*Client, error) {
ExtensionsClient: extensionsClient,
PolicyClient: policyClient,
RbacClient: rbacClient,
StorageClient: storageClient,
}, nil
}

View File

@ -32,6 +32,7 @@ import (
_ "k8s.io/kubernetes/pkg/apis/extensions/install"
_ "k8s.io/kubernetes/pkg/apis/policy/install"
_ "k8s.io/kubernetes/pkg/apis/rbac/install"
_ "k8s.io/kubernetes/pkg/apis/storage/install"
)
func init() {

View File

@ -0,0 +1,77 @@
/*
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package unversioned
import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apimachinery/registered"
"k8s.io/kubernetes/pkg/apis/storage"
"k8s.io/kubernetes/pkg/client/restclient"
)
type StorageInterface interface {
StorageClassesInterface
}
// StorageClient is used to interact with Kubernetes storage features.
type StorageClient struct {
*restclient.RESTClient
}
func (c *StorageClient) StorageClasses() StorageClassInterface {
return newStorageClasses(c)
}
func NewStorage(c *restclient.Config) (*StorageClient, error) {
config := *c
if err := setStorageDefaults(&config); err != nil {
return nil, err
}
client, err := restclient.RESTClientFor(&config)
if err != nil {
return nil, err
}
return &StorageClient{client}, nil
}
func NewStorageOrDie(c *restclient.Config) *StorageClient {
client, err := NewStorage(c)
if err != nil {
panic(err)
}
return client
}
func setStorageDefaults(config *restclient.Config) error {
// if storage group is not registered, return an error
g, err := registered.Group(storage.GroupName)
if err != nil {
return err
}
config.APIPath = defaultAPIPath
if config.UserAgent == "" {
config.UserAgent = restclient.DefaultKubernetesUserAgent()
}
// TODO: Unconditionally set the config.Version, until we fix the config.
//if config.Version == "" {
copyGroupVersion := g.GroupVersion
config.GroupVersion = &copyGroupVersion
//}
config.NegotiatedSerializer = api.Codecs
return nil
}

View File

@ -18,7 +18,7 @@ package unversioned
import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/extensions"
"k8s.io/kubernetes/pkg/apis/storage"
"k8s.io/kubernetes/pkg/watch"
)
@ -28,25 +28,25 @@ type StorageClassesInterface interface {
// StorageClassInterface has methods to work with StorageClass resources.
type StorageClassInterface interface {
List(opts api.ListOptions) (*extensions.StorageClassList, error)
Get(name string) (*extensions.StorageClass, error)
Create(storageClass *extensions.StorageClass) (*extensions.StorageClass, error)
Update(storageClass *extensions.StorageClass) (*extensions.StorageClass, error)
List(opts api.ListOptions) (*storage.StorageClassList, error)
Get(name string) (*storage.StorageClass, error)
Create(storageClass *storage.StorageClass) (*storage.StorageClass, error)
Update(storageClass *storage.StorageClass) (*storage.StorageClass, error)
Delete(name string) error
Watch(opts api.ListOptions) (watch.Interface, error)
}
// storageClasses implements StorageClassInterface
type storageClasses struct {
client *ExtensionsClient
client *StorageClient
}
func newStorageClasses(c *ExtensionsClient) *storageClasses {
func newStorageClasses(c *StorageClient) *storageClasses {
return &storageClasses{c}
}
func (c *storageClasses) List(opts api.ListOptions) (result *extensions.StorageClassList, err error) {
result = &extensions.StorageClassList{}
func (c *storageClasses) List(opts api.ListOptions) (result *storage.StorageClassList, err error) {
result = &storage.StorageClassList{}
err = c.client.Get().
Resource("storageclasses").
VersionedParams(&opts, api.ParameterCodec).
@ -56,20 +56,20 @@ func (c *storageClasses) List(opts api.ListOptions) (result *extensions.StorageC
return result, err
}
func (c *storageClasses) Get(name string) (result *extensions.StorageClass, err error) {
result = &extensions.StorageClass{}
func (c *storageClasses) Get(name string) (result *storage.StorageClass, err error) {
result = &storage.StorageClass{}
err = c.client.Get().Resource("storageClasses").Name(name).Do().Into(result)
return
}
func (c *storageClasses) Create(storageClass *extensions.StorageClass) (result *extensions.StorageClass, err error) {
result = &extensions.StorageClass{}
func (c *storageClasses) Create(storageClass *storage.StorageClass) (result *storage.StorageClass, err error) {
result = &storage.StorageClass{}
err = c.client.Post().Resource("storageClasses").Body(storageClass).Do().Into(result)
return
}
func (c *storageClasses) Update(storageClass *extensions.StorageClass) (result *extensions.StorageClass, err error) {
result = &extensions.StorageClass{}
func (c *storageClasses) Update(storageClass *storage.StorageClass) (result *storage.StorageClass, err error) {
result = &storage.StorageClass{}
err = c.client.Put().Resource("storageClasses").Name(storageClass.Name).Body(storageClass).Do().Into(result)
return
}

View File

@ -21,7 +21,7 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/apis/extensions"
"k8s.io/kubernetes/pkg/apis/storage"
"k8s.io/kubernetes/pkg/client/unversioned/testclient/simple"
)
@ -33,11 +33,11 @@ func TestListStorageClasses(t *testing.T) {
c := &simple.Client{
Request: simple.Request{
Method: "GET",
Path: testapi.Extensions.ResourcePath(getStorageClassResourceName(), "", ""),
Path: testapi.Storage.ResourcePath(getStorageClassResourceName(), "", ""),
},
Response: simple.Response{StatusCode: 200,
Body: &extensions.StorageClassList{
Items: []extensions.StorageClass{
Body: &storage.StorageClassList{
Items: []storage.StorageClass{
{
ObjectMeta: api.ObjectMeta{
Name: "foo",
@ -52,16 +52,16 @@ func TestListStorageClasses(t *testing.T) {
},
},
}
receivedSCList, err := c.Setup(t).Extensions().StorageClasses().List(api.ListOptions{})
receivedSCList, err := c.Setup(t).Storage().StorageClasses().List(api.ListOptions{})
c.Validate(t, receivedSCList, err)
}
func TestGetStorageClass(t *testing.T) {
c := &simple.Client{
Request: simple.Request{Method: "GET", Path: testapi.Extensions.ResourcePath(getStorageClassResourceName(), "", "foo"), Query: simple.BuildQueryValues(nil)},
Request: simple.Request{Method: "GET", Path: testapi.Storage.ResourcePath(getStorageClassResourceName(), "", "foo"), Query: simple.BuildQueryValues(nil)},
Response: simple.Response{
StatusCode: 200,
Body: &extensions.StorageClass{
Body: &storage.StorageClass{
ObjectMeta: api.ObjectMeta{
Name: "foo",
Labels: map[string]string{
@ -73,13 +73,13 @@ func TestGetStorageClass(t *testing.T) {
},
},
}
receivedSC, err := c.Setup(t).Extensions().StorageClasses().Get("foo")
receivedSC, err := c.Setup(t).Storage().StorageClasses().Get("foo")
c.Validate(t, receivedSC, err)
}
func TestGetStorageClassWithNoName(t *testing.T) {
c := &simple.Client{Error: true}
receivedSC, err := c.Setup(t).Extensions().StorageClasses().Get("")
receivedSC, err := c.Setup(t).Storage().StorageClasses().Get("")
if (err != nil) && (err.Error() != simple.NameRequiredError) {
t.Errorf("Expected error: %v, but got %v", simple.NameRequiredError, err)
}
@ -88,15 +88,15 @@ func TestGetStorageClassWithNoName(t *testing.T) {
}
func TestUpdateStorageClass(t *testing.T) {
requestSC := &extensions.StorageClass{
requestSC := &storage.StorageClass{
ObjectMeta: api.ObjectMeta{Name: "foo", ResourceVersion: "1"},
Provisioner: "aaa",
}
c := &simple.Client{
Request: simple.Request{Method: "PUT", Path: testapi.Extensions.ResourcePath(getStorageClassResourceName(), "", "foo"), Query: simple.BuildQueryValues(nil)},
Request: simple.Request{Method: "PUT", Path: testapi.Storage.ResourcePath(getStorageClassResourceName(), "", "foo"), Query: simple.BuildQueryValues(nil)},
Response: simple.Response{
StatusCode: 200,
Body: &extensions.StorageClass{
Body: &storage.StorageClass{
ObjectMeta: api.ObjectMeta{
Name: "foo",
Labels: map[string]string{
@ -108,29 +108,29 @@ func TestUpdateStorageClass(t *testing.T) {
},
},
}
receivedSC, err := c.Setup(t).Extensions().StorageClasses().Update(requestSC)
receivedSC, err := c.Setup(t).Storage().StorageClasses().Update(requestSC)
c.Validate(t, receivedSC, err)
}
func TestDeleteStorageClass(t *testing.T) {
c := &simple.Client{
Request: simple.Request{Method: "DELETE", Path: testapi.Extensions.ResourcePath(getStorageClassResourceName(), "", "foo"), Query: simple.BuildQueryValues(nil)},
Request: simple.Request{Method: "DELETE", Path: testapi.Storage.ResourcePath(getStorageClassResourceName(), "", "foo"), Query: simple.BuildQueryValues(nil)},
Response: simple.Response{StatusCode: 200},
}
err := c.Setup(t).Extensions().StorageClasses().Delete("foo")
err := c.Setup(t).Storage().StorageClasses().Delete("foo")
c.Validate(t, nil, err)
}
func TestCreateStorageClass(t *testing.T) {
requestSC := &extensions.StorageClass{
requestSC := &storage.StorageClass{
ObjectMeta: api.ObjectMeta{Name: "foo"},
Provisioner: "aaa",
}
c := &simple.Client{
Request: simple.Request{Method: "POST", Path: testapi.Extensions.ResourcePath(getStorageClassResourceName(), "", ""), Body: requestSC, Query: simple.BuildQueryValues(nil)},
Request: simple.Request{Method: "POST", Path: testapi.Storage.ResourcePath(getStorageClassResourceName(), "", ""), Body: requestSC, Query: simple.BuildQueryValues(nil)},
Response: simple.Response{
StatusCode: 200,
Body: &extensions.StorageClass{
Body: &storage.StorageClass{
ObjectMeta: api.ObjectMeta{
Name: "foo",
Labels: map[string]string{
@ -142,6 +142,6 @@ func TestCreateStorageClass(t *testing.T) {
},
},
}
receivedSC, err := c.Setup(t).Extensions().StorageClasses().Create(requestSC)
receivedSC, err := c.Setup(t).Storage().StorageClasses().Create(requestSC)
c.Validate(t, receivedSC, err)
}

View File

@ -18,7 +18,7 @@ package testclient
import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/extensions"
"k8s.io/kubernetes/pkg/apis/storage"
kclientlib "k8s.io/kubernetes/pkg/client/unversioned"
"k8s.io/kubernetes/pkg/watch"
)
@ -26,46 +26,46 @@ import (
// FakeStorageClasses implements StorageClassInterface. Meant to be embedded into a struct to get a default
// implementation. This makes faking out just the method you want to test easier.
type FakeStorageClasses struct {
Fake *FakeExperimental
Fake *FakeStorage
}
// Ensure statically that FakeStorageClasses implements StorageClassInterface.
var _ kclientlib.StorageClassInterface = &FakeStorageClasses{}
func (c *FakeStorageClasses) Get(name string) (*extensions.StorageClass, error) {
obj, err := c.Fake.Invokes(NewGetAction("storageclasses", "", name), &extensions.StorageClass{})
func (c *FakeStorageClasses) Get(name string) (*storage.StorageClass, error) {
obj, err := c.Fake.Invokes(NewGetAction("storageclasses", "", name), &storage.StorageClass{})
if obj == nil {
return nil, err
}
return obj.(*extensions.StorageClass), err
return obj.(*storage.StorageClass), err
}
func (c *FakeStorageClasses) List(opts api.ListOptions) (*extensions.StorageClassList, error) {
obj, err := c.Fake.Invokes(NewListAction("storageclasses", "", opts), &extensions.StorageClassList{})
func (c *FakeStorageClasses) List(opts api.ListOptions) (*storage.StorageClassList, error) {
obj, err := c.Fake.Invokes(NewListAction("storageclasses", "", opts), &storage.StorageClassList{})
if obj == nil {
return nil, err
}
return obj.(*extensions.StorageClassList), err
return obj.(*storage.StorageClassList), err
}
func (c *FakeStorageClasses) Create(np *extensions.StorageClass) (*extensions.StorageClass, error) {
obj, err := c.Fake.Invokes(NewCreateAction("storageclasses", "", np), &extensions.StorageClass{})
func (c *FakeStorageClasses) Create(np *storage.StorageClass) (*storage.StorageClass, error) {
obj, err := c.Fake.Invokes(NewCreateAction("storageclasses", "", np), &storage.StorageClass{})
if obj == nil {
return nil, err
}
return obj.(*extensions.StorageClass), err
return obj.(*storage.StorageClass), err
}
func (c *FakeStorageClasses) Update(np *extensions.StorageClass) (*extensions.StorageClass, error) {
obj, err := c.Fake.Invokes(NewUpdateAction("storageclasses", "", np), &extensions.StorageClass{})
func (c *FakeStorageClasses) Update(np *storage.StorageClass) (*storage.StorageClass, error) {
obj, err := c.Fake.Invokes(NewUpdateAction("storageclasses", "", np), &storage.StorageClass{})
if obj == nil {
return nil, err
}
return obj.(*extensions.StorageClass), err
return obj.(*storage.StorageClass), err
}
func (c *FakeStorageClasses) Delete(name string) error {
_, err := c.Fake.Invokes(NewDeleteAction("storageclasses", "", name), &extensions.StorageClass{})
_, err := c.Fake.Invokes(NewDeleteAction("storageclasses", "", name), &storage.StorageClass{})
return err
}

View File

@ -105,6 +105,10 @@ func (c *Client) Setup(t *testing.T) *Client {
Host: c.server.URL,
ContentConfig: restclient.ContentConfig{GroupVersion: testapi.Rbac.GroupVersion()},
})
c.StorageClient = client.NewStorageOrDie(&restclient.Config{
Host: c.server.URL,
ContentConfig: restclient.ContentConfig{GroupVersion: testapi.Storage.GroupVersion()},
})
c.Clientset = clientset.NewForConfigOrDie(&restclient.Config{Host: c.server.URL})
}

View File

@ -317,6 +317,10 @@ func (c *Fake) Rbac() client.RbacInterface {
return &FakeRbac{Fake: c}
}
func (c *Fake) Storage() client.StorageInterface {
return &FakeStorage{Fake: c}
}
func (c *Fake) Authentication() client.AuthenticationInterface {
return &FakeAuthentication{Fake: c}
}
@ -444,10 +448,6 @@ func (c *FakeExperimental) NetworkPolicies(namespace string) client.NetworkPolic
return &FakeNetworkPolicies{Fake: c, Namespace: namespace}
}
func (c *FakeExperimental) StorageClasses() client.StorageClassInterface {
return &FakeStorageClasses{Fake: c}
}
func NewSimpleFakeRbac(objects ...runtime.Object) *FakeRbac {
return &FakeRbac{Fake: NewSimpleFake(objects...)}
}
@ -472,6 +472,18 @@ func (c *FakeRbac) ClusterRoleBindings() client.ClusterRoleBindingInterface {
return &FakeClusterRoleBindings{Fake: c}
}
func NewSimpleFakeStorage(objects ...runtime.Object) *FakeStorage {
return &FakeStorage{Fake: NewSimpleFake(objects...)}
}
type FakeStorage struct {
*Fake
}
func (c *FakeStorage) StorageClasses() client.StorageClassInterface {
return &FakeStorageClasses{Fake: c}
}
type FakeDiscovery struct {
*Fake
}

View File

@ -20,7 +20,7 @@ import (
"testing"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/extensions"
"k8s.io/kubernetes/pkg/apis/storage"
)
// Test single call to syncClaim and syncVolume methods.
@ -503,7 +503,7 @@ func TestSync(t *testing.T) {
noevents, noerrors, testSyncClaim,
},
}
runSyncTests(t, tests, []*extensions.StorageClass{})
runSyncTests(t, tests, []*storage.StorageClass{})
}
// Test multiple calls to syncClaim/syncVolume and periodic sync of all
@ -550,5 +550,5 @@ func TestMultiSync(t *testing.T) {
},
}
runMultisyncTests(t, tests, []*extensions.StorageClass{}, "")
runMultisyncTests(t, tests, []*storage.StorageClass{}, "")
}

View File

@ -23,7 +23,7 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/apis/extensions"
"k8s.io/kubernetes/pkg/apis/storage"
"k8s.io/kubernetes/pkg/client/cache"
clientset "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
"k8s.io/kubernetes/pkg/client/record"
@ -1366,7 +1366,7 @@ func (ctrl *PersistentVolumeController) scheduleOperation(operationName string,
}
}
func (ctrl *PersistentVolumeController) findProvisionablePlugin(claim *api.PersistentVolumeClaim) (vol.ProvisionableVolumePlugin, *extensions.StorageClass, error) {
func (ctrl *PersistentVolumeController) findProvisionablePlugin(claim *api.PersistentVolumeClaim) (vol.ProvisionableVolumePlugin, *storage.StorageClass, error) {
// TODO: remove this alpha behavior in 1.5
alpha := hasAnnotation(claim.ObjectMeta, annAlphaClass)
beta := hasAnnotation(claim.ObjectMeta, annClass)
@ -1391,7 +1391,7 @@ func (ctrl *PersistentVolumeController) findProvisionablePlugin(claim *api.Persi
if !found {
return nil, nil, fmt.Errorf("StorageClass %q not found", claimClass)
}
class, ok := classObj.(*extensions.StorageClass)
class, ok := classObj.(*storage.StorageClass)
if !ok {
return nil, nil, fmt.Errorf("Cannot convert object to StorageClass: %+v", classObj)
}
@ -1407,13 +1407,13 @@ func (ctrl *PersistentVolumeController) findProvisionablePlugin(claim *api.Persi
// findAlphaProvisionablePlugin returns a volume plugin compatible with
// Kubernetes 1.3.
// TODO: remove in Kubernetes 1.5
func (ctrl *PersistentVolumeController) findAlphaProvisionablePlugin() (vol.ProvisionableVolumePlugin, *extensions.StorageClass, error) {
func (ctrl *PersistentVolumeController) findAlphaProvisionablePlugin() (vol.ProvisionableVolumePlugin, *storage.StorageClass, error) {
if ctrl.alphaProvisioner == nil {
return nil, nil, fmt.Errorf("cannot find volume plugin for alpha provisioning")
}
// Return a dummy StorageClass instance with no parameters
storageClass := &extensions.StorageClass{
storageClass := &storage.StorageClass{
TypeMeta: unversioned.TypeMeta{
Kind: "StorageClass",
},

View File

@ -24,7 +24,7 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/errors"
"k8s.io/kubernetes/pkg/api/meta"
"k8s.io/kubernetes/pkg/apis/extensions"
"k8s.io/kubernetes/pkg/apis/storage"
"k8s.io/kubernetes/pkg/client/cache"
clientset "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
unversioned_core "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/core/unversioned"
@ -111,10 +111,10 @@ func NewPersistentVolumeController(
if classSource == nil {
classSource = &cache.ListWatch{
ListFunc: func(options api.ListOptions) (runtime.Object, error) {
return kubeClient.Extensions().StorageClasses().List(options)
return kubeClient.Storage().StorageClasses().List(options)
},
WatchFunc: func(options api.ListOptions) (watch.Interface, error) {
return kubeClient.Extensions().StorageClasses().Watch(options)
return kubeClient.Storage().StorageClasses().Watch(options)
},
}
}
@ -147,7 +147,7 @@ func NewPersistentVolumeController(
controller.classes = cache.NewStore(framework.DeletionHandlingMetaNamespaceKeyFunc)
controller.classReflector = cache.NewReflector(
classSource,
&extensions.StorageClass{},
&storage.StorageClass{},
controller.classes,
syncPeriod,
)

View File

@ -21,7 +21,7 @@ import (
"testing"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/extensions"
"k8s.io/kubernetes/pkg/apis/storage"
)
// Test single call to syncVolume, expecting recycling to happen.
@ -134,7 +134,7 @@ func TestDeleteSync(t *testing.T) {
wrapTestWithReclaimCalls(operationDelete, []error{nil}, testSyncVolume),
},
}
runSyncTests(t, tests, []*extensions.StorageClass{})
runSyncTests(t, tests, []*storage.StorageClass{})
}
// Test multiple calls to syncClaim/syncVolume and periodic sync of all
@ -166,5 +166,5 @@ func TestDeleteMultiSync(t *testing.T) {
},
}
runMultisyncTests(t, tests, []*extensions.StorageClass{}, "")
runMultisyncTests(t, tests, []*storage.StorageClass{}, "")
}

View File

@ -33,7 +33,7 @@ import (
"k8s.io/kubernetes/pkg/api/resource"
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/apis/extensions"
"k8s.io/kubernetes/pkg/apis/storage"
"k8s.io/kubernetes/pkg/client/cache"
clientset "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/fake"
@ -905,7 +905,7 @@ func evaluateTestResults(ctrl *PersistentVolumeController, reactor *volumeReacto
// 2. Call the tested function (syncClaim/syncVolume) via
// controllerTest.testCall *once*.
// 3. Compare resulting volumes and claims with expected volumes and claims.
func runSyncTests(t *testing.T, tests []controllerTest, storageClasses []*extensions.StorageClass) {
func runSyncTests(t *testing.T, tests []controllerTest, storageClasses []*storage.StorageClass) {
for _, test := range tests {
glog.V(4).Infof("starting test %q", test.name)
@ -961,7 +961,7 @@ func runSyncTests(t *testing.T, tests []controllerTest, storageClasses []*extens
// 5. When 3. does not do any changes, finish the tests and compare final set
// of volumes/claims with expected claims/volumes and report differences.
// Some limit of calls in enforced to prevent endless loops.
func runMultisyncTests(t *testing.T, tests []controllerTest, storageClasses []*extensions.StorageClass, defaultStorageClass string) {
func runMultisyncTests(t *testing.T, tests []controllerTest, storageClasses []*storage.StorageClass, defaultStorageClass string) {
for _, test := range tests {
glog.V(4).Infof("starting multisync test %q", test.name)

View File

@ -22,7 +22,7 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/apis/extensions"
"k8s.io/kubernetes/pkg/apis/storage"
)
var class1Parameters = map[string]string{
@ -31,7 +31,7 @@ var class1Parameters = map[string]string{
var class2Parameters = map[string]string{
"param2": "value2",
}
var storageClasses = []*extensions.StorageClass{
var storageClasses = []*storage.StorageClass{
{
TypeMeta: unversioned.TypeMeta{
Kind: "StorageClass",
@ -345,7 +345,7 @@ func TestAlphaProvisionSync(t *testing.T) {
noevents, noerrors, wrapTestWithProvisionCalls([]provisionCall{provisionAlphaSuccess}, testSyncClaim),
},
}
runSyncTests(t, tests, []*extensions.StorageClass{})
runSyncTests(t, tests, []*storage.StorageClass{})
}
// Test multiple calls to syncClaim/syncVolume and periodic sync of all

View File

@ -21,7 +21,7 @@ import (
"testing"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/extensions"
"k8s.io/kubernetes/pkg/apis/storage"
)
// Test single call to syncVolume, expecting recycling to happen.
@ -161,7 +161,7 @@ func TestRecycleSync(t *testing.T) {
[]string{"Warning VolumeUnknownReclaimPolicy"}, noerrors, testSyncVolume,
},
}
runSyncTests(t, tests, []*extensions.StorageClass{})
runSyncTests(t, tests, []*storage.StorageClass{})
}
// Test multiple calls to syncClaim/syncVolume and periodic sync of all
@ -193,5 +193,5 @@ func TestRecycleMultiSync(t *testing.T) {
},
}
runMultisyncTests(t, tests, []*extensions.StorageClass{}, "")
runMultisyncTests(t, tests, []*storage.StorageClass{}, "")
}

View File

@ -53,6 +53,7 @@ import (
"k8s.io/kubernetes/pkg/apis/extensions"
"k8s.io/kubernetes/pkg/apis/policy"
"k8s.io/kubernetes/pkg/apis/rbac"
"k8s.io/kubernetes/pkg/apis/storage"
"k8s.io/kubernetes/pkg/client/restclient"
"k8s.io/kubernetes/pkg/client/typed/discovery"
"k8s.io/kubernetes/pkg/client/typed/dynamic"
@ -1151,6 +1152,11 @@ func (c *clientSwaggerSchema) ValidateBytes(data []byte) error {
return errors.New("unable to validate: no rbac client")
}
return getSchemaAndValidate(c.c.RbacClient.RESTClient, data, "apis/", gvk.GroupVersion().String(), c.cacheDir, c)
case storage.GroupName:
if c.c.StorageClient == nil {
return errors.New("unable to validate: no storage client")
}
return getSchemaAndValidate(c.c.StorageClient.RESTClient, data, "apis/", gvk.GroupVersion().String(), c.cacheDir, c)
}
if registered.IsThirdPartyAPIGroupVersion(gvk.GroupVersion()) {
// Don't attempt to validate third party objects

View File

@ -42,6 +42,7 @@ import (
"k8s.io/kubernetes/pkg/apis/certificates"
"k8s.io/kubernetes/pkg/apis/extensions"
"k8s.io/kubernetes/pkg/apis/rbac"
"k8s.io/kubernetes/pkg/apis/storage"
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/runtime"
utilerrors "k8s.io/kubernetes/pkg/util/errors"
@ -2068,7 +2069,7 @@ func printNetworkPolicyList(list *extensions.NetworkPolicyList, w io.Writer, opt
return nil
}
func printStorageClass(sc *extensions.StorageClass, w io.Writer, options PrintOptions) error {
func printStorageClass(sc *storage.StorageClass, w io.Writer, options PrintOptions) error {
name := sc.Name
provtype := sc.Provisioner
@ -2085,7 +2086,7 @@ func printStorageClass(sc *extensions.StorageClass, w io.Writer, options PrintOp
return nil
}
func printStorageClassList(scList *extensions.StorageClassList, w io.Writer, options PrintOptions) error {
func printStorageClassList(scList *storage.StorageClassList, w io.Writer, options PrintOptions) error {
for _, sc := range scList.Items {
if err := printStorageClass(&sc, w, options); err != nil {
return err

View File

@ -33,6 +33,7 @@ import (
_ "k8s.io/kubernetes/pkg/apis/imagepolicy/install"
_ "k8s.io/kubernetes/pkg/apis/policy/install"
_ "k8s.io/kubernetes/pkg/apis/rbac/install"
_ "k8s.io/kubernetes/pkg/apis/storage/install"
)
func init() {

View File

@ -49,6 +49,8 @@ import (
policyapiv1alpha1 "k8s.io/kubernetes/pkg/apis/policy/v1alpha1"
"k8s.io/kubernetes/pkg/apis/rbac"
rbacapi "k8s.io/kubernetes/pkg/apis/rbac/v1alpha1"
"k8s.io/kubernetes/pkg/apis/storage"
storageapiv1beta1 "k8s.io/kubernetes/pkg/apis/storage/v1beta1"
"k8s.io/kubernetes/pkg/apiserver"
apiservermetrics "k8s.io/kubernetes/pkg/apiserver/metrics"
"k8s.io/kubernetes/pkg/genericapiserver"
@ -205,6 +207,7 @@ func New(c *Config) (*Master, error) {
}
c.RESTStorageProviders[policy.GroupName] = PolicyRESTStorageProvider{}
c.RESTStorageProviders[rbac.GroupName] = RBACRESTStorageProvider{AuthorizerRBACSuperUser: c.AuthorizerRBACSuperUser}
c.RESTStorageProviders[storage.GroupName] = StorageRESTStorageProvider{}
c.RESTStorageProviders[authenticationv1beta1.GroupName] = AuthenticationRESTStorageProvider{Authenticator: c.Authenticator}
c.RESTStorageProviders[authorization.GroupName] = AuthorizationRESTStorageProvider{Authorizer: c.Authorizer}
m.InstallAPIs(c)
@ -840,6 +843,7 @@ func DefaultAPIResourceConfigSource() *genericapiserver.ResourceConfig {
appsapi.SchemeGroupVersion,
policyapiv1alpha1.SchemeGroupVersion,
rbacapi.SchemeGroupVersion,
storageapiv1beta1.SchemeGroupVersion,
certificatesapiv1alpha1.SchemeGroupVersion,
authorizationapiv1beta1.SchemeGroupVersion,
)
@ -854,7 +858,6 @@ func DefaultAPIResourceConfigSource() *genericapiserver.ResourceConfig {
extensionsapiv1beta1.SchemeGroupVersion.WithResource("networkpolicies"),
extensionsapiv1beta1.SchemeGroupVersion.WithResource("replicasets"),
extensionsapiv1beta1.SchemeGroupVersion.WithResource("thirdpartyresources"),
extensionsapiv1beta1.SchemeGroupVersion.WithResource("storageclasses"),
)
return ret

View File

@ -35,7 +35,6 @@ import (
networkpolicyetcd "k8s.io/kubernetes/pkg/registry/networkpolicy/etcd"
pspetcd "k8s.io/kubernetes/pkg/registry/podsecuritypolicy/etcd"
replicasetetcd "k8s.io/kubernetes/pkg/registry/replicaset/etcd"
storageclassetcd "k8s.io/kubernetes/pkg/registry/storageclass/etcd"
thirdpartyresourceetcd "k8s.io/kubernetes/pkg/registry/thirdpartyresource/etcd"
"k8s.io/kubernetes/pkg/util/wait"
)
@ -124,10 +123,6 @@ func (p ExtensionsRESTStorageProvider) v1beta1Storage(apiResourceConfigSource ge
networkExtensionsStorage := networkpolicyetcd.NewREST(restOptionsGetter(extensions.Resource("networkpolicies")))
storage["networkpolicies"] = networkExtensionsStorage
}
if apiResourceConfigSource.ResourceEnabled(version.WithResource("storageclasses")) {
storageClassStorage := storageclassetcd.NewREST(restOptionsGetter(extensions.Resource("storageclasses")))
storage["storageclasses"] = storageClassStorage
}
return storage
}

View File

@ -0,0 +1,54 @@
/*
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package master
import (
"k8s.io/kubernetes/pkg/api/rest"
storageapi "k8s.io/kubernetes/pkg/apis/storage"
storageapiv1beta1 "k8s.io/kubernetes/pkg/apis/storage/v1beta1"
"k8s.io/kubernetes/pkg/genericapiserver"
storageclassetcd "k8s.io/kubernetes/pkg/registry/storageclass/etcd"
)
type StorageRESTStorageProvider struct {
}
var _ RESTStorageProvider = &StorageRESTStorageProvider{}
func (p StorageRESTStorageProvider) NewRESTStorage(apiResourceConfigSource genericapiserver.APIResourceConfigSource, restOptionsGetter RESTOptionsGetter) (genericapiserver.APIGroupInfo, bool) {
apiGroupInfo := genericapiserver.NewDefaultAPIGroupInfo(storageapi.GroupName)
if apiResourceConfigSource.AnyResourcesForVersionEnabled(storageapiv1beta1.SchemeGroupVersion) {
apiGroupInfo.VersionedResourcesStorageMap[storageapiv1beta1.SchemeGroupVersion.Version] = p.v1beta1Storage(apiResourceConfigSource, restOptionsGetter)
apiGroupInfo.GroupMeta.GroupVersion = storageapiv1beta1.SchemeGroupVersion
}
return apiGroupInfo, true
}
func (p StorageRESTStorageProvider) v1beta1Storage(apiResourceConfigSource genericapiserver.APIResourceConfigSource, restOptionsGetter RESTOptionsGetter) map[string]rest.Storage {
version := storageapiv1beta1.SchemeGroupVersion
storage := map[string]rest.Storage{}
if apiResourceConfigSource.ResourceEnabled(version.WithResource("storageclasses")) {
storageClassStorage := storageclassetcd.NewREST(restOptionsGetter(storageapi.Resource("storageclasses")))
storage["storageclasses"] = storageClassStorage
}
return storage
}

View File

@ -18,7 +18,7 @@ package etcd
import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/extensions"
storageapi "k8s.io/kubernetes/pkg/apis/storage"
"k8s.io/kubernetes/pkg/registry/cachesize"
"k8s.io/kubernetes/pkg/registry/generic"
"k8s.io/kubernetes/pkg/registry/generic/registry"
@ -35,11 +35,11 @@ type REST struct {
func NewREST(opts generic.RESTOptions) *REST {
prefix := "/" + opts.ResourcePrefix
newListFunc := func() runtime.Object { return &extensions.StorageClassList{} }
newListFunc := func() runtime.Object { return &storageapi.StorageClassList{} }
storageInterface, _ := opts.Decorator(
opts.StorageConfig,
cachesize.GetWatchCacheSizeByResource(cachesize.StorageClasses),
&extensions.StorageClass{},
&storageapi.StorageClass{},
prefix,
storageclass.Strategy,
newListFunc,
@ -47,7 +47,7 @@ func NewREST(opts generic.RESTOptions) *REST {
)
store := &registry.Store{
NewFunc: func() runtime.Object { return &extensions.StorageClass{} },
NewFunc: func() runtime.Object { return &storageapi.StorageClass{} },
NewListFunc: newListFunc,
KeyRootFunc: func(ctx api.Context) string {
return prefix
@ -56,10 +56,10 @@ func NewREST(opts generic.RESTOptions) *REST {
return registry.NoNamespaceKeyFunc(ctx, prefix, name)
},
ObjectNameFunc: func(obj runtime.Object) (string, error) {
return obj.(*extensions.StorageClass).Name, nil
return obj.(*storageapi.StorageClass).Name, nil
},
PredicateFunc: storageclass.MatchStorageClasses,
QualifiedResource: api.Resource("storageclasses"),
QualifiedResource: storageapi.Resource("storageclasses"),
DeleteCollectionWorkers: opts.DeleteCollectionWorkers,
CreateStrategy: storageclass.Strategy,

View File

@ -20,7 +20,7 @@ import (
"testing"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/extensions"
storageapi "k8s.io/kubernetes/pkg/apis/storage"
"k8s.io/kubernetes/pkg/fields"
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/registry/generic"
@ -30,14 +30,14 @@ import (
)
func newStorage(t *testing.T) (*REST, *etcdtesting.EtcdTestServer) {
etcdStorage, server := registrytest.NewEtcdStorage(t, extensions.GroupName)
etcdStorage, server := registrytest.NewEtcdStorage(t, storageapi.GroupName)
restOptions := generic.RESTOptions{StorageConfig: etcdStorage, Decorator: generic.UndecoratedStorage, DeleteCollectionWorkers: 1}
storageClassStorage := NewREST(restOptions)
return storageClassStorage, server
}
func validNewStorageClass(name string) *extensions.StorageClass {
return &extensions.StorageClass{
func validNewStorageClass(name string) *storageapi.StorageClass {
return &storageapi.StorageClass{
ObjectMeta: api.ObjectMeta{
Name: name,
},
@ -48,7 +48,7 @@ func validNewStorageClass(name string) *extensions.StorageClass {
}
}
func validChangedStorageClass() *extensions.StorageClass {
func validChangedStorageClass() *storageapi.StorageClass {
return validNewStorageClass("foo")
}
@ -62,7 +62,7 @@ func TestCreate(t *testing.T) {
// valid
storageClass,
// invalid
&extensions.StorageClass{
&storageapi.StorageClass{
ObjectMeta: api.ObjectMeta{Name: "*BadName!"},
},
)
@ -77,13 +77,13 @@ func TestUpdate(t *testing.T) {
validNewStorageClass("foo"),
// updateFunc
func(obj runtime.Object) runtime.Object {
object := obj.(*extensions.StorageClass)
object := obj.(*storageapi.StorageClass)
object.Parameters = map[string]string{"foo": "bar"}
return object
},
//invalid update
func(obj runtime.Object) runtime.Object {
object := obj.(*extensions.StorageClass)
object := obj.(*storageapi.StorageClass)
object.Parameters = map[string]string{"faz": "bar"}
return object
},

View File

@ -20,8 +20,8 @@ import (
"fmt"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/extensions"
"k8s.io/kubernetes/pkg/apis/extensions/validation"
"k8s.io/kubernetes/pkg/apis/storage"
"k8s.io/kubernetes/pkg/apis/storage/validation"
"k8s.io/kubernetes/pkg/fields"
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/registry/generic"
@ -45,11 +45,11 @@ func (storageClassStrategy) NamespaceScoped() bool {
// ResetBeforeCreate clears the Status field which is not allowed to be set by end users on creation.
func (storageClassStrategy) PrepareForCreate(ctx api.Context, obj runtime.Object) {
_ = obj.(*extensions.StorageClass)
_ = obj.(*storage.StorageClass)
}
func (storageClassStrategy) Validate(ctx api.Context, obj runtime.Object) field.ErrorList {
storageClass := obj.(*extensions.StorageClass)
storageClass := obj.(*storage.StorageClass)
return validation.ValidateStorageClass(storageClass)
}
@ -63,13 +63,13 @@ func (storageClassStrategy) AllowCreateOnUpdate() bool {
// PrepareForUpdate sets the Status fields which is not allowed to be set by an end user updating a PV
func (storageClassStrategy) PrepareForUpdate(ctx api.Context, obj, old runtime.Object) {
_ = obj.(*extensions.StorageClass)
_ = old.(*extensions.StorageClass)
_ = obj.(*storage.StorageClass)
_ = old.(*storage.StorageClass)
}
func (storageClassStrategy) ValidateUpdate(ctx api.Context, obj, old runtime.Object) field.ErrorList {
errorList := validation.ValidateStorageClass(obj.(*extensions.StorageClass))
return append(errorList, validation.ValidateStorageClassUpdate(obj.(*extensions.StorageClass), old.(*extensions.StorageClass))...)
errorList := validation.ValidateStorageClass(obj.(*storage.StorageClass))
return append(errorList, validation.ValidateStorageClassUpdate(obj.(*storage.StorageClass), old.(*storage.StorageClass))...)
}
func (storageClassStrategy) AllowUnconditionalUpdate() bool {
@ -82,7 +82,7 @@ func MatchStorageClasses(label labels.Selector, field fields.Selector) *generic.
Label: label,
Field: field,
GetAttrs: func(obj runtime.Object) (labels.Set, fields.Set, error) {
cls, ok := obj.(*extensions.StorageClass)
cls, ok := obj.(*storage.StorageClass)
if !ok {
return nil, nil, fmt.Errorf("given object is not of type StorageClass")
}
@ -93,6 +93,6 @@ func MatchStorageClasses(label labels.Selector, field fields.Selector) *generic.
}
// StorageClassToSelectableFields returns a label set that represents the object
func StorageClassToSelectableFields(storageClass *extensions.StorageClass) fields.Set {
func StorageClassToSelectableFields(storageClass *storage.StorageClass) fields.Set {
return generic.ObjectMetaFieldsSet(&storageClass.ObjectMeta, false)
}

View File

@ -20,7 +20,7 @@ import (
"testing"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/extensions"
"k8s.io/kubernetes/pkg/apis/storage"
)
func TestStorageClassStrategy(t *testing.T) {
@ -32,7 +32,7 @@ func TestStorageClassStrategy(t *testing.T) {
t.Errorf("StorageClass should not allow create on update")
}
storageClass := &extensions.StorageClass{
storageClass := &storage.StorageClass{
ObjectMeta: api.ObjectMeta{
Name: "valid-class",
},
@ -49,7 +49,7 @@ func TestStorageClassStrategy(t *testing.T) {
t.Errorf("unexpected error validating %v", errs)
}
newStorageClass := &extensions.StorageClass{
newStorageClass := &storage.StorageClass{
ObjectMeta: api.ObjectMeta{
Name: "valid-class-2",
ResourceVersion: "4",

View File

@ -25,7 +25,7 @@ import (
admission "k8s.io/kubernetes/pkg/admission"
api "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/errors"
"k8s.io/kubernetes/pkg/apis/extensions"
"k8s.io/kubernetes/pkg/apis/storage"
"k8s.io/kubernetes/pkg/client/cache"
clientset "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
"k8s.io/kubernetes/pkg/runtime"
@ -62,13 +62,13 @@ func newPlugin(kclient clientset.Interface) *claimDefaulterPlugin {
reflector := cache.NewReflector(
&cache.ListWatch{
ListFunc: func(options api.ListOptions) (runtime.Object, error) {
return kclient.Extensions().StorageClasses().List(options)
return kclient.Storage().StorageClasses().List(options)
},
WatchFunc: func(options api.ListOptions) (watch.Interface, error) {
return kclient.Extensions().StorageClasses().Watch(options)
return kclient.Storage().StorageClasses().Watch(options)
},
},
&extensions.StorageClass{},
&storage.StorageClass{},
store,
0,
)
@ -147,10 +147,10 @@ func (c *claimDefaulterPlugin) Admit(a admission.Attributes) error {
}
// getDefaultClass returns the default StorageClass from the store, or nil.
func getDefaultClass(store cache.Store) (*extensions.StorageClass, error) {
defaultClasses := []*extensions.StorageClass{}
func getDefaultClass(store cache.Store) (*storage.StorageClass, error) {
defaultClasses := []*storage.StorageClass{}
for _, c := range store.List() {
class, ok := c.(*extensions.StorageClass)
class, ok := c.(*storage.StorageClass)
if !ok {
return nil, errors.NewInternalError(fmt.Errorf("error converting stored object to StorageClass: %v", c))
}

View File

@ -24,12 +24,12 @@ import (
"k8s.io/kubernetes/pkg/admission"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/apis/extensions"
"k8s.io/kubernetes/pkg/apis/storage"
"k8s.io/kubernetes/pkg/conversion"
)
func TestAdmission(t *testing.T) {
defaultClass1 := &extensions.StorageClass{
defaultClass1 := &storage.StorageClass{
TypeMeta: unversioned.TypeMeta{
Kind: "StorageClass",
},
@ -41,7 +41,7 @@ func TestAdmission(t *testing.T) {
},
Provisioner: "default1",
}
defaultClass2 := &extensions.StorageClass{
defaultClass2 := &storage.StorageClass{
TypeMeta: unversioned.TypeMeta{
Kind: "StorageClass",
},
@ -54,7 +54,7 @@ func TestAdmission(t *testing.T) {
Provisioner: "default2",
}
// Class that has explicit default = false
classWithFalseDefault := &extensions.StorageClass{
classWithFalseDefault := &storage.StorageClass{
TypeMeta: unversioned.TypeMeta{
Kind: "StorageClass",
},
@ -67,7 +67,7 @@ func TestAdmission(t *testing.T) {
Provisioner: "nondefault1",
}
// Class with missing default annotation (=non-default)
classWithNoDefault := &extensions.StorageClass{
classWithNoDefault := &storage.StorageClass{
TypeMeta: unversioned.TypeMeta{
Kind: "StorageClass",
},
@ -77,7 +77,7 @@ func TestAdmission(t *testing.T) {
Provisioner: "nondefault1",
}
// Class with empty default annotation (=non-default)
classWithEmptyDefault := &extensions.StorageClass{
classWithEmptyDefault := &storage.StorageClass{
TypeMeta: unversioned.TypeMeta{
Kind: "StorageClass",
},
@ -126,56 +126,56 @@ func TestAdmission(t *testing.T) {
tests := []struct {
name string
classes []*extensions.StorageClass
classes []*storage.StorageClass
claim *api.PersistentVolumeClaim
expectError bool
expectedClassName string
}{
{
"no default, no modification of PVCs",
[]*extensions.StorageClass{classWithFalseDefault, classWithNoDefault, classWithEmptyDefault},
[]*storage.StorageClass{classWithFalseDefault, classWithNoDefault, classWithEmptyDefault},
claimWithNoClass,
false,
"",
},
{
"one default, modify PVC with class=nil",
[]*extensions.StorageClass{defaultClass1, classWithFalseDefault, classWithNoDefault, classWithEmptyDefault},
[]*storage.StorageClass{defaultClass1, classWithFalseDefault, classWithNoDefault, classWithEmptyDefault},
claimWithNoClass,
false,
"default1",
},
{
"one default, no modification of PVC with class=''",
[]*extensions.StorageClass{defaultClass1, classWithFalseDefault, classWithNoDefault, classWithEmptyDefault},
[]*storage.StorageClass{defaultClass1, classWithFalseDefault, classWithNoDefault, classWithEmptyDefault},
claimWithEmptyClass,
false,
"",
},
{
"one default, no modification of PVC with class='foo'",
[]*extensions.StorageClass{defaultClass1, classWithFalseDefault, classWithNoDefault, classWithEmptyDefault},
[]*storage.StorageClass{defaultClass1, classWithFalseDefault, classWithNoDefault, classWithEmptyDefault},
claimWithClass,
false,
"foo",
},
{
"two defaults, error with PVC with class=nil",
[]*extensions.StorageClass{defaultClass1, defaultClass2, classWithFalseDefault, classWithNoDefault, classWithEmptyDefault},
[]*storage.StorageClass{defaultClass1, defaultClass2, classWithFalseDefault, classWithNoDefault, classWithEmptyDefault},
claimWithNoClass,
true,
"",
},
{
"two defaults, no modification of PVC with class=''",
[]*extensions.StorageClass{defaultClass1, defaultClass2, classWithFalseDefault, classWithNoDefault, classWithEmptyDefault},
[]*storage.StorageClass{defaultClass1, defaultClass2, classWithFalseDefault, classWithNoDefault, classWithEmptyDefault},
claimWithEmptyClass,
false,
"",
},
{
"two defaults, no modification of PVC with class='foo'",
[]*extensions.StorageClass{defaultClass1, defaultClass2, classWithFalseDefault, classWithNoDefault, classWithEmptyDefault},
[]*storage.StorageClass{defaultClass1, defaultClass2, classWithFalseDefault, classWithNoDefault, classWithEmptyDefault},
claimWithClass,
false,
"foo",

View File

@ -22,7 +22,7 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/resource"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/apis/extensions"
"k8s.io/kubernetes/pkg/apis/storage"
client "k8s.io/kubernetes/pkg/client/unversioned"
"k8s.io/kubernetes/test/e2e/framework"
@ -119,8 +119,8 @@ var _ = framework.KubeDescribe("Dynamic provisioning", func() {
By("creating a StorageClass")
class := newStorageClass()
_, err := c.Extensions().StorageClasses().Create(class)
defer c.Extensions().StorageClasses().Delete(class.Name)
_, err := c.Storage().StorageClasses().Create(class)
defer c.Storage().StorageClasses().Delete(class.Name)
Expect(err).NotTo(HaveOccurred())
By("creating a claim with a dynamic provisioning annotation")
@ -231,7 +231,7 @@ func runInPodWithVolume(c *client.Client, ns, claimName, command string) {
framework.ExpectNoError(framework.WaitForPodSuccessInNamespaceSlow(c, pod.Name, pod.Spec.Containers[0].Name, pod.Namespace))
}
func newStorageClass() *extensions.StorageClass {
func newStorageClass() *storage.StorageClass {
var pluginName string
switch {
@ -243,7 +243,7 @@ func newStorageClass() *extensions.StorageClass {
pluginName = "kubernetes.io/cinder"
}
return &extensions.StorageClass{
return &storage.StorageClass{
TypeMeta: unversioned.TypeMeta{
Kind: "StorageClass",
},

View File

@ -37,6 +37,7 @@ import (
"k8s.io/kubernetes/pkg/apis/extensions"
"k8s.io/kubernetes/pkg/apis/policy"
"k8s.io/kubernetes/pkg/apis/rbac"
"k8s.io/kubernetes/pkg/apis/storage"
clientset "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
"k8s.io/kubernetes/pkg/client/record"
"k8s.io/kubernetes/pkg/client/restclient"
@ -209,6 +210,10 @@ func NewMasterConfig() *master.Config {
unversioned.GroupResource{Group: certificates.GroupName, Resource: genericapiserver.AllResources},
"",
NewSingleContentTypeSerializer(api.Scheme, testapi.Certificates.Codec(), runtime.ContentTypeJSON))
storageFactory.SetSerializer(
unversioned.GroupResource{Group: storage.GroupName, Resource: genericapiserver.AllResources},
"",
NewSingleContentTypeSerializer(api.Scheme, testapi.Storage.Codec(), runtime.ContentTypeJSON))
return &master.Config{
Config: &genericapiserver.Config{

View File

@ -31,7 +31,7 @@ import (
"k8s.io/kubernetes/pkg/api/resource"
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/apis/extensions"
"k8s.io/kubernetes/pkg/apis/storage"
clientset "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
"k8s.io/kubernetes/pkg/client/restclient"
fake_cloud "k8s.io/kubernetes/pkg/cloudprovider/providers/fake"
@ -862,9 +862,9 @@ func TestPersistentVolumeProvisionMultiPVCs(t *testing.T) {
// NOTE: This test cannot run in parallel, because it is creating and deleting
// non-namespaced objects (PersistenceVolumes and StorageClasses).
defer testClient.Core().PersistentVolumes().DeleteCollection(nil, api.ListOptions{})
defer testClient.Extensions().StorageClasses().DeleteCollection(nil, api.ListOptions{})
defer testClient.Storage().StorageClasses().DeleteCollection(nil, api.ListOptions{})
storageClass := extensions.StorageClass{
storageClass := storage.StorageClass{
TypeMeta: unversioned.TypeMeta{
Kind: "StorageClass",
},
@ -873,7 +873,7 @@ func TestPersistentVolumeProvisionMultiPVCs(t *testing.T) {
},
Provisioner: provisionerPluginName,
}
testClient.Extensions().StorageClasses().Create(&storageClass)
testClient.Storage().StorageClasses().Create(&storageClass)
stopCh := make(chan struct{})
binder.Run(stopCh)

View File

@ -27,7 +27,7 @@ import (
"k8s.io/kubernetes/pkg/api/resource"
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/apis/extensions"
"k8s.io/kubernetes/pkg/apis/storage"
"k8s.io/kubernetes/pkg/client/restclient"
client "k8s.io/kubernetes/pkg/client/unversioned"
"k8s.io/kubernetes/test/integration/framework"
@ -51,7 +51,7 @@ func TestStorageClasses(t *testing.T) {
// DoTestStorageClasses tests storage classes for one api version.
func DoTestStorageClasses(t *testing.T, client *client.Client, ns *api.Namespace) {
// Make a storage class object.
s := extensions.StorageClass{
s := storage.StorageClass{
TypeMeta: unversioned.TypeMeta{
Kind: "StorageClass",
},
@ -61,7 +61,7 @@ func DoTestStorageClasses(t *testing.T, client *client.Client, ns *api.Namespace
Provisioner: provisionerPluginName,
}
if _, err := client.Extensions().StorageClasses().Create(&s); err != nil {
if _, err := client.Storage().StorageClasses().Create(&s); err != nil {
t.Errorf("unable to create test storage class: %v", err)
}
defer deleteStorageClassOrErrorf(t, client, s.Namespace, s.Name)
@ -89,7 +89,7 @@ func DoTestStorageClasses(t *testing.T, client *client.Client, ns *api.Namespace
}
func deleteStorageClassOrErrorf(t *testing.T, c *client.Client, ns, name string) {
if err := c.Extensions().StorageClasses().Delete(name); err != nil {
if err := c.Storage().StorageClasses().Delete(name); err != nil {
t.Errorf("unable to delete storage class %v: %v", name, err)
}
}