mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Merge pull request #33628 from mbohlool/co2
Automatic merge from submit-queue Add OpenAPI specs to source tree Similar to swagger spec, adding openapi specs in a separate folder api/openapi-spec To make sure we generate a consistent spec, parameters need to be sorted first.
This commit is contained in:
commit
cfb833e86a
78
api/openapi-spec/api.json
Normal file
78
api/openapi-spec/api.json
Normal file
@ -0,0 +1,78 @@
|
||||
{
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"title": "Kubernetes /api",
|
||||
"version": "unversioned"
|
||||
},
|
||||
"paths": {
|
||||
"/api/": {
|
||||
"get": {
|
||||
"description": "get available API versions",
|
||||
"consumes": [
|
||||
"application/json",
|
||||
"application/yaml",
|
||||
"application/vnd.kubernetes.protobuf"
|
||||
],
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/yaml",
|
||||
"application/vnd.kubernetes.protobuf"
|
||||
],
|
||||
"schemes": [
|
||||
"https"
|
||||
],
|
||||
"operationId": "getAPIVersions",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/unversioned.APIVersions"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"unversioned.APIVersions": {
|
||||
"description": "APIVersions lists the versions that are available, to allow clients to discover the API at /api, which is the root path of the legacy v1 API.",
|
||||
"required": [
|
||||
"versions",
|
||||
"serverAddressByClientCIDRs"
|
||||
],
|
||||
"properties": {
|
||||
"serverAddressByClientCIDRs": {
|
||||
"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.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/unversioned.ServerAddressByClientCIDR"
|
||||
}
|
||||
},
|
||||
"versions": {
|
||||
"description": "versions are the api versions that are available.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"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": {
|
||||
"description": "The CIDR with which clients can match their IP to figure out the server address that they should use.",
|
||||
"type": "string"
|
||||
},
|
||||
"serverAddress": {
|
||||
"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.",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
119
api/openapi-spec/apis.json
Normal file
119
api/openapi-spec/apis.json
Normal file
@ -0,0 +1,119 @@
|
||||
{
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"title": "Kubernetes /apis",
|
||||
"version": "unversioned"
|
||||
},
|
||||
"paths": {
|
||||
"/apis/": {
|
||||
"get": {
|
||||
"description": "get available API versions",
|
||||
"consumes": [
|
||||
"application/json",
|
||||
"application/yaml",
|
||||
"application/vnd.kubernetes.protobuf"
|
||||
],
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/yaml",
|
||||
"application/vnd.kubernetes.protobuf"
|
||||
],
|
||||
"schemes": [
|
||||
"https"
|
||||
],
|
||||
"operationId": "getAPIVersions",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/unversioned.APIGroupList"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"unversioned.APIGroup": {
|
||||
"description": "APIGroup contains the name, the supported versions, and the preferred version of a group.",
|
||||
"required": [
|
||||
"name",
|
||||
"versions",
|
||||
"serverAddressByClientCIDRs"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"description": "name is the name of the group.",
|
||||
"type": "string"
|
||||
},
|
||||
"preferredVersion": {
|
||||
"description": "preferredVersion is the version preferred by the API server, which probably is the storage version.",
|
||||
"$ref": "#/definitions/unversioned.GroupVersionForDiscovery"
|
||||
},
|
||||
"serverAddressByClientCIDRs": {
|
||||
"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.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/unversioned.ServerAddressByClientCIDR"
|
||||
}
|
||||
},
|
||||
"versions": {
|
||||
"description": "versions are the versions supported in this group.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/unversioned.GroupVersionForDiscovery"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"unversioned.APIGroupList": {
|
||||
"description": "APIGroupList is a list of APIGroup, to allow clients to discover the API at /apis.",
|
||||
"required": [
|
||||
"groups"
|
||||
],
|
||||
"properties": {
|
||||
"groups": {
|
||||
"description": "groups is a list of APIGroup.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/unversioned.APIGroup"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"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": {
|
||||
"description": "groupVersion specifies the API group and version in the form \"group/version\"",
|
||||
"type": "string"
|
||||
},
|
||||
"version": {
|
||||
"description": "version specifies the version in the form of \"version\". This is to save the clients the trouble of splitting the GroupVersion.",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"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": {
|
||||
"description": "The CIDR with which clients can match their IP to figure out the server address that they should use.",
|
||||
"type": "string"
|
||||
},
|
||||
"serverAddress": {
|
||||
"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.",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
46
api/openapi-spec/logs.json
Normal file
46
api/openapi-spec/logs.json
Normal file
@ -0,0 +1,46 @@
|
||||
{
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"title": "Kubernetes /logs",
|
||||
"version": "unversioned"
|
||||
},
|
||||
"paths": {
|
||||
"/logs/": {
|
||||
"get": {
|
||||
"schemes": [
|
||||
"https"
|
||||
],
|
||||
"operationId": "logFileListHandler",
|
||||
"responses": {
|
||||
"default": {
|
||||
"description": "Default Response."
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/logs/{logpath}": {
|
||||
"get": {
|
||||
"schemes": [
|
||||
"https"
|
||||
],
|
||||
"operationId": "logFileHandler",
|
||||
"responses": {
|
||||
"default": {
|
||||
"description": "Default Response."
|
||||
}
|
||||
}
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"uniqueItems": true,
|
||||
"type": "string",
|
||||
"description": "path to the log",
|
||||
"name": "logpath",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"definitions": {}
|
||||
}
|
30578
api/openapi-spec/root_swagger.json
Normal file
30578
api/openapi-spec/root_swagger.json
Normal file
File diff suppressed because it is too large
Load Diff
104
api/openapi-spec/v1.autoscaling.json
Normal file
104
api/openapi-spec/v1.autoscaling.json
Normal file
@ -0,0 +1,104 @@
|
||||
{
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"title": "Kubernetes /apis/autoscaling",
|
||||
"version": "unversioned"
|
||||
},
|
||||
"paths": {
|
||||
"/apis/autoscaling/": {
|
||||
"get": {
|
||||
"description": "get information of a group",
|
||||
"consumes": [
|
||||
"application/json",
|
||||
"application/yaml",
|
||||
"application/vnd.kubernetes.protobuf"
|
||||
],
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/yaml",
|
||||
"application/vnd.kubernetes.protobuf"
|
||||
],
|
||||
"schemes": [
|
||||
"https"
|
||||
],
|
||||
"operationId": "getAPIGroup",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/unversioned.APIGroup"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"unversioned.APIGroup": {
|
||||
"description": "APIGroup contains the name, the supported versions, and the preferred version of a group.",
|
||||
"required": [
|
||||
"name",
|
||||
"versions",
|
||||
"serverAddressByClientCIDRs"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"description": "name is the name of the group.",
|
||||
"type": "string"
|
||||
},
|
||||
"preferredVersion": {
|
||||
"description": "preferredVersion is the version preferred by the API server, which probably is the storage version.",
|
||||
"$ref": "#/definitions/unversioned.GroupVersionForDiscovery"
|
||||
},
|
||||
"serverAddressByClientCIDRs": {
|
||||
"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.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/unversioned.ServerAddressByClientCIDR"
|
||||
}
|
||||
},
|
||||
"versions": {
|
||||
"description": "versions are the versions supported in this group.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/unversioned.GroupVersionForDiscovery"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"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": {
|
||||
"description": "groupVersion specifies the API group and version in the form \"group/version\"",
|
||||
"type": "string"
|
||||
},
|
||||
"version": {
|
||||
"description": "version specifies the version in the form of \"version\". This is to save the clients the trouble of splitting the GroupVersion.",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"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": {
|
||||
"description": "The CIDR with which clients can match their IP to figure out the server address that they should use.",
|
||||
"type": "string"
|
||||
},
|
||||
"serverAddress": {
|
||||
"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.",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
104
api/openapi-spec/v1.batch.json
Normal file
104
api/openapi-spec/v1.batch.json
Normal file
@ -0,0 +1,104 @@
|
||||
{
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"title": "Kubernetes /apis/batch",
|
||||
"version": "unversioned"
|
||||
},
|
||||
"paths": {
|
||||
"/apis/batch/": {
|
||||
"get": {
|
||||
"description": "get information of a group",
|
||||
"consumes": [
|
||||
"application/json",
|
||||
"application/yaml",
|
||||
"application/vnd.kubernetes.protobuf"
|
||||
],
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/yaml",
|
||||
"application/vnd.kubernetes.protobuf"
|
||||
],
|
||||
"schemes": [
|
||||
"https"
|
||||
],
|
||||
"operationId": "getAPIGroup",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/unversioned.APIGroup"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"unversioned.APIGroup": {
|
||||
"description": "APIGroup contains the name, the supported versions, and the preferred version of a group.",
|
||||
"required": [
|
||||
"name",
|
||||
"versions",
|
||||
"serverAddressByClientCIDRs"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"description": "name is the name of the group.",
|
||||
"type": "string"
|
||||
},
|
||||
"preferredVersion": {
|
||||
"description": "preferredVersion is the version preferred by the API server, which probably is the storage version.",
|
||||
"$ref": "#/definitions/unversioned.GroupVersionForDiscovery"
|
||||
},
|
||||
"serverAddressByClientCIDRs": {
|
||||
"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.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/unversioned.ServerAddressByClientCIDR"
|
||||
}
|
||||
},
|
||||
"versions": {
|
||||
"description": "versions are the versions supported in this group.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/unversioned.GroupVersionForDiscovery"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"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": {
|
||||
"description": "groupVersion specifies the API group and version in the form \"group/version\"",
|
||||
"type": "string"
|
||||
},
|
||||
"version": {
|
||||
"description": "version specifies the version in the form of \"version\". This is to save the clients the trouble of splitting the GroupVersion.",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"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": {
|
||||
"description": "The CIDR with which clients can match their IP to figure out the server address that they should use.",
|
||||
"type": "string"
|
||||
},
|
||||
"serverAddress": {
|
||||
"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.",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
15289
api/openapi-spec/v1.json
Normal file
15289
api/openapi-spec/v1.json
Normal file
File diff suppressed because it is too large
Load Diff
104
api/openapi-spec/v1alpha1.apps.json
Normal file
104
api/openapi-spec/v1alpha1.apps.json
Normal file
@ -0,0 +1,104 @@
|
||||
{
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"title": "Kubernetes /apis/apps",
|
||||
"version": "unversioned"
|
||||
},
|
||||
"paths": {
|
||||
"/apis/apps/": {
|
||||
"get": {
|
||||
"description": "get information of a group",
|
||||
"consumes": [
|
||||
"application/json",
|
||||
"application/yaml",
|
||||
"application/vnd.kubernetes.protobuf"
|
||||
],
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/yaml",
|
||||
"application/vnd.kubernetes.protobuf"
|
||||
],
|
||||
"schemes": [
|
||||
"https"
|
||||
],
|
||||
"operationId": "getAPIGroup",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/unversioned.APIGroup"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"unversioned.APIGroup": {
|
||||
"description": "APIGroup contains the name, the supported versions, and the preferred version of a group.",
|
||||
"required": [
|
||||
"name",
|
||||
"versions",
|
||||
"serverAddressByClientCIDRs"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"description": "name is the name of the group.",
|
||||
"type": "string"
|
||||
},
|
||||
"preferredVersion": {
|
||||
"description": "preferredVersion is the version preferred by the API server, which probably is the storage version.",
|
||||
"$ref": "#/definitions/unversioned.GroupVersionForDiscovery"
|
||||
},
|
||||
"serverAddressByClientCIDRs": {
|
||||
"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.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/unversioned.ServerAddressByClientCIDR"
|
||||
}
|
||||
},
|
||||
"versions": {
|
||||
"description": "versions are the versions supported in this group.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/unversioned.GroupVersionForDiscovery"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"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": {
|
||||
"description": "groupVersion specifies the API group and version in the form \"group/version\"",
|
||||
"type": "string"
|
||||
},
|
||||
"version": {
|
||||
"description": "version specifies the version in the form of \"version\". This is to save the clients the trouble of splitting the GroupVersion.",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"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": {
|
||||
"description": "The CIDR with which clients can match their IP to figure out the server address that they should use.",
|
||||
"type": "string"
|
||||
},
|
||||
"serverAddress": {
|
||||
"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.",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
104
api/openapi-spec/v1alpha1.certificates.k8s.io.json
Normal file
104
api/openapi-spec/v1alpha1.certificates.k8s.io.json
Normal file
@ -0,0 +1,104 @@
|
||||
{
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"title": "Kubernetes /apis/certificates.k8s.io",
|
||||
"version": "unversioned"
|
||||
},
|
||||
"paths": {
|
||||
"/apis/certificates.k8s.io/": {
|
||||
"get": {
|
||||
"description": "get information of a group",
|
||||
"consumes": [
|
||||
"application/json",
|
||||
"application/yaml",
|
||||
"application/vnd.kubernetes.protobuf"
|
||||
],
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/yaml",
|
||||
"application/vnd.kubernetes.protobuf"
|
||||
],
|
||||
"schemes": [
|
||||
"https"
|
||||
],
|
||||
"operationId": "getAPIGroup",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/unversioned.APIGroup"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"unversioned.APIGroup": {
|
||||
"description": "APIGroup contains the name, the supported versions, and the preferred version of a group.",
|
||||
"required": [
|
||||
"name",
|
||||
"versions",
|
||||
"serverAddressByClientCIDRs"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"description": "name is the name of the group.",
|
||||
"type": "string"
|
||||
},
|
||||
"preferredVersion": {
|
||||
"description": "preferredVersion is the version preferred by the API server, which probably is the storage version.",
|
||||
"$ref": "#/definitions/unversioned.GroupVersionForDiscovery"
|
||||
},
|
||||
"serverAddressByClientCIDRs": {
|
||||
"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.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/unversioned.ServerAddressByClientCIDR"
|
||||
}
|
||||
},
|
||||
"versions": {
|
||||
"description": "versions are the versions supported in this group.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/unversioned.GroupVersionForDiscovery"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"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": {
|
||||
"description": "groupVersion specifies the API group and version in the form \"group/version\"",
|
||||
"type": "string"
|
||||
},
|
||||
"version": {
|
||||
"description": "version specifies the version in the form of \"version\". This is to save the clients the trouble of splitting the GroupVersion.",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"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": {
|
||||
"description": "The CIDR with which clients can match their IP to figure out the server address that they should use.",
|
||||
"type": "string"
|
||||
},
|
||||
"serverAddress": {
|
||||
"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.",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
104
api/openapi-spec/v1alpha1.policy.json
Normal file
104
api/openapi-spec/v1alpha1.policy.json
Normal file
@ -0,0 +1,104 @@
|
||||
{
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"title": "Kubernetes /apis/policy",
|
||||
"version": "unversioned"
|
||||
},
|
||||
"paths": {
|
||||
"/apis/policy/": {
|
||||
"get": {
|
||||
"description": "get information of a group",
|
||||
"consumes": [
|
||||
"application/json",
|
||||
"application/yaml",
|
||||
"application/vnd.kubernetes.protobuf"
|
||||
],
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/yaml",
|
||||
"application/vnd.kubernetes.protobuf"
|
||||
],
|
||||
"schemes": [
|
||||
"https"
|
||||
],
|
||||
"operationId": "getAPIGroup",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/unversioned.APIGroup"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"unversioned.APIGroup": {
|
||||
"description": "APIGroup contains the name, the supported versions, and the preferred version of a group.",
|
||||
"required": [
|
||||
"name",
|
||||
"versions",
|
||||
"serverAddressByClientCIDRs"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"description": "name is the name of the group.",
|
||||
"type": "string"
|
||||
},
|
||||
"preferredVersion": {
|
||||
"description": "preferredVersion is the version preferred by the API server, which probably is the storage version.",
|
||||
"$ref": "#/definitions/unversioned.GroupVersionForDiscovery"
|
||||
},
|
||||
"serverAddressByClientCIDRs": {
|
||||
"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.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/unversioned.ServerAddressByClientCIDR"
|
||||
}
|
||||
},
|
||||
"versions": {
|
||||
"description": "versions are the versions supported in this group.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/unversioned.GroupVersionForDiscovery"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"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": {
|
||||
"description": "groupVersion specifies the API group and version in the form \"group/version\"",
|
||||
"type": "string"
|
||||
},
|
||||
"version": {
|
||||
"description": "version specifies the version in the form of \"version\". This is to save the clients the trouble of splitting the GroupVersion.",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"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": {
|
||||
"description": "The CIDR with which clients can match their IP to figure out the server address that they should use.",
|
||||
"type": "string"
|
||||
},
|
||||
"serverAddress": {
|
||||
"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.",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
104
api/openapi-spec/v1alpha1.rbac.authorization.k8s.io.json
Normal file
104
api/openapi-spec/v1alpha1.rbac.authorization.k8s.io.json
Normal file
@ -0,0 +1,104 @@
|
||||
{
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"title": "Kubernetes /apis/rbac.authorization.k8s.io",
|
||||
"version": "unversioned"
|
||||
},
|
||||
"paths": {
|
||||
"/apis/rbac.authorization.k8s.io/": {
|
||||
"get": {
|
||||
"description": "get information of a group",
|
||||
"consumes": [
|
||||
"application/json",
|
||||
"application/yaml",
|
||||
"application/vnd.kubernetes.protobuf"
|
||||
],
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/yaml",
|
||||
"application/vnd.kubernetes.protobuf"
|
||||
],
|
||||
"schemes": [
|
||||
"https"
|
||||
],
|
||||
"operationId": "getAPIGroup",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/unversioned.APIGroup"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"unversioned.APIGroup": {
|
||||
"description": "APIGroup contains the name, the supported versions, and the preferred version of a group.",
|
||||
"required": [
|
||||
"name",
|
||||
"versions",
|
||||
"serverAddressByClientCIDRs"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"description": "name is the name of the group.",
|
||||
"type": "string"
|
||||
},
|
||||
"preferredVersion": {
|
||||
"description": "preferredVersion is the version preferred by the API server, which probably is the storage version.",
|
||||
"$ref": "#/definitions/unversioned.GroupVersionForDiscovery"
|
||||
},
|
||||
"serverAddressByClientCIDRs": {
|
||||
"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.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/unversioned.ServerAddressByClientCIDR"
|
||||
}
|
||||
},
|
||||
"versions": {
|
||||
"description": "versions are the versions supported in this group.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/unversioned.GroupVersionForDiscovery"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"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": {
|
||||
"description": "groupVersion specifies the API group and version in the form \"group/version\"",
|
||||
"type": "string"
|
||||
},
|
||||
"version": {
|
||||
"description": "version specifies the version in the form of \"version\". This is to save the clients the trouble of splitting the GroupVersion.",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"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": {
|
||||
"description": "The CIDR with which clients can match their IP to figure out the server address that they should use.",
|
||||
"type": "string"
|
||||
},
|
||||
"serverAddress": {
|
||||
"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.",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
104
api/openapi-spec/v1beta1.authentication.k8s.io.json
Normal file
104
api/openapi-spec/v1beta1.authentication.k8s.io.json
Normal file
@ -0,0 +1,104 @@
|
||||
{
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"title": "Kubernetes /apis/authentication.k8s.io",
|
||||
"version": "unversioned"
|
||||
},
|
||||
"paths": {
|
||||
"/apis/authentication.k8s.io/": {
|
||||
"get": {
|
||||
"description": "get information of a group",
|
||||
"consumes": [
|
||||
"application/json",
|
||||
"application/yaml",
|
||||
"application/vnd.kubernetes.protobuf"
|
||||
],
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/yaml",
|
||||
"application/vnd.kubernetes.protobuf"
|
||||
],
|
||||
"schemes": [
|
||||
"https"
|
||||
],
|
||||
"operationId": "getAPIGroup",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/unversioned.APIGroup"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"unversioned.APIGroup": {
|
||||
"description": "APIGroup contains the name, the supported versions, and the preferred version of a group.",
|
||||
"required": [
|
||||
"name",
|
||||
"versions",
|
||||
"serverAddressByClientCIDRs"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"description": "name is the name of the group.",
|
||||
"type": "string"
|
||||
},
|
||||
"preferredVersion": {
|
||||
"description": "preferredVersion is the version preferred by the API server, which probably is the storage version.",
|
||||
"$ref": "#/definitions/unversioned.GroupVersionForDiscovery"
|
||||
},
|
||||
"serverAddressByClientCIDRs": {
|
||||
"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.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/unversioned.ServerAddressByClientCIDR"
|
||||
}
|
||||
},
|
||||
"versions": {
|
||||
"description": "versions are the versions supported in this group.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/unversioned.GroupVersionForDiscovery"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"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": {
|
||||
"description": "groupVersion specifies the API group and version in the form \"group/version\"",
|
||||
"type": "string"
|
||||
},
|
||||
"version": {
|
||||
"description": "version specifies the version in the form of \"version\". This is to save the clients the trouble of splitting the GroupVersion.",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"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": {
|
||||
"description": "The CIDR with which clients can match their IP to figure out the server address that they should use.",
|
||||
"type": "string"
|
||||
},
|
||||
"serverAddress": {
|
||||
"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.",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
104
api/openapi-spec/v1beta1.authorization.k8s.io.json
Normal file
104
api/openapi-spec/v1beta1.authorization.k8s.io.json
Normal file
@ -0,0 +1,104 @@
|
||||
{
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"title": "Kubernetes /apis/authorization.k8s.io",
|
||||
"version": "unversioned"
|
||||
},
|
||||
"paths": {
|
||||
"/apis/authorization.k8s.io/": {
|
||||
"get": {
|
||||
"description": "get information of a group",
|
||||
"consumes": [
|
||||
"application/json",
|
||||
"application/yaml",
|
||||
"application/vnd.kubernetes.protobuf"
|
||||
],
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/yaml",
|
||||
"application/vnd.kubernetes.protobuf"
|
||||
],
|
||||
"schemes": [
|
||||
"https"
|
||||
],
|
||||
"operationId": "getAPIGroup",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/unversioned.APIGroup"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"unversioned.APIGroup": {
|
||||
"description": "APIGroup contains the name, the supported versions, and the preferred version of a group.",
|
||||
"required": [
|
||||
"name",
|
||||
"versions",
|
||||
"serverAddressByClientCIDRs"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"description": "name is the name of the group.",
|
||||
"type": "string"
|
||||
},
|
||||
"preferredVersion": {
|
||||
"description": "preferredVersion is the version preferred by the API server, which probably is the storage version.",
|
||||
"$ref": "#/definitions/unversioned.GroupVersionForDiscovery"
|
||||
},
|
||||
"serverAddressByClientCIDRs": {
|
||||
"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.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/unversioned.ServerAddressByClientCIDR"
|
||||
}
|
||||
},
|
||||
"versions": {
|
||||
"description": "versions are the versions supported in this group.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/unversioned.GroupVersionForDiscovery"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"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": {
|
||||
"description": "groupVersion specifies the API group and version in the form \"group/version\"",
|
||||
"type": "string"
|
||||
},
|
||||
"version": {
|
||||
"description": "version specifies the version in the form of \"version\". This is to save the clients the trouble of splitting the GroupVersion.",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"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": {
|
||||
"description": "The CIDR with which clients can match their IP to figure out the server address that they should use.",
|
||||
"type": "string"
|
||||
},
|
||||
"serverAddress": {
|
||||
"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.",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
104
api/openapi-spec/v1beta1.extensions.json
Normal file
104
api/openapi-spec/v1beta1.extensions.json
Normal file
@ -0,0 +1,104 @@
|
||||
{
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"title": "Kubernetes /apis/extensions",
|
||||
"version": "unversioned"
|
||||
},
|
||||
"paths": {
|
||||
"/apis/extensions/": {
|
||||
"get": {
|
||||
"description": "get information of a group",
|
||||
"consumes": [
|
||||
"application/json",
|
||||
"application/yaml",
|
||||
"application/vnd.kubernetes.protobuf"
|
||||
],
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/yaml",
|
||||
"application/vnd.kubernetes.protobuf"
|
||||
],
|
||||
"schemes": [
|
||||
"https"
|
||||
],
|
||||
"operationId": "getAPIGroup",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/unversioned.APIGroup"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"unversioned.APIGroup": {
|
||||
"description": "APIGroup contains the name, the supported versions, and the preferred version of a group.",
|
||||
"required": [
|
||||
"name",
|
||||
"versions",
|
||||
"serverAddressByClientCIDRs"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"description": "name is the name of the group.",
|
||||
"type": "string"
|
||||
},
|
||||
"preferredVersion": {
|
||||
"description": "preferredVersion is the version preferred by the API server, which probably is the storage version.",
|
||||
"$ref": "#/definitions/unversioned.GroupVersionForDiscovery"
|
||||
},
|
||||
"serverAddressByClientCIDRs": {
|
||||
"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.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/unversioned.ServerAddressByClientCIDR"
|
||||
}
|
||||
},
|
||||
"versions": {
|
||||
"description": "versions are the versions supported in this group.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/unversioned.GroupVersionForDiscovery"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"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": {
|
||||
"description": "groupVersion specifies the API group and version in the form \"group/version\"",
|
||||
"type": "string"
|
||||
},
|
||||
"version": {
|
||||
"description": "version specifies the version in the form of \"version\". This is to save the clients the trouble of splitting the GroupVersion.",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"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": {
|
||||
"description": "The CIDR with which clients can match their IP to figure out the server address that they should use.",
|
||||
"type": "string"
|
||||
},
|
||||
"serverAddress": {
|
||||
"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.",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
104
api/openapi-spec/v1beta1.storage.k8s.io.json
Normal file
104
api/openapi-spec/v1beta1.storage.k8s.io.json
Normal file
@ -0,0 +1,104 @@
|
||||
{
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"title": "Kubernetes /apis/storage.k8s.io",
|
||||
"version": "unversioned"
|
||||
},
|
||||
"paths": {
|
||||
"/apis/storage.k8s.io/": {
|
||||
"get": {
|
||||
"description": "get information of a group",
|
||||
"consumes": [
|
||||
"application/json",
|
||||
"application/yaml",
|
||||
"application/vnd.kubernetes.protobuf"
|
||||
],
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/yaml",
|
||||
"application/vnd.kubernetes.protobuf"
|
||||
],
|
||||
"schemes": [
|
||||
"https"
|
||||
],
|
||||
"operationId": "getAPIGroup",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/unversioned.APIGroup"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"unversioned.APIGroup": {
|
||||
"description": "APIGroup contains the name, the supported versions, and the preferred version of a group.",
|
||||
"required": [
|
||||
"name",
|
||||
"versions",
|
||||
"serverAddressByClientCIDRs"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"description": "name is the name of the group.",
|
||||
"type": "string"
|
||||
},
|
||||
"preferredVersion": {
|
||||
"description": "preferredVersion is the version preferred by the API server, which probably is the storage version.",
|
||||
"$ref": "#/definitions/unversioned.GroupVersionForDiscovery"
|
||||
},
|
||||
"serverAddressByClientCIDRs": {
|
||||
"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.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/unversioned.ServerAddressByClientCIDR"
|
||||
}
|
||||
},
|
||||
"versions": {
|
||||
"description": "versions are the versions supported in this group.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/unversioned.GroupVersionForDiscovery"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"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": {
|
||||
"description": "groupVersion specifies the API group and version in the form \"group/version\"",
|
||||
"type": "string"
|
||||
},
|
||||
"version": {
|
||||
"description": "version specifies the version in the form of \"version\". This is to save the clients the trouble of splitting the GroupVersion.",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"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": {
|
||||
"description": "The CIDR with which clients can match their IP to figure out the server address that they should use.",
|
||||
"type": "string"
|
||||
},
|
||||
"serverAddress": {
|
||||
"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.",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
104
api/openapi-spec/v2alpha1.batch.json
Normal file
104
api/openapi-spec/v2alpha1.batch.json
Normal file
@ -0,0 +1,104 @@
|
||||
{
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"title": "Kubernetes /apis/batch",
|
||||
"version": "unversioned"
|
||||
},
|
||||
"paths": {
|
||||
"/apis/batch/": {
|
||||
"get": {
|
||||
"description": "get information of a group",
|
||||
"consumes": [
|
||||
"application/json",
|
||||
"application/yaml",
|
||||
"application/vnd.kubernetes.protobuf"
|
||||
],
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/yaml",
|
||||
"application/vnd.kubernetes.protobuf"
|
||||
],
|
||||
"schemes": [
|
||||
"https"
|
||||
],
|
||||
"operationId": "getAPIGroup",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/unversioned.APIGroup"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"unversioned.APIGroup": {
|
||||
"description": "APIGroup contains the name, the supported versions, and the preferred version of a group.",
|
||||
"required": [
|
||||
"name",
|
||||
"versions",
|
||||
"serverAddressByClientCIDRs"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"description": "name is the name of the group.",
|
||||
"type": "string"
|
||||
},
|
||||
"preferredVersion": {
|
||||
"description": "preferredVersion is the version preferred by the API server, which probably is the storage version.",
|
||||
"$ref": "#/definitions/unversioned.GroupVersionForDiscovery"
|
||||
},
|
||||
"serverAddressByClientCIDRs": {
|
||||
"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.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/unversioned.ServerAddressByClientCIDR"
|
||||
}
|
||||
},
|
||||
"versions": {
|
||||
"description": "versions are the versions supported in this group.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/unversioned.GroupVersionForDiscovery"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"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": {
|
||||
"description": "groupVersion specifies the API group and version in the form \"group/version\"",
|
||||
"type": "string"
|
||||
},
|
||||
"version": {
|
||||
"description": "version specifies the version in the form of \"version\". This is to save the clients the trouble of splitting the GroupVersion.",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"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": {
|
||||
"description": "The CIDR with which clients can match their IP to figure out the server address that they should use.",
|
||||
"type": "string"
|
||||
},
|
||||
"serverAddress": {
|
||||
"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.",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
77
api/openapi-spec/version.json
Normal file
77
api/openapi-spec/version.json
Normal file
@ -0,0 +1,77 @@
|
||||
{
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"title": "Kubernetes /version",
|
||||
"version": "unversioned"
|
||||
},
|
||||
"paths": {
|
||||
"/version/": {
|
||||
"get": {
|
||||
"description": "get the code version",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"schemes": [
|
||||
"https"
|
||||
],
|
||||
"operationId": "getCodeVersion",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/version.Info"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"version.Info": {
|
||||
"description": "Info contains versioning information. how we'll want to distribute that information.",
|
||||
"required": [
|
||||
"major",
|
||||
"minor",
|
||||
"gitVersion",
|
||||
"gitCommit",
|
||||
"gitTreeState",
|
||||
"buildDate",
|
||||
"goVersion",
|
||||
"compiler",
|
||||
"platform"
|
||||
],
|
||||
"properties": {
|
||||
"buildDate": {
|
||||
"type": "string"
|
||||
},
|
||||
"compiler": {
|
||||
"type": "string"
|
||||
},
|
||||
"gitCommit": {
|
||||
"type": "string"
|
||||
},
|
||||
"gitTreeState": {
|
||||
"type": "string"
|
||||
},
|
||||
"gitVersion": {
|
||||
"type": "string"
|
||||
},
|
||||
"goVersion": {
|
||||
"type": "string"
|
||||
},
|
||||
"major": {
|
||||
"type": "string"
|
||||
},
|
||||
"minor": {
|
||||
"type": "string"
|
||||
},
|
||||
"platform": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -100,5 +100,6 @@ done
|
||||
${KUBE_ROOT}/hack/update-munge-docs.sh
|
||||
${KUBE_ROOT}/hack/update-generated-swagger-docs.sh
|
||||
${KUBE_ROOT}/hack/update-swagger-spec.sh
|
||||
${KUBE_ROOT}/hack/update-openapi-spec.sh
|
||||
${KUBE_ROOT}/hack/update-generated-protobuf.sh
|
||||
./hack/update-api-reference-docs.sh
|
||||
|
@ -590,10 +590,11 @@ out. Put `grep` or `ack` to good use.
|
||||
If you added functionality, you should consider documenting it and/or writing
|
||||
an example to illustrate your change.
|
||||
|
||||
Make sure you update the swagger API spec by running:
|
||||
Make sure you update the swagger and OpenAPI spec by running:
|
||||
|
||||
```sh
|
||||
hack/update-swagger-spec.sh
|
||||
hack/update-openapi-spec.sh
|
||||
```
|
||||
|
||||
The API spec changes should be in a commit separate from your other changes.
|
||||
|
@ -387,6 +387,59 @@ kube::util::fetch-swagger-spec() {
|
||||
curl -w "\n" -fs "${SWAGGER_API_PATH}logs" > "${SWAGGER_ROOT_DIR}/logs.json"
|
||||
}
|
||||
|
||||
# Takes a group/version and returns the openapi-spec file name.
|
||||
# default behavior: extensions/v1beta1 -> v1beta1.extensions
|
||||
# special case for v1: v1 -> v1
|
||||
kube::util::gv-to-openapi-name() {
|
||||
local group_version="$1"
|
||||
case "${group_version}" in
|
||||
v1)
|
||||
echo "v1"
|
||||
;;
|
||||
*)
|
||||
echo "${group_version#*/}.${group_version%/*}"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
# Fetches openapi spec from apiserver.
|
||||
# Assumed vars:
|
||||
# OPENAPI_API_PATH: Base path for openapi on apiserver. normally APIServer root. i.e., http://localhost:8080/
|
||||
# OPENAPI_ROOT_DIR: Root dir where we want to to save the fetched spec.
|
||||
# VERSIONS: Array of group versions to include in swagger spec.
|
||||
kube::util::fetch-openapi-spec() {
|
||||
for ver in ${VERSIONS}; do
|
||||
if [[ " ${KUBE_NONSERVER_GROUP_VERSIONS} " == *" ${ver} "* ]]; then
|
||||
continue
|
||||
fi
|
||||
# fetch the openapi spec for each group version.
|
||||
if [[ ${ver} == "v1" ]]; then
|
||||
SUBPATH="api"
|
||||
else
|
||||
SUBPATH="apis"
|
||||
fi
|
||||
SUBPATH="${SUBPATH}/${ver}"
|
||||
OPENAPI_JSON_NAME="$(kube::util::gv-to-openapi-name ${ver}).json"
|
||||
curl -w "\n" -fs "${OPENAPI_PATH}${SUBPATH}/swagger.json" > "${OPENAPI_ROOT_DIR}/${OPENAPI_JSON_NAME}"
|
||||
|
||||
# fetch the openapi spec for the discovery mechanism at group level.
|
||||
if [[ ${ver} == "v1" ]]; then
|
||||
continue
|
||||
fi
|
||||
SUBPATH="apis/"${ver%/*}
|
||||
OPEAN_JSON_NAME="${ver%/*}.json"
|
||||
curl -w "\n" -fs "${OPENAPI_PATH}${SUBPATH}/swagger.json" > "${OPENAPI_ROOT_DIR}/${OPENAPI_JSON_NAME}"
|
||||
done
|
||||
|
||||
# fetch openapi specs for other discovery mechanism.
|
||||
curl -w "\n" -fs "${OPENAPI_PATH}swagger.json" > "${OPENAPI_ROOT_DIR}/root_swagger.json"
|
||||
curl -w "\n" -fs "${OPENAPI_PATH}version/swagger.json" > "${OPENAPI_ROOT_DIR}/version.json"
|
||||
curl -w "\n" -fs "${OPENAPI_PATH}api/swagger.json" > "${OPENAPI_ROOT_DIR}/api.json"
|
||||
curl -w "\n" -fs "${OPENAPI_PATH}apis/swagger.json" > "${OPENAPI_ROOT_DIR}/apis.json"
|
||||
curl -w "\n" -fs "${OPENAPI_PATH}logs/swagger.json" > "${OPENAPI_ROOT_DIR}/logs.json"
|
||||
}
|
||||
|
||||
|
||||
# Returns the name of the upstream remote repository name for the local git
|
||||
# repo, e.g. "upstream" or "origin".
|
||||
|
75
hack/update-openapi-spec.sh
Executable file
75
hack/update-openapi-spec.sh
Executable file
@ -0,0 +1,75 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 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.
|
||||
|
||||
# Script to fetch latest openapi spec.
|
||||
# Puts the updated spec at api/openapi-spec/
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
|
||||
OPENAPI_ROOT_DIR="${KUBE_ROOT}/api/openapi-spec"
|
||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||
|
||||
kube::golang::setup_env
|
||||
|
||||
make -C "${KUBE_ROOT}" WHAT=cmd/kube-apiserver
|
||||
|
||||
function cleanup()
|
||||
{
|
||||
[[ -n ${APISERVER_PID-} ]] && kill ${APISERVER_PID} 1>&2 2>/dev/null
|
||||
|
||||
kube::etcd::cleanup
|
||||
|
||||
kube::log::status "Clean up complete"
|
||||
}
|
||||
|
||||
trap cleanup EXIT SIGINT
|
||||
|
||||
kube::golang::setup_env
|
||||
|
||||
apiserver=$(kube::util::find-binary "kube-apiserver")
|
||||
|
||||
TMP_DIR=$(mktemp -d /tmp/update-openapi-spec.XXXX)
|
||||
ETCD_HOST=${ETCD_HOST:-127.0.0.1}
|
||||
ETCD_PORT=${ETCD_PORT:-2379}
|
||||
API_PORT=${API_PORT:-8050}
|
||||
API_HOST=${API_HOST:-127.0.0.1}
|
||||
|
||||
kube::etcd::start
|
||||
|
||||
# Start kube-apiserver
|
||||
kube::log::status "Starting kube-apiserver"
|
||||
"${KUBE_OUTPUT_HOSTBIN}/kube-apiserver" \
|
||||
--insecure-bind-address="${API_HOST}" \
|
||||
--bind-address="${API_HOST}" \
|
||||
--insecure-port="${API_PORT}" \
|
||||
--etcd-servers="http://${ETCD_HOST}:${ETCD_PORT}" \
|
||||
--advertise-address="10.10.10.10" \
|
||||
--cert-dir="${TMP_DIR}/certs" \
|
||||
--service-cluster-ip-range="10.0.0.0/24" >/tmp/openapi-api-server.log 2>&1 &
|
||||
APISERVER_PID=$!
|
||||
|
||||
kube::util::wait_for_url "${API_HOST}:${API_PORT}/healthz" "apiserver: "
|
||||
|
||||
kube::log::status "Updating " ${OPENAPI_ROOT_DIR}
|
||||
|
||||
OPENAPI_PATH="${API_HOST}:${API_PORT}/" OPENAPI_ROOT_DIR="${OPENAPI_ROOT_DIR}" VERSIONS="${KUBE_AVAILABLE_GROUP_VERSIONS}" KUBE_NONSERVER_GROUP_VERSIONS="${KUBE_NONSERVER_GROUP_VERSIONS}" kube::util::fetch-openapi-spec
|
||||
|
||||
kube::log::status "SUCCESS"
|
||||
|
||||
# ex: ts=2 sw=2 et filetype=sh
|
51
hack/verify-openapi-spec.sh
Executable file
51
hack/verify-openapi-spec.sh
Executable file
@ -0,0 +1,51 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 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.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
|
||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||
|
||||
kube::golang::setup_env
|
||||
|
||||
make -C "${KUBE_ROOT}" WHAT=cmd/kube-apiserver
|
||||
|
||||
apiserver=$(kube::util::find-binary "kube-apiserver")
|
||||
|
||||
SPECROOT="${KUBE_ROOT}/api/openapi-spec"
|
||||
TMP_SPECROOT="${KUBE_ROOT}/_tmp/openapi-spec"
|
||||
_tmp="${KUBE_ROOT}/_tmp"
|
||||
|
||||
mkdir -p "${_tmp}"
|
||||
trap "rm -rf ${_tmp}" EXIT SIGINT
|
||||
cp -a "${SPECROOT}" "${TMP_SPECROOT}"
|
||||
|
||||
"${KUBE_ROOT}/hack/update-openapi-spec.sh"
|
||||
echo "diffing ${SPECROOT} against freshly generated openapi spec"
|
||||
ret=0
|
||||
diff -Naupr -I 'Auto generated by' "${SPECROOT}" "${TMP_SPECROOT}" || ret=$?
|
||||
cp -a ${TMP_SPECROOT} "${KUBE_ROOT}/api"
|
||||
if [[ $ret -eq 0 ]]
|
||||
then
|
||||
echo "${SPECROOT} up to date."
|
||||
else
|
||||
echo "${SPECROOT} is out of date. Please run hack/update-openapi-spec.sh"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# ex: ts=2 sw=2 et filetype=sh
|
@ -158,6 +158,18 @@ else
|
||||
fi
|
||||
echo "${reset}"
|
||||
|
||||
echo -ne "Checking for openapi spec that need updating... "
|
||||
if ! hack/verify-openapi-spec.sh > /dev/null; then
|
||||
echo "${red}ERROR!"
|
||||
echo "Openapi spec needs to be updated."
|
||||
echo "To regenerate the spec, run:"
|
||||
echo " hack/update-openapi-spec.sh"
|
||||
exit_code=1
|
||||
else
|
||||
echo "${green}OK"
|
||||
fi
|
||||
echo "${reset}"
|
||||
|
||||
if [[ "${exit_code}" != 0 ]]; then
|
||||
echo "${red}Aborting commit${reset}"
|
||||
fi
|
||||
|
@ -183,8 +183,10 @@ func (o *openAPI) buildPaths() error {
|
||||
for _, p := range inPathCommonParamsMap {
|
||||
pathItem.Parameters = append(pathItem.Parameters, p)
|
||||
}
|
||||
sortParameters(pathItem.Parameters)
|
||||
for _, route := range routes {
|
||||
op, err := o.buildOperations(route, inPathCommonParamsMap)
|
||||
sortParameters(op.Parameters)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -287,28 +289,6 @@ func (o *openAPI) buildResponse(model interface{}, description string) (spec.Res
|
||||
}, nil
|
||||
}
|
||||
|
||||
func groupRoutesByPath(routes []restful.Route) (ret map[string][]restful.Route) {
|
||||
ret = make(map[string][]restful.Route)
|
||||
for _, r := range routes {
|
||||
route, exists := ret[r.Path]
|
||||
if !exists {
|
||||
route = make([]restful.Route, 0, 1)
|
||||
}
|
||||
ret[r.Path] = append(route, r)
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
func mapKeyFromParam(param *restful.Parameter) interface{} {
|
||||
return struct {
|
||||
Name string
|
||||
Kind int
|
||||
}{
|
||||
Name: param.Data().Name,
|
||||
Kind: param.Data().Kind,
|
||||
}
|
||||
}
|
||||
|
||||
func (o *openAPI) findCommonParameters(routes []restful.Route) (map[interface{}]spec.Parameter, error) {
|
||||
commonParamsMap := make(map[interface{}]spec.Parameter, 0)
|
||||
paramOpsCountByName := make(map[interface{}]int, 0)
|
||||
@ -412,54 +392,3 @@ func (o *openAPI) buildParameters(restParam []*restful.Parameter) (ret []spec.Pa
|
||||
}
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
// A simple trie implementation with Add an HasPrefix methods only.
|
||||
type trie struct {
|
||||
children map[byte]*trie
|
||||
wordTail bool
|
||||
}
|
||||
|
||||
func createTrie(list []string) trie {
|
||||
ret := trie{
|
||||
children: make(map[byte]*trie),
|
||||
wordTail: false,
|
||||
}
|
||||
for _, v := range list {
|
||||
ret.Add(v)
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
func (t *trie) Add(v string) {
|
||||
root := t
|
||||
for _, b := range []byte(v) {
|
||||
child, exists := root.children[b]
|
||||
if !exists {
|
||||
child = &trie{
|
||||
children: make(map[byte]*trie),
|
||||
wordTail: false,
|
||||
}
|
||||
root.children[b] = child
|
||||
}
|
||||
root = child
|
||||
}
|
||||
root.wordTail = true
|
||||
}
|
||||
|
||||
func (t *trie) HasPrefix(v string) bool {
|
||||
root := t
|
||||
if root.wordTail {
|
||||
return true
|
||||
}
|
||||
for _, b := range []byte(v) {
|
||||
child, exists := root.children[b]
|
||||
if !exists {
|
||||
return false
|
||||
}
|
||||
if child.wordTail {
|
||||
return true
|
||||
}
|
||||
root = child
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
@ -25,7 +25,6 @@ import (
|
||||
"github.com/go-openapi/spec"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"k8s.io/kubernetes/pkg/genericapiserver/openapi/common"
|
||||
"sort"
|
||||
)
|
||||
|
||||
// setUp is a convenience function for setting up for (most) tests.
|
||||
@ -322,35 +321,6 @@ func getAdditionalTestParameters() []spec.Parameter {
|
||||
return ret
|
||||
}
|
||||
|
||||
type Parameters []spec.Parameter
|
||||
|
||||
func (s Parameters) Len() int { return len(s) }
|
||||
func (s Parameters) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
|
||||
|
||||
type ByName struct {
|
||||
Parameters
|
||||
}
|
||||
|
||||
func (s ByName) Less(i, j int) bool {
|
||||
return s.Parameters[i].Name < s.Parameters[j].Name
|
||||
}
|
||||
|
||||
// TODO(mehdy): Consider sort parameters in actual spec generation for more predictable spec generation
|
||||
func sortParameters(s *spec.Swagger) *spec.Swagger {
|
||||
for k, p := range s.Paths.Paths {
|
||||
sort.Sort(ByName{p.Parameters})
|
||||
sort.Sort(ByName{p.Get.Parameters})
|
||||
sort.Sort(ByName{p.Put.Parameters})
|
||||
sort.Sort(ByName{p.Post.Parameters})
|
||||
sort.Sort(ByName{p.Head.Parameters})
|
||||
sort.Sort(ByName{p.Delete.Parameters})
|
||||
sort.Sort(ByName{p.Options.Parameters})
|
||||
sort.Sort(ByName{p.Patch.Parameters})
|
||||
s.Paths.Paths[k] = p // Unnecessary?! Magic!!!
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
func getTestInputDefinition() spec.Schema {
|
||||
return spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
@ -434,8 +404,6 @@ func TestBuildSwaggerSpec(t *testing.T) {
|
||||
}
|
||||
err := o.init()
|
||||
if assert.NoError(err) {
|
||||
sortParameters(expected)
|
||||
sortParameters(o.swagger)
|
||||
assert.Equal(expected, o.swagger)
|
||||
}
|
||||
}
|
||||
|
112
pkg/genericapiserver/openapi/util.go
Normal file
112
pkg/genericapiserver/openapi/util.go
Normal file
@ -0,0 +1,112 @@
|
||||
/*
|
||||
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 openapi
|
||||
|
||||
import (
|
||||
"sort"
|
||||
|
||||
"github.com/emicklei/go-restful"
|
||||
"github.com/go-openapi/spec"
|
||||
)
|
||||
|
||||
type parameters []spec.Parameter
|
||||
|
||||
func (s parameters) Len() int { return len(s) }
|
||||
func (s parameters) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
|
||||
|
||||
// byNameIn used in sorting parameters by Name and In fields.
|
||||
type byNameIn struct {
|
||||
parameters
|
||||
}
|
||||
|
||||
func (s byNameIn) Less(i, j int) bool {
|
||||
return s.parameters[i].Name < s.parameters[j].Name || (s.parameters[i].Name == s.parameters[j].Name && s.parameters[i].In < s.parameters[j].In)
|
||||
}
|
||||
|
||||
// SortParameters sorts parameters by Name and In fields.
|
||||
func sortParameters(p []spec.Parameter) {
|
||||
sort.Sort(byNameIn{p})
|
||||
}
|
||||
|
||||
func groupRoutesByPath(routes []restful.Route) map[string][]restful.Route {
|
||||
pathToRoutes := make(map[string][]restful.Route)
|
||||
for _, r := range routes {
|
||||
pathToRoutes[r.Path] = append(pathToRoutes[r.Path], r)
|
||||
}
|
||||
return pathToRoutes
|
||||
}
|
||||
|
||||
func mapKeyFromParam(param *restful.Parameter) interface{} {
|
||||
return struct {
|
||||
Name string
|
||||
Kind int
|
||||
}{
|
||||
Name: param.Data().Name,
|
||||
Kind: param.Data().Kind,
|
||||
}
|
||||
}
|
||||
|
||||
// A simple trie implementation with Add an HasPrefix methods only.
|
||||
type trie struct {
|
||||
children map[byte]*trie
|
||||
wordTail bool
|
||||
}
|
||||
|
||||
func createTrie(list []string) trie {
|
||||
ret := trie{
|
||||
children: make(map[byte]*trie),
|
||||
wordTail: false,
|
||||
}
|
||||
for _, v := range list {
|
||||
ret.Add(v)
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
func (t *trie) Add(v string) {
|
||||
root := t
|
||||
for _, b := range []byte(v) {
|
||||
child, exists := root.children[b]
|
||||
if !exists {
|
||||
child = &trie{
|
||||
children: make(map[byte]*trie),
|
||||
wordTail: false,
|
||||
}
|
||||
root.children[b] = child
|
||||
}
|
||||
root = child
|
||||
}
|
||||
root.wordTail = true
|
||||
}
|
||||
|
||||
func (t *trie) HasPrefix(v string) bool {
|
||||
root := t
|
||||
if root.wordTail {
|
||||
return true
|
||||
}
|
||||
for _, b := range []byte(v) {
|
||||
child, exists := root.children[b]
|
||||
if !exists {
|
||||
return false
|
||||
}
|
||||
if child.wordTail {
|
||||
return true
|
||||
}
|
||||
root = child
|
||||
}
|
||||
return false
|
||||
}
|
Loading…
Reference in New Issue
Block a user