mirror of https://github.com/k3s-io/k3s
Merge pull request #55413 from liggitt/internal-autoscaling
Automatic merge from submit-queue (batch tested with PRs 53047, 54861, 55413, 55395, 55308). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Switch internal scale type to autoscaling, enable apps/v1 scale subresources xref #49504 * Switch workload internal scale type to autoscaling.Scale (internal-only change) * Enable scale subresources for apps/v1 deployments, replicasets, statefulsets ```release-note NONE ```pull/6/head
commit
ae2edc439e
|
@ -24693,6 +24693,166 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"/apis/apps/v1/namespaces/{namespace}/deployments/{name}/scale": {
|
||||
"get": {
|
||||
"description": "read scale of the specified Deployment",
|
||||
"consumes": [
|
||||
"*/*"
|
||||
],
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/yaml",
|
||||
"application/vnd.kubernetes.protobuf"
|
||||
],
|
||||
"schemes": [
|
||||
"https"
|
||||
],
|
||||
"tags": [
|
||||
"apps_v1"
|
||||
],
|
||||
"operationId": "readAppsV1NamespacedDeploymentScale",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/io.k8s.api.autoscaling.v1.Scale"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized"
|
||||
}
|
||||
},
|
||||
"x-kubernetes-action": "get",
|
||||
"x-kubernetes-group-version-kind": {
|
||||
"group": "autoscaling",
|
||||
"kind": "Scale",
|
||||
"version": "v1"
|
||||
}
|
||||
},
|
||||
"put": {
|
||||
"description": "replace scale of the specified Deployment",
|
||||
"consumes": [
|
||||
"*/*"
|
||||
],
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/yaml",
|
||||
"application/vnd.kubernetes.protobuf"
|
||||
],
|
||||
"schemes": [
|
||||
"https"
|
||||
],
|
||||
"tags": [
|
||||
"apps_v1"
|
||||
],
|
||||
"operationId": "replaceAppsV1NamespacedDeploymentScale",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/io.k8s.api.autoscaling.v1.Scale"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/io.k8s.api.autoscaling.v1.Scale"
|
||||
}
|
||||
},
|
||||
"201": {
|
||||
"description": "Created",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/io.k8s.api.autoscaling.v1.Scale"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized"
|
||||
}
|
||||
},
|
||||
"x-kubernetes-action": "put",
|
||||
"x-kubernetes-group-version-kind": {
|
||||
"group": "autoscaling",
|
||||
"kind": "Scale",
|
||||
"version": "v1"
|
||||
}
|
||||
},
|
||||
"patch": {
|
||||
"description": "partially update scale of the specified Deployment",
|
||||
"consumes": [
|
||||
"application/json-patch+json",
|
||||
"application/merge-patch+json",
|
||||
"application/strategic-merge-patch+json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/yaml",
|
||||
"application/vnd.kubernetes.protobuf"
|
||||
],
|
||||
"schemes": [
|
||||
"https"
|
||||
],
|
||||
"tags": [
|
||||
"apps_v1"
|
||||
],
|
||||
"operationId": "patchAppsV1NamespacedDeploymentScale",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.Patch"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/io.k8s.api.autoscaling.v1.Scale"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized"
|
||||
}
|
||||
},
|
||||
"x-kubernetes-action": "patch",
|
||||
"x-kubernetes-group-version-kind": {
|
||||
"group": "autoscaling",
|
||||
"kind": "Scale",
|
||||
"version": "v1"
|
||||
}
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"uniqueItems": true,
|
||||
"type": "string",
|
||||
"description": "name of the Scale",
|
||||
"name": "name",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"uniqueItems": true,
|
||||
"type": "string",
|
||||
"description": "object name and auth scope, such as for teams and projects",
|
||||
"name": "namespace",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"uniqueItems": true,
|
||||
"type": "string",
|
||||
"description": "If 'true', then the output is pretty printed.",
|
||||
"name": "pretty",
|
||||
"in": "query"
|
||||
}
|
||||
]
|
||||
},
|
||||
"/apis/apps/v1/namespaces/{namespace}/deployments/{name}/status": {
|
||||
"get": {
|
||||
"description": "read status of the specified Deployment",
|
||||
|
@ -25359,6 +25519,166 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"/apis/apps/v1/namespaces/{namespace}/replicasets/{name}/scale": {
|
||||
"get": {
|
||||
"description": "read scale of the specified ReplicaSet",
|
||||
"consumes": [
|
||||
"*/*"
|
||||
],
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/yaml",
|
||||
"application/vnd.kubernetes.protobuf"
|
||||
],
|
||||
"schemes": [
|
||||
"https"
|
||||
],
|
||||
"tags": [
|
||||
"apps_v1"
|
||||
],
|
||||
"operationId": "readAppsV1NamespacedReplicaSetScale",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/io.k8s.api.autoscaling.v1.Scale"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized"
|
||||
}
|
||||
},
|
||||
"x-kubernetes-action": "get",
|
||||
"x-kubernetes-group-version-kind": {
|
||||
"group": "autoscaling",
|
||||
"kind": "Scale",
|
||||
"version": "v1"
|
||||
}
|
||||
},
|
||||
"put": {
|
||||
"description": "replace scale of the specified ReplicaSet",
|
||||
"consumes": [
|
||||
"*/*"
|
||||
],
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/yaml",
|
||||
"application/vnd.kubernetes.protobuf"
|
||||
],
|
||||
"schemes": [
|
||||
"https"
|
||||
],
|
||||
"tags": [
|
||||
"apps_v1"
|
||||
],
|
||||
"operationId": "replaceAppsV1NamespacedReplicaSetScale",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/io.k8s.api.autoscaling.v1.Scale"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/io.k8s.api.autoscaling.v1.Scale"
|
||||
}
|
||||
},
|
||||
"201": {
|
||||
"description": "Created",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/io.k8s.api.autoscaling.v1.Scale"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized"
|
||||
}
|
||||
},
|
||||
"x-kubernetes-action": "put",
|
||||
"x-kubernetes-group-version-kind": {
|
||||
"group": "autoscaling",
|
||||
"kind": "Scale",
|
||||
"version": "v1"
|
||||
}
|
||||
},
|
||||
"patch": {
|
||||
"description": "partially update scale of the specified ReplicaSet",
|
||||
"consumes": [
|
||||
"application/json-patch+json",
|
||||
"application/merge-patch+json",
|
||||
"application/strategic-merge-patch+json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/yaml",
|
||||
"application/vnd.kubernetes.protobuf"
|
||||
],
|
||||
"schemes": [
|
||||
"https"
|
||||
],
|
||||
"tags": [
|
||||
"apps_v1"
|
||||
],
|
||||
"operationId": "patchAppsV1NamespacedReplicaSetScale",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.Patch"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/io.k8s.api.autoscaling.v1.Scale"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized"
|
||||
}
|
||||
},
|
||||
"x-kubernetes-action": "patch",
|
||||
"x-kubernetes-group-version-kind": {
|
||||
"group": "autoscaling",
|
||||
"kind": "Scale",
|
||||
"version": "v1"
|
||||
}
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"uniqueItems": true,
|
||||
"type": "string",
|
||||
"description": "name of the Scale",
|
||||
"name": "name",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"uniqueItems": true,
|
||||
"type": "string",
|
||||
"description": "object name and auth scope, such as for teams and projects",
|
||||
"name": "namespace",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"uniqueItems": true,
|
||||
"type": "string",
|
||||
"description": "If 'true', then the output is pretty printed.",
|
||||
"name": "pretty",
|
||||
"in": "query"
|
||||
}
|
||||
]
|
||||
},
|
||||
"/apis/apps/v1/namespaces/{namespace}/replicasets/{name}/status": {
|
||||
"get": {
|
||||
"description": "read status of the specified ReplicaSet",
|
||||
|
@ -26025,6 +26345,166 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"/apis/apps/v1/namespaces/{namespace}/statefulsets/{name}/scale": {
|
||||
"get": {
|
||||
"description": "read scale of the specified StatefulSet",
|
||||
"consumes": [
|
||||
"*/*"
|
||||
],
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/yaml",
|
||||
"application/vnd.kubernetes.protobuf"
|
||||
],
|
||||
"schemes": [
|
||||
"https"
|
||||
],
|
||||
"tags": [
|
||||
"apps_v1"
|
||||
],
|
||||
"operationId": "readAppsV1NamespacedStatefulSetScale",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/io.k8s.api.autoscaling.v1.Scale"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized"
|
||||
}
|
||||
},
|
||||
"x-kubernetes-action": "get",
|
||||
"x-kubernetes-group-version-kind": {
|
||||
"group": "autoscaling",
|
||||
"kind": "Scale",
|
||||
"version": "v1"
|
||||
}
|
||||
},
|
||||
"put": {
|
||||
"description": "replace scale of the specified StatefulSet",
|
||||
"consumes": [
|
||||
"*/*"
|
||||
],
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/yaml",
|
||||
"application/vnd.kubernetes.protobuf"
|
||||
],
|
||||
"schemes": [
|
||||
"https"
|
||||
],
|
||||
"tags": [
|
||||
"apps_v1"
|
||||
],
|
||||
"operationId": "replaceAppsV1NamespacedStatefulSetScale",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/io.k8s.api.autoscaling.v1.Scale"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/io.k8s.api.autoscaling.v1.Scale"
|
||||
}
|
||||
},
|
||||
"201": {
|
||||
"description": "Created",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/io.k8s.api.autoscaling.v1.Scale"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized"
|
||||
}
|
||||
},
|
||||
"x-kubernetes-action": "put",
|
||||
"x-kubernetes-group-version-kind": {
|
||||
"group": "autoscaling",
|
||||
"kind": "Scale",
|
||||
"version": "v1"
|
||||
}
|
||||
},
|
||||
"patch": {
|
||||
"description": "partially update scale of the specified StatefulSet",
|
||||
"consumes": [
|
||||
"application/json-patch+json",
|
||||
"application/merge-patch+json",
|
||||
"application/strategic-merge-patch+json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/yaml",
|
||||
"application/vnd.kubernetes.protobuf"
|
||||
],
|
||||
"schemes": [
|
||||
"https"
|
||||
],
|
||||
"tags": [
|
||||
"apps_v1"
|
||||
],
|
||||
"operationId": "patchAppsV1NamespacedStatefulSetScale",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.Patch"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/io.k8s.api.autoscaling.v1.Scale"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized"
|
||||
}
|
||||
},
|
||||
"x-kubernetes-action": "patch",
|
||||
"x-kubernetes-group-version-kind": {
|
||||
"group": "autoscaling",
|
||||
"kind": "Scale",
|
||||
"version": "v1"
|
||||
}
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"uniqueItems": true,
|
||||
"type": "string",
|
||||
"description": "name of the Scale",
|
||||
"name": "name",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"uniqueItems": true,
|
||||
"type": "string",
|
||||
"description": "object name and auth scope, such as for teams and projects",
|
||||
"name": "namespace",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"uniqueItems": true,
|
||||
"type": "string",
|
||||
"description": "If 'true', then the output is pretty printed.",
|
||||
"name": "pretty",
|
||||
"in": "query"
|
||||
}
|
||||
]
|
||||
},
|
||||
"/apis/apps/v1/namespaces/{namespace}/statefulsets/{name}/status": {
|
||||
"get": {
|
||||
"description": "read status of the specified StatefulSet",
|
||||
|
|
|
@ -3094,6 +3094,176 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/apis/apps/v1/namespaces/{namespace}/deployments/{name}/scale",
|
||||
"description": "API at /apis/apps/v1",
|
||||
"operations": [
|
||||
{
|
||||
"type": "v1.Scale",
|
||||
"method": "GET",
|
||||
"summary": "read scale of the specified Deployment",
|
||||
"nickname": "readNamespacedDeploymentScale",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"paramType": "query",
|
||||
"name": "pretty",
|
||||
"description": "If 'true', then the output is pretty printed.",
|
||||
"required": false,
|
||||
"allowMultiple": false
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"paramType": "path",
|
||||
"name": "namespace",
|
||||
"description": "object name and auth scope, such as for teams and projects",
|
||||
"required": true,
|
||||
"allowMultiple": false
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"paramType": "path",
|
||||
"name": "name",
|
||||
"description": "name of the Scale",
|
||||
"required": true,
|
||||
"allowMultiple": false
|
||||
}
|
||||
],
|
||||
"responseMessages": [
|
||||
{
|
||||
"code": 200,
|
||||
"message": "OK",
|
||||
"responseModel": "v1.Scale"
|
||||
}
|
||||
],
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/yaml",
|
||||
"application/vnd.kubernetes.protobuf"
|
||||
],
|
||||
"consumes": [
|
||||
"*/*"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "v1.Scale",
|
||||
"method": "PUT",
|
||||
"summary": "replace scale of the specified Deployment",
|
||||
"nickname": "replaceNamespacedDeploymentScale",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"paramType": "query",
|
||||
"name": "pretty",
|
||||
"description": "If 'true', then the output is pretty printed.",
|
||||
"required": false,
|
||||
"allowMultiple": false
|
||||
},
|
||||
{
|
||||
"type": "v1.Scale",
|
||||
"paramType": "body",
|
||||
"name": "body",
|
||||
"description": "",
|
||||
"required": true,
|
||||
"allowMultiple": false
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"paramType": "path",
|
||||
"name": "namespace",
|
||||
"description": "object name and auth scope, such as for teams and projects",
|
||||
"required": true,
|
||||
"allowMultiple": false
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"paramType": "path",
|
||||
"name": "name",
|
||||
"description": "name of the Scale",
|
||||
"required": true,
|
||||
"allowMultiple": false
|
||||
}
|
||||
],
|
||||
"responseMessages": [
|
||||
{
|
||||
"code": 200,
|
||||
"message": "OK",
|
||||
"responseModel": "v1.Scale"
|
||||
},
|
||||
{
|
||||
"code": 201,
|
||||
"message": "Created",
|
||||
"responseModel": "v1.Scale"
|
||||
}
|
||||
],
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/yaml",
|
||||
"application/vnd.kubernetes.protobuf"
|
||||
],
|
||||
"consumes": [
|
||||
"*/*"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "v1.Scale",
|
||||
"method": "PATCH",
|
||||
"summary": "partially update scale of the specified Deployment",
|
||||
"nickname": "patchNamespacedDeploymentScale",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"paramType": "query",
|
||||
"name": "pretty",
|
||||
"description": "If 'true', then the output is pretty printed.",
|
||||
"required": false,
|
||||
"allowMultiple": false
|
||||
},
|
||||
{
|
||||
"type": "v1.Patch",
|
||||
"paramType": "body",
|
||||
"name": "body",
|
||||
"description": "",
|
||||
"required": true,
|
||||
"allowMultiple": false
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"paramType": "path",
|
||||
"name": "namespace",
|
||||
"description": "object name and auth scope, such as for teams and projects",
|
||||
"required": true,
|
||||
"allowMultiple": false
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"paramType": "path",
|
||||
"name": "name",
|
||||
"description": "name of the Scale",
|
||||
"required": true,
|
||||
"allowMultiple": false
|
||||
}
|
||||
],
|
||||
"responseMessages": [
|
||||
{
|
||||
"code": 200,
|
||||
"message": "OK",
|
||||
"responseModel": "v1.Scale"
|
||||
}
|
||||
],
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/yaml",
|
||||
"application/vnd.kubernetes.protobuf"
|
||||
],
|
||||
"consumes": [
|
||||
"application/json-patch+json",
|
||||
"application/merge-patch+json",
|
||||
"application/strategic-merge-patch+json"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/apis/apps/v1/namespaces/{namespace}/deployments/{name}/status",
|
||||
"description": "API at /apis/apps/v1",
|
||||
|
@ -4236,6 +4406,176 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/apis/apps/v1/namespaces/{namespace}/replicasets/{name}/scale",
|
||||
"description": "API at /apis/apps/v1",
|
||||
"operations": [
|
||||
{
|
||||
"type": "v1.Scale",
|
||||
"method": "GET",
|
||||
"summary": "read scale of the specified ReplicaSet",
|
||||
"nickname": "readNamespacedReplicaSetScale",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"paramType": "query",
|
||||
"name": "pretty",
|
||||
"description": "If 'true', then the output is pretty printed.",
|
||||
"required": false,
|
||||
"allowMultiple": false
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"paramType": "path",
|
||||
"name": "namespace",
|
||||
"description": "object name and auth scope, such as for teams and projects",
|
||||
"required": true,
|
||||
"allowMultiple": false
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"paramType": "path",
|
||||
"name": "name",
|
||||
"description": "name of the Scale",
|
||||
"required": true,
|
||||
"allowMultiple": false
|
||||
}
|
||||
],
|
||||
"responseMessages": [
|
||||
{
|
||||
"code": 200,
|
||||
"message": "OK",
|
||||
"responseModel": "v1.Scale"
|
||||
}
|
||||
],
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/yaml",
|
||||
"application/vnd.kubernetes.protobuf"
|
||||
],
|
||||
"consumes": [
|
||||
"*/*"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "v1.Scale",
|
||||
"method": "PUT",
|
||||
"summary": "replace scale of the specified ReplicaSet",
|
||||
"nickname": "replaceNamespacedReplicaSetScale",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"paramType": "query",
|
||||
"name": "pretty",
|
||||
"description": "If 'true', then the output is pretty printed.",
|
||||
"required": false,
|
||||
"allowMultiple": false
|
||||
},
|
||||
{
|
||||
"type": "v1.Scale",
|
||||
"paramType": "body",
|
||||
"name": "body",
|
||||
"description": "",
|
||||
"required": true,
|
||||
"allowMultiple": false
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"paramType": "path",
|
||||
"name": "namespace",
|
||||
"description": "object name and auth scope, such as for teams and projects",
|
||||
"required": true,
|
||||
"allowMultiple": false
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"paramType": "path",
|
||||
"name": "name",
|
||||
"description": "name of the Scale",
|
||||
"required": true,
|
||||
"allowMultiple": false
|
||||
}
|
||||
],
|
||||
"responseMessages": [
|
||||
{
|
||||
"code": 200,
|
||||
"message": "OK",
|
||||
"responseModel": "v1.Scale"
|
||||
},
|
||||
{
|
||||
"code": 201,
|
||||
"message": "Created",
|
||||
"responseModel": "v1.Scale"
|
||||
}
|
||||
],
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/yaml",
|
||||
"application/vnd.kubernetes.protobuf"
|
||||
],
|
||||
"consumes": [
|
||||
"*/*"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "v1.Scale",
|
||||
"method": "PATCH",
|
||||
"summary": "partially update scale of the specified ReplicaSet",
|
||||
"nickname": "patchNamespacedReplicaSetScale",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"paramType": "query",
|
||||
"name": "pretty",
|
||||
"description": "If 'true', then the output is pretty printed.",
|
||||
"required": false,
|
||||
"allowMultiple": false
|
||||
},
|
||||
{
|
||||
"type": "v1.Patch",
|
||||
"paramType": "body",
|
||||
"name": "body",
|
||||
"description": "",
|
||||
"required": true,
|
||||
"allowMultiple": false
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"paramType": "path",
|
||||
"name": "namespace",
|
||||
"description": "object name and auth scope, such as for teams and projects",
|
||||
"required": true,
|
||||
"allowMultiple": false
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"paramType": "path",
|
||||
"name": "name",
|
||||
"description": "name of the Scale",
|
||||
"required": true,
|
||||
"allowMultiple": false
|
||||
}
|
||||
],
|
||||
"responseMessages": [
|
||||
{
|
||||
"code": 200,
|
||||
"message": "OK",
|
||||
"responseModel": "v1.Scale"
|
||||
}
|
||||
],
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/yaml",
|
||||
"application/vnd.kubernetes.protobuf"
|
||||
],
|
||||
"consumes": [
|
||||
"application/json-patch+json",
|
||||
"application/merge-patch+json",
|
||||
"application/strategic-merge-patch+json"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/apis/apps/v1/namespaces/{namespace}/replicasets/{name}/status",
|
||||
"description": "API at /apis/apps/v1",
|
||||
|
@ -5378,6 +5718,176 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/apis/apps/v1/namespaces/{namespace}/statefulsets/{name}/scale",
|
||||
"description": "API at /apis/apps/v1",
|
||||
"operations": [
|
||||
{
|
||||
"type": "v1.Scale",
|
||||
"method": "GET",
|
||||
"summary": "read scale of the specified StatefulSet",
|
||||
"nickname": "readNamespacedStatefulSetScale",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"paramType": "query",
|
||||
"name": "pretty",
|
||||
"description": "If 'true', then the output is pretty printed.",
|
||||
"required": false,
|
||||
"allowMultiple": false
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"paramType": "path",
|
||||
"name": "namespace",
|
||||
"description": "object name and auth scope, such as for teams and projects",
|
||||
"required": true,
|
||||
"allowMultiple": false
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"paramType": "path",
|
||||
"name": "name",
|
||||
"description": "name of the Scale",
|
||||
"required": true,
|
||||
"allowMultiple": false
|
||||
}
|
||||
],
|
||||
"responseMessages": [
|
||||
{
|
||||
"code": 200,
|
||||
"message": "OK",
|
||||
"responseModel": "v1.Scale"
|
||||
}
|
||||
],
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/yaml",
|
||||
"application/vnd.kubernetes.protobuf"
|
||||
],
|
||||
"consumes": [
|
||||
"*/*"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "v1.Scale",
|
||||
"method": "PUT",
|
||||
"summary": "replace scale of the specified StatefulSet",
|
||||
"nickname": "replaceNamespacedStatefulSetScale",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"paramType": "query",
|
||||
"name": "pretty",
|
||||
"description": "If 'true', then the output is pretty printed.",
|
||||
"required": false,
|
||||
"allowMultiple": false
|
||||
},
|
||||
{
|
||||
"type": "v1.Scale",
|
||||
"paramType": "body",
|
||||
"name": "body",
|
||||
"description": "",
|
||||
"required": true,
|
||||
"allowMultiple": false
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"paramType": "path",
|
||||
"name": "namespace",
|
||||
"description": "object name and auth scope, such as for teams and projects",
|
||||
"required": true,
|
||||
"allowMultiple": false
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"paramType": "path",
|
||||
"name": "name",
|
||||
"description": "name of the Scale",
|
||||
"required": true,
|
||||
"allowMultiple": false
|
||||
}
|
||||
],
|
||||
"responseMessages": [
|
||||
{
|
||||
"code": 200,
|
||||
"message": "OK",
|
||||
"responseModel": "v1.Scale"
|
||||
},
|
||||
{
|
||||
"code": 201,
|
||||
"message": "Created",
|
||||
"responseModel": "v1.Scale"
|
||||
}
|
||||
],
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/yaml",
|
||||
"application/vnd.kubernetes.protobuf"
|
||||
],
|
||||
"consumes": [
|
||||
"*/*"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "v1.Scale",
|
||||
"method": "PATCH",
|
||||
"summary": "partially update scale of the specified StatefulSet",
|
||||
"nickname": "patchNamespacedStatefulSetScale",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"paramType": "query",
|
||||
"name": "pretty",
|
||||
"description": "If 'true', then the output is pretty printed.",
|
||||
"required": false,
|
||||
"allowMultiple": false
|
||||
},
|
||||
{
|
||||
"type": "v1.Patch",
|
||||
"paramType": "body",
|
||||
"name": "body",
|
||||
"description": "",
|
||||
"required": true,
|
||||
"allowMultiple": false
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"paramType": "path",
|
||||
"name": "namespace",
|
||||
"description": "object name and auth scope, such as for teams and projects",
|
||||
"required": true,
|
||||
"allowMultiple": false
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"paramType": "path",
|
||||
"name": "name",
|
||||
"description": "name of the Scale",
|
||||
"required": true,
|
||||
"allowMultiple": false
|
||||
}
|
||||
],
|
||||
"responseMessages": [
|
||||
{
|
||||
"code": 200,
|
||||
"message": "OK",
|
||||
"responseModel": "v1.Scale"
|
||||
}
|
||||
],
|
||||
"produces": [
|
||||
"application/json",
|
||||
"application/yaml",
|
||||
"application/vnd.kubernetes.protobuf"
|
||||
],
|
||||
"consumes": [
|
||||
"application/json-patch+json",
|
||||
"application/merge-patch+json",
|
||||
"application/strategic-merge-patch+json"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"path": "/apis/apps/v1/namespaces/{namespace}/statefulsets/{name}/status",
|
||||
"description": "API at /apis/apps/v1",
|
||||
|
@ -8395,6 +8905,61 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"v1.Scale": {
|
||||
"id": "v1.Scale",
|
||||
"description": "Scale represents a scaling request for a resource.",
|
||||
"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: https://git.k8s.io/community/contributors/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: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources"
|
||||
},
|
||||
"metadata": {
|
||||
"$ref": "v1.ObjectMeta",
|
||||
"description": "Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata."
|
||||
},
|
||||
"spec": {
|
||||
"$ref": "v1.ScaleSpec",
|
||||
"description": "defines the behavior of the scale. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status."
|
||||
},
|
||||
"status": {
|
||||
"$ref": "v1.ScaleStatus",
|
||||
"description": "current status of the scale. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status. Read-only."
|
||||
}
|
||||
}
|
||||
},
|
||||
"v1.ScaleSpec": {
|
||||
"id": "v1.ScaleSpec",
|
||||
"description": "ScaleSpec describes the attributes of a scale subresource.",
|
||||
"properties": {
|
||||
"replicas": {
|
||||
"type": "integer",
|
||||
"format": "int32",
|
||||
"description": "desired number of instances for the scaled object."
|
||||
}
|
||||
}
|
||||
},
|
||||
"v1.ScaleStatus": {
|
||||
"id": "v1.ScaleStatus",
|
||||
"description": "ScaleStatus represents the current status of a scale subresource.",
|
||||
"required": [
|
||||
"replicas"
|
||||
],
|
||||
"properties": {
|
||||
"replicas": {
|
||||
"type": "integer",
|
||||
"format": "int32",
|
||||
"description": "actual number of observed instances of the scaled object."
|
||||
},
|
||||
"selector": {
|
||||
"type": "string",
|
||||
"description": "label query over pods that should match the replicas count. This is same as the label selector but in the string format to avoid introspection by clients. The string will be in the same format as the query-param syntax. More info about label selectors: http://kubernetes.io/docs/user-guide/labels#label-selectors"
|
||||
}
|
||||
}
|
||||
},
|
||||
"v1.ReplicaSetList": {
|
||||
"id": "v1.ReplicaSetList",
|
||||
"description": "ReplicaSetList is a collection of ReplicaSets.",
|
||||
|
|
|
@ -1413,6 +1413,47 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
|
|||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_v1_scalestatus">v1.ScaleStatus</h3>
|
||||
<div class="paragraph">
|
||||
<p>ScaleStatus represents the current status of a scale subresource.</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">replicas</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">actual number of observed instances of the scaled object.</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">integer (int32)</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">selector</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">label query over pods that should match the replicas count. This is same as the label selector but in the string format to avoid introspection by clients. The string will be in the same format as the query-param syntax. More info about label selectors: <a href="http://kubernetes.io/docs/user-guide/labels#label-selectors">http://kubernetes.io/docs/user-guide/labels#label-selectors</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>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_v1_portworxvolumesource">v1.PortworxVolumeSource</h3>
|
||||
|
@ -2680,6 +2721,68 @@ When an object is created, the system will populate this list with the current s
|
|||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_v1_scale">v1.Scale</h3>
|
||||
<div class="paragraph">
|
||||
<p>Scale represents a scaling request for a resource.</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="https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds">https://git.k8s.io/community/contributors/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="https://git.k8s.io/community/contributors/devel/api-conventions.md#resources">https://git.k8s.io/community/contributors/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 metadata; More info: <a href="https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata">https://git.k8s.io/community/contributors/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">spec</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">defines the behavior of the scale. More info: <a href="https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status">https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status</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_scalespec">v1.ScaleSpec</a></p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">status</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">current status of the scale. More info: <a href="https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status">https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status</a>. Read-only.</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_scalestatus">v1.ScaleStatus</a></p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_v1_keytopath">v1.KeyToPath</h3>
|
||||
|
@ -5660,6 +5763,40 @@ Examples:<br>
|
|||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_v1_scalespec">v1.ScaleSpec</h3>
|
||||
<div class="paragraph">
|
||||
<p>ScaleSpec describes the attributes of a scale subresource.</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">replicas</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">desired number of instances for the scaled object.</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">integer (int32)</p></td>
|
||||
<td class="tableblock halign-left valign-top"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_v1_rollingupdatedeployment">v1.RollingUpdateDeployment</h3>
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -15,6 +15,7 @@ go_library(
|
|||
],
|
||||
importpath = "k8s.io/kubernetes/pkg/apis/apps",
|
||||
deps = [
|
||||
"//pkg/apis/autoscaling:go_default_library",
|
||||
"//pkg/apis/core:go_default_library",
|
||||
"//pkg/apis/extensions:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||
|
|
|
@ -19,6 +19,7 @@ package apps
|
|||
import (
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/kubernetes/pkg/apis/autoscaling"
|
||||
"k8s.io/kubernetes/pkg/apis/extensions"
|
||||
)
|
||||
|
||||
|
@ -52,7 +53,7 @@ func addKnownTypes(scheme *runtime.Scheme) error {
|
|||
&extensions.Deployment{},
|
||||
&extensions.DeploymentList{},
|
||||
&extensions.DeploymentRollback{},
|
||||
&extensions.Scale{},
|
||||
&autoscaling.Scale{},
|
||||
&StatefulSet{},
|
||||
&StatefulSetList{},
|
||||
&ControllerRevision{},
|
||||
|
|
|
@ -23,8 +23,8 @@ import (
|
|||
)
|
||||
|
||||
// +genclient
|
||||
// +genclient:method=GetScale,verb=get,subresource=scale,result=k8s.io/kubernetes/pkg/apis/extensions.Scale
|
||||
// +genclient:method=UpdateScale,verb=update,subresource=scale,input=k8s.io/kubernetes/pkg/apis/extensions.Scale,result=k8s.io/kubernetes/pkg/apis/extensions.Scale
|
||||
// +genclient:method=GetScale,verb=get,subresource=scale,result=k8s.io/kubernetes/pkg/apis/autoscaling.Scale
|
||||
// +genclient:method=UpdateScale,verb=update,subresource=scale,input=k8s.io/kubernetes/pkg/apis/autoscaling.Scale,result=k8s.io/kubernetes/pkg/apis/autoscaling.Scale
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// StatefulSet represents a set of pods with consistent identities.
|
||||
|
|
|
@ -19,6 +19,7 @@ go_library(
|
|||
importpath = "k8s.io/kubernetes/pkg/apis/apps/v1beta1",
|
||||
deps = [
|
||||
"//pkg/apis/apps:go_default_library",
|
||||
"//pkg/apis/autoscaling:go_default_library",
|
||||
"//pkg/apis/core:go_default_library",
|
||||
"//pkg/apis/core/v1:go_default_library",
|
||||
"//pkg/apis/extensions:go_default_library",
|
||||
|
@ -26,6 +27,7 @@ go_library(
|
|||
"//vendor/k8s.io/api/core/v1:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/conversion:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/labels:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/util/intstr:go_default_library",
|
||||
|
|
|
@ -23,9 +23,11 @@ import (
|
|||
"k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/conversion"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
"k8s.io/kubernetes/pkg/apis/apps"
|
||||
"k8s.io/kubernetes/pkg/apis/autoscaling"
|
||||
api "k8s.io/kubernetes/pkg/apis/core"
|
||||
k8s_api_v1 "k8s.io/kubernetes/pkg/apis/core/v1"
|
||||
"k8s.io/kubernetes/pkg/apis/extensions"
|
||||
|
@ -44,8 +46,8 @@ func addConversionFuncs(scheme *runtime.Scheme) error {
|
|||
// extensions
|
||||
// TODO: below conversions should be dropped in favor of auto-generated
|
||||
// ones, see https://github.com/kubernetes/kubernetes/issues/39865
|
||||
Convert_v1beta1_ScaleStatus_To_extensions_ScaleStatus,
|
||||
Convert_extensions_ScaleStatus_To_v1beta1_ScaleStatus,
|
||||
Convert_v1beta1_ScaleStatus_To_autoscaling_ScaleStatus,
|
||||
Convert_autoscaling_ScaleStatus_To_v1beta1_ScaleStatus,
|
||||
Convert_v1beta1_DeploymentSpec_To_extensions_DeploymentSpec,
|
||||
Convert_extensions_DeploymentSpec_To_v1beta1_DeploymentSpec,
|
||||
Convert_v1beta1_DeploymentStrategy_To_extensions_DeploymentStrategy,
|
||||
|
@ -178,48 +180,35 @@ func Convert_apps_StatefulSetUpdateStrategy_To_v1beta1_StatefulSetUpdateStrategy
|
|||
return nil
|
||||
}
|
||||
|
||||
func Convert_extensions_ScaleStatus_To_v1beta1_ScaleStatus(in *extensions.ScaleStatus, out *appsv1beta1.ScaleStatus, s conversion.Scope) error {
|
||||
func Convert_autoscaling_ScaleStatus_To_v1beta1_ScaleStatus(in *autoscaling.ScaleStatus, out *appsv1beta1.ScaleStatus, s conversion.Scope) error {
|
||||
out.Replicas = int32(in.Replicas)
|
||||
out.TargetSelector = in.Selector
|
||||
|
||||
out.Selector = nil
|
||||
out.TargetSelector = ""
|
||||
if in.Selector != nil {
|
||||
if in.Selector.MatchExpressions == nil || len(in.Selector.MatchExpressions) == 0 {
|
||||
out.Selector = in.Selector.MatchLabels
|
||||
}
|
||||
|
||||
selector, err := metav1.LabelSelectorAsSelector(in.Selector)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid label selector: %v", err)
|
||||
}
|
||||
out.TargetSelector = selector.String()
|
||||
selector, err := metav1.ParseToLabelSelector(in.Selector)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to parse selector: %v", err)
|
||||
}
|
||||
if len(selector.MatchExpressions) == 0 {
|
||||
out.Selector = selector.MatchLabels
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_v1beta1_ScaleStatus_To_extensions_ScaleStatus(in *appsv1beta1.ScaleStatus, out *extensions.ScaleStatus, s conversion.Scope) error {
|
||||
func Convert_v1beta1_ScaleStatus_To_autoscaling_ScaleStatus(in *appsv1beta1.ScaleStatus, out *autoscaling.ScaleStatus, s conversion.Scope) error {
|
||||
out.Replicas = in.Replicas
|
||||
|
||||
// Normally when 2 fields map to the same internal value we favor the old field, since
|
||||
// old clients can't be expected to know about new fields but clients that know about the
|
||||
// new field can be expected to know about the old field (though that's not quite true, due
|
||||
// to kubectl apply). However, these fields are readonly, so any non-nil value should work.
|
||||
if in.TargetSelector != "" {
|
||||
labelSelector, err := metav1.ParseToLabelSelector(in.TargetSelector)
|
||||
if err != nil {
|
||||
out.Selector = nil
|
||||
return fmt.Errorf("failed to parse target selector: %v", err)
|
||||
}
|
||||
out.Selector = labelSelector
|
||||
out.Selector = in.TargetSelector
|
||||
} else if in.Selector != nil {
|
||||
out.Selector = new(metav1.LabelSelector)
|
||||
selector := make(map[string]string)
|
||||
set := labels.Set{}
|
||||
for key, val := range in.Selector {
|
||||
selector[key] = val
|
||||
set[key] = val
|
||||
}
|
||||
out.Selector.MatchLabels = selector
|
||||
out.Selector = labels.SelectorFromSet(set).String()
|
||||
} else {
|
||||
out.Selector = nil
|
||||
out.Selector = ""
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ limitations under the License.
|
|||
*/
|
||||
|
||||
// +k8s:conversion-gen=k8s.io/kubernetes/pkg/apis/apps
|
||||
// +k8s:conversion-gen=k8s.io/kubernetes/pkg/apis/autoscaling
|
||||
// +k8s:conversion-gen=k8s.io/kubernetes/pkg/apis/extensions
|
||||
// +k8s:conversion-gen-external-types=../../../../vendor/k8s.io/api/apps/v1beta1
|
||||
// +k8s:defaulter-gen=TypeMeta
|
||||
|
|
|
@ -27,6 +27,7 @@ import (
|
|||
conversion "k8s.io/apimachinery/pkg/conversion"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
apps "k8s.io/kubernetes/pkg/apis/apps"
|
||||
autoscaling "k8s.io/kubernetes/pkg/apis/autoscaling"
|
||||
core "k8s.io/kubernetes/pkg/apis/core"
|
||||
core_v1 "k8s.io/kubernetes/pkg/apis/core/v1"
|
||||
extensions "k8s.io/kubernetes/pkg/apis/extensions"
|
||||
|
@ -65,12 +66,12 @@ func RegisterConversions(scheme *runtime.Scheme) error {
|
|||
Convert_extensions_RollingUpdateDeployment_To_v1beta1_RollingUpdateDeployment,
|
||||
Convert_v1beta1_RollingUpdateStatefulSetStrategy_To_apps_RollingUpdateStatefulSetStrategy,
|
||||
Convert_apps_RollingUpdateStatefulSetStrategy_To_v1beta1_RollingUpdateStatefulSetStrategy,
|
||||
Convert_v1beta1_Scale_To_extensions_Scale,
|
||||
Convert_extensions_Scale_To_v1beta1_Scale,
|
||||
Convert_v1beta1_ScaleSpec_To_extensions_ScaleSpec,
|
||||
Convert_extensions_ScaleSpec_To_v1beta1_ScaleSpec,
|
||||
Convert_v1beta1_ScaleStatus_To_extensions_ScaleStatus,
|
||||
Convert_extensions_ScaleStatus_To_v1beta1_ScaleStatus,
|
||||
Convert_v1beta1_Scale_To_autoscaling_Scale,
|
||||
Convert_autoscaling_Scale_To_v1beta1_Scale,
|
||||
Convert_v1beta1_ScaleSpec_To_autoscaling_ScaleSpec,
|
||||
Convert_autoscaling_ScaleSpec_To_v1beta1_ScaleSpec,
|
||||
Convert_v1beta1_ScaleStatus_To_autoscaling_ScaleStatus,
|
||||
Convert_autoscaling_ScaleStatus_To_v1beta1_ScaleStatus,
|
||||
Convert_v1beta1_StatefulSet_To_apps_StatefulSet,
|
||||
Convert_apps_StatefulSet_To_v1beta1_StatefulSet,
|
||||
Convert_v1beta1_StatefulSetCondition_To_apps_StatefulSetCondition,
|
||||
|
@ -444,68 +445,68 @@ func Convert_apps_RollingUpdateStatefulSetStrategy_To_v1beta1_RollingUpdateState
|
|||
return autoConvert_apps_RollingUpdateStatefulSetStrategy_To_v1beta1_RollingUpdateStatefulSetStrategy(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1beta1_Scale_To_extensions_Scale(in *v1beta1.Scale, out *extensions.Scale, s conversion.Scope) error {
|
||||
func autoConvert_v1beta1_Scale_To_autoscaling_Scale(in *v1beta1.Scale, out *autoscaling.Scale, s conversion.Scope) error {
|
||||
out.ObjectMeta = in.ObjectMeta
|
||||
if err := Convert_v1beta1_ScaleSpec_To_extensions_ScaleSpec(&in.Spec, &out.Spec, s); err != nil {
|
||||
if err := Convert_v1beta1_ScaleSpec_To_autoscaling_ScaleSpec(&in.Spec, &out.Spec, s); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := Convert_v1beta1_ScaleStatus_To_extensions_ScaleStatus(&in.Status, &out.Status, s); err != nil {
|
||||
if err := Convert_v1beta1_ScaleStatus_To_autoscaling_ScaleStatus(&in.Status, &out.Status, s); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1beta1_Scale_To_extensions_Scale is an autogenerated conversion function.
|
||||
func Convert_v1beta1_Scale_To_extensions_Scale(in *v1beta1.Scale, out *extensions.Scale, s conversion.Scope) error {
|
||||
return autoConvert_v1beta1_Scale_To_extensions_Scale(in, out, s)
|
||||
// Convert_v1beta1_Scale_To_autoscaling_Scale is an autogenerated conversion function.
|
||||
func Convert_v1beta1_Scale_To_autoscaling_Scale(in *v1beta1.Scale, out *autoscaling.Scale, s conversion.Scope) error {
|
||||
return autoConvert_v1beta1_Scale_To_autoscaling_Scale(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_extensions_Scale_To_v1beta1_Scale(in *extensions.Scale, out *v1beta1.Scale, s conversion.Scope) error {
|
||||
func autoConvert_autoscaling_Scale_To_v1beta1_Scale(in *autoscaling.Scale, out *v1beta1.Scale, s conversion.Scope) error {
|
||||
out.ObjectMeta = in.ObjectMeta
|
||||
if err := Convert_extensions_ScaleSpec_To_v1beta1_ScaleSpec(&in.Spec, &out.Spec, s); err != nil {
|
||||
if err := Convert_autoscaling_ScaleSpec_To_v1beta1_ScaleSpec(&in.Spec, &out.Spec, s); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := Convert_extensions_ScaleStatus_To_v1beta1_ScaleStatus(&in.Status, &out.Status, s); err != nil {
|
||||
if err := Convert_autoscaling_ScaleStatus_To_v1beta1_ScaleStatus(&in.Status, &out.Status, s); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_extensions_Scale_To_v1beta1_Scale is an autogenerated conversion function.
|
||||
func Convert_extensions_Scale_To_v1beta1_Scale(in *extensions.Scale, out *v1beta1.Scale, s conversion.Scope) error {
|
||||
return autoConvert_extensions_Scale_To_v1beta1_Scale(in, out, s)
|
||||
// Convert_autoscaling_Scale_To_v1beta1_Scale is an autogenerated conversion function.
|
||||
func Convert_autoscaling_Scale_To_v1beta1_Scale(in *autoscaling.Scale, out *v1beta1.Scale, s conversion.Scope) error {
|
||||
return autoConvert_autoscaling_Scale_To_v1beta1_Scale(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1beta1_ScaleSpec_To_extensions_ScaleSpec(in *v1beta1.ScaleSpec, out *extensions.ScaleSpec, s conversion.Scope) error {
|
||||
func autoConvert_v1beta1_ScaleSpec_To_autoscaling_ScaleSpec(in *v1beta1.ScaleSpec, out *autoscaling.ScaleSpec, s conversion.Scope) error {
|
||||
out.Replicas = in.Replicas
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1beta1_ScaleSpec_To_extensions_ScaleSpec is an autogenerated conversion function.
|
||||
func Convert_v1beta1_ScaleSpec_To_extensions_ScaleSpec(in *v1beta1.ScaleSpec, out *extensions.ScaleSpec, s conversion.Scope) error {
|
||||
return autoConvert_v1beta1_ScaleSpec_To_extensions_ScaleSpec(in, out, s)
|
||||
// Convert_v1beta1_ScaleSpec_To_autoscaling_ScaleSpec is an autogenerated conversion function.
|
||||
func Convert_v1beta1_ScaleSpec_To_autoscaling_ScaleSpec(in *v1beta1.ScaleSpec, out *autoscaling.ScaleSpec, s conversion.Scope) error {
|
||||
return autoConvert_v1beta1_ScaleSpec_To_autoscaling_ScaleSpec(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_extensions_ScaleSpec_To_v1beta1_ScaleSpec(in *extensions.ScaleSpec, out *v1beta1.ScaleSpec, s conversion.Scope) error {
|
||||
func autoConvert_autoscaling_ScaleSpec_To_v1beta1_ScaleSpec(in *autoscaling.ScaleSpec, out *v1beta1.ScaleSpec, s conversion.Scope) error {
|
||||
out.Replicas = in.Replicas
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_extensions_ScaleSpec_To_v1beta1_ScaleSpec is an autogenerated conversion function.
|
||||
func Convert_extensions_ScaleSpec_To_v1beta1_ScaleSpec(in *extensions.ScaleSpec, out *v1beta1.ScaleSpec, s conversion.Scope) error {
|
||||
return autoConvert_extensions_ScaleSpec_To_v1beta1_ScaleSpec(in, out, s)
|
||||
// Convert_autoscaling_ScaleSpec_To_v1beta1_ScaleSpec is an autogenerated conversion function.
|
||||
func Convert_autoscaling_ScaleSpec_To_v1beta1_ScaleSpec(in *autoscaling.ScaleSpec, out *v1beta1.ScaleSpec, s conversion.Scope) error {
|
||||
return autoConvert_autoscaling_ScaleSpec_To_v1beta1_ScaleSpec(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1beta1_ScaleStatus_To_extensions_ScaleStatus(in *v1beta1.ScaleStatus, out *extensions.ScaleStatus, s conversion.Scope) error {
|
||||
func autoConvert_v1beta1_ScaleStatus_To_autoscaling_ScaleStatus(in *v1beta1.ScaleStatus, out *autoscaling.ScaleStatus, s conversion.Scope) error {
|
||||
out.Replicas = in.Replicas
|
||||
// WARNING: in.Selector requires manual conversion: inconvertible types (map[string]string vs *k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector)
|
||||
// WARNING: in.Selector requires manual conversion: inconvertible types (map[string]string vs string)
|
||||
// WARNING: in.TargetSelector requires manual conversion: does not exist in peer-type
|
||||
return nil
|
||||
}
|
||||
|
||||
func autoConvert_extensions_ScaleStatus_To_v1beta1_ScaleStatus(in *extensions.ScaleStatus, out *v1beta1.ScaleStatus, s conversion.Scope) error {
|
||||
func autoConvert_autoscaling_ScaleStatus_To_v1beta1_ScaleStatus(in *autoscaling.ScaleStatus, out *v1beta1.ScaleStatus, s conversion.Scope) error {
|
||||
out.Replicas = in.Replicas
|
||||
// WARNING: in.Selector requires manual conversion: inconvertible types (*k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector vs map[string]string)
|
||||
// WARNING: in.Selector requires manual conversion: inconvertible types (string vs map[string]string)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ go_library(
|
|||
importpath = "k8s.io/kubernetes/pkg/apis/apps/v1beta2",
|
||||
deps = [
|
||||
"//pkg/apis/apps:go_default_library",
|
||||
"//pkg/apis/autoscaling:go_default_library",
|
||||
"//pkg/apis/core:go_default_library",
|
||||
"//pkg/apis/core/v1:go_default_library",
|
||||
"//pkg/apis/extensions:go_default_library",
|
||||
|
@ -26,6 +27,7 @@ go_library(
|
|||
"//vendor/k8s.io/api/core/v1:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/conversion:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/labels:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/util/intstr:go_default_library",
|
||||
|
@ -57,6 +59,7 @@ go_test(
|
|||
"//pkg/api/legacyscheme:go_default_library",
|
||||
"//pkg/apis/apps:go_default_library",
|
||||
"//pkg/apis/apps/install:go_default_library",
|
||||
"//pkg/apis/autoscaling:go_default_library",
|
||||
"//pkg/apis/core:go_default_library",
|
||||
"//pkg/apis/core/install:go_default_library",
|
||||
"//pkg/apis/extensions:go_default_library",
|
||||
|
|
|
@ -24,9 +24,11 @@ import (
|
|||
"k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/conversion"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
"k8s.io/kubernetes/pkg/apis/apps"
|
||||
autoscaling "k8s.io/kubernetes/pkg/apis/autoscaling"
|
||||
api "k8s.io/kubernetes/pkg/apis/core"
|
||||
k8s_api_v1 "k8s.io/kubernetes/pkg/apis/core/v1"
|
||||
"k8s.io/kubernetes/pkg/apis/extensions"
|
||||
|
@ -57,8 +59,8 @@ func addConversionFuncs(scheme *runtime.Scheme) error {
|
|||
// extensions
|
||||
// TODO: below conversions should be dropped in favor of auto-generated
|
||||
// ones, see https://github.com/kubernetes/kubernetes/issues/39865
|
||||
Convert_v1beta2_ScaleStatus_To_extensions_ScaleStatus,
|
||||
Convert_extensions_ScaleStatus_To_v1beta2_ScaleStatus,
|
||||
Convert_v1beta2_ScaleStatus_To_autoscaling_ScaleStatus,
|
||||
Convert_autoscaling_ScaleStatus_To_v1beta2_ScaleStatus,
|
||||
Convert_v1beta2_DeploymentSpec_To_extensions_DeploymentSpec,
|
||||
Convert_extensions_DeploymentSpec_To_v1beta2_DeploymentSpec,
|
||||
Convert_v1beta2_DeploymentStrategy_To_extensions_DeploymentStrategy,
|
||||
|
@ -255,26 +257,23 @@ func Convert_apps_StatefulSetStatus_To_v1beta2_StatefulSetStatus(in *apps.Statef
|
|||
return nil
|
||||
}
|
||||
|
||||
func Convert_extensions_ScaleStatus_To_v1beta2_ScaleStatus(in *extensions.ScaleStatus, out *appsv1beta2.ScaleStatus, s conversion.Scope) error {
|
||||
func Convert_autoscaling_ScaleStatus_To_v1beta2_ScaleStatus(in *autoscaling.ScaleStatus, out *appsv1beta2.ScaleStatus, s conversion.Scope) error {
|
||||
out.Replicas = int32(in.Replicas)
|
||||
out.TargetSelector = in.Selector
|
||||
|
||||
out.Selector = nil
|
||||
out.TargetSelector = ""
|
||||
if in.Selector != nil {
|
||||
if in.Selector.MatchExpressions == nil || len(in.Selector.MatchExpressions) == 0 {
|
||||
out.Selector = in.Selector.MatchLabels
|
||||
}
|
||||
|
||||
selector, err := metav1.LabelSelectorAsSelector(in.Selector)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid label selector: %v", err)
|
||||
}
|
||||
out.TargetSelector = selector.String()
|
||||
selector, err := metav1.ParseToLabelSelector(in.Selector)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to parse selector: %v", err)
|
||||
}
|
||||
if len(selector.MatchExpressions) == 0 {
|
||||
out.Selector = selector.MatchLabels
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_v1beta2_ScaleStatus_To_extensions_ScaleStatus(in *appsv1beta2.ScaleStatus, out *extensions.ScaleStatus, s conversion.Scope) error {
|
||||
func Convert_v1beta2_ScaleStatus_To_autoscaling_ScaleStatus(in *appsv1beta2.ScaleStatus, out *autoscaling.ScaleStatus, s conversion.Scope) error {
|
||||
out.Replicas = in.Replicas
|
||||
|
||||
// Normally when 2 fields map to the same internal value we favor the old field, since
|
||||
|
@ -282,21 +281,15 @@ func Convert_v1beta2_ScaleStatus_To_extensions_ScaleStatus(in *appsv1beta2.Scale
|
|||
// new field can be expected to know about the old field (though that's not quite true, due
|
||||
// to kubectl apply). However, these fields are readonly, so any non-nil value should work.
|
||||
if in.TargetSelector != "" {
|
||||
labelSelector, err := metav1.ParseToLabelSelector(in.TargetSelector)
|
||||
if err != nil {
|
||||
out.Selector = nil
|
||||
return fmt.Errorf("failed to parse target selector: %v", err)
|
||||
}
|
||||
out.Selector = labelSelector
|
||||
out.Selector = in.TargetSelector
|
||||
} else if in.Selector != nil {
|
||||
out.Selector = new(metav1.LabelSelector)
|
||||
selector := make(map[string]string)
|
||||
set := labels.Set{}
|
||||
for key, val := range in.Selector {
|
||||
selector[key] = val
|
||||
set[key] = val
|
||||
}
|
||||
out.Selector.MatchLabels = selector
|
||||
out.Selector = labels.SelectorFromSet(set).String()
|
||||
} else {
|
||||
out.Selector = nil
|
||||
out.Selector = ""
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ import (
|
|||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
"k8s.io/kubernetes/pkg/api/legacyscheme"
|
||||
"k8s.io/kubernetes/pkg/apis/apps"
|
||||
"k8s.io/kubernetes/pkg/apis/autoscaling"
|
||||
api "k8s.io/kubernetes/pkg/apis/core"
|
||||
"k8s.io/kubernetes/pkg/apis/extensions"
|
||||
|
||||
|
@ -349,41 +350,41 @@ func TestV1beta2ScaleStatusConversion(t *testing.T) {
|
|||
labelsSelector2, _ := metav1.LabelSelectorAsSelector(selector2)
|
||||
|
||||
testcases := map[string]struct {
|
||||
scaleStatus1 *extensions.ScaleStatus
|
||||
scaleStatus1 *autoscaling.ScaleStatus
|
||||
scaleStatus2 *v1beta2.ScaleStatus
|
||||
}{
|
||||
"ScaleStatus Conversion 1": {
|
||||
scaleStatus1: &extensions.ScaleStatus{Replicas: 2},
|
||||
scaleStatus1: &autoscaling.ScaleStatus{Replicas: 2},
|
||||
scaleStatus2: &v1beta2.ScaleStatus{Replicas: 2},
|
||||
},
|
||||
"ScaleStatus Conversion 2": {
|
||||
scaleStatus1: &extensions.ScaleStatus{Replicas: 2, Selector: selector1},
|
||||
scaleStatus1: &autoscaling.ScaleStatus{Replicas: 2, Selector: labelsSelector1.String()},
|
||||
scaleStatus2: &v1beta2.ScaleStatus{Replicas: 2, Selector: matchLabels, TargetSelector: labelsSelector1.String()},
|
||||
},
|
||||
"ScaleStatus Conversion 3": {
|
||||
scaleStatus1: &extensions.ScaleStatus{Replicas: 2, Selector: selector2},
|
||||
scaleStatus1: &autoscaling.ScaleStatus{Replicas: 2, Selector: labelsSelector2.String()},
|
||||
scaleStatus2: &v1beta2.ScaleStatus{Replicas: 2, Selector: map[string]string{}, TargetSelector: labelsSelector2.String()},
|
||||
},
|
||||
}
|
||||
|
||||
for k, tc := range testcases {
|
||||
// extensions -> v1beta2
|
||||
// autoscaling -> v1beta2
|
||||
internal1 := &v1beta2.ScaleStatus{}
|
||||
if err := legacyscheme.Scheme.Convert(tc.scaleStatus1, internal1, nil); err != nil {
|
||||
t.Errorf("%q - %q: unexpected error: %v", k, "extensions -> v1beta2", err)
|
||||
t.Errorf("%q - %q: unexpected error: %v", k, "autoscaling -> v1beta2", err)
|
||||
}
|
||||
|
||||
if !apiequality.Semantic.DeepEqual(internal1, tc.scaleStatus2) {
|
||||
t.Errorf("%q - %q: expected\n\t%#v, got \n\t%#v", k, "extensions -> v1beta2", tc.scaleStatus2, internal1)
|
||||
t.Errorf("%q - %q: expected\n\t%#v, got \n\t%#v", k, "autoscaling -> v1beta2", tc.scaleStatus2, internal1)
|
||||
}
|
||||
|
||||
// v1beta2 -> extensions
|
||||
internal2 := &extensions.ScaleStatus{}
|
||||
// v1beta2 -> autoscaling
|
||||
internal2 := &autoscaling.ScaleStatus{}
|
||||
if err := legacyscheme.Scheme.Convert(tc.scaleStatus2, internal2, nil); err != nil {
|
||||
t.Errorf("%q - %q: unexpected error: %v", k, "v1beta2 -> extensions", err)
|
||||
t.Errorf("%q - %q: unexpected error: %v", k, "v1beta2 -> autoscaling", err)
|
||||
}
|
||||
if !apiequality.Semantic.DeepEqual(internal2, tc.scaleStatus1) {
|
||||
t.Errorf("%q - %q: expected\n\t%+v, got \n\t%+v", k, "v1beta2 -> extensions", tc.scaleStatus1, internal2)
|
||||
t.Errorf("%q - %q: expected\n\t%+v, got \n\t%+v", k, "v1beta2 -> autoscaling", tc.scaleStatus1, internal2)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ limitations under the License.
|
|||
*/
|
||||
|
||||
// +k8s:conversion-gen=k8s.io/kubernetes/pkg/apis/apps
|
||||
// +k8s:conversion-gen=k8s.io/kubernetes/pkg/apis/autoscaling
|
||||
// +k8s:conversion-gen=k8s.io/kubernetes/pkg/apis/extensions
|
||||
// +k8s:conversion-gen-external-types=../../../../vendor/k8s.io/api/apps/v1beta2
|
||||
// +k8s:defaulter-gen=TypeMeta
|
||||
|
|
|
@ -27,6 +27,7 @@ import (
|
|||
conversion "k8s.io/apimachinery/pkg/conversion"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
apps "k8s.io/kubernetes/pkg/apis/apps"
|
||||
autoscaling "k8s.io/kubernetes/pkg/apis/autoscaling"
|
||||
core "k8s.io/kubernetes/pkg/apis/core"
|
||||
core_v1 "k8s.io/kubernetes/pkg/apis/core/v1"
|
||||
extensions "k8s.io/kubernetes/pkg/apis/extensions"
|
||||
|
@ -85,12 +86,12 @@ func RegisterConversions(scheme *runtime.Scheme) error {
|
|||
Convert_extensions_RollingUpdateDeployment_To_v1beta2_RollingUpdateDeployment,
|
||||
Convert_v1beta2_RollingUpdateStatefulSetStrategy_To_apps_RollingUpdateStatefulSetStrategy,
|
||||
Convert_apps_RollingUpdateStatefulSetStrategy_To_v1beta2_RollingUpdateStatefulSetStrategy,
|
||||
Convert_v1beta2_Scale_To_extensions_Scale,
|
||||
Convert_extensions_Scale_To_v1beta2_Scale,
|
||||
Convert_v1beta2_ScaleSpec_To_extensions_ScaleSpec,
|
||||
Convert_extensions_ScaleSpec_To_v1beta2_ScaleSpec,
|
||||
Convert_v1beta2_ScaleStatus_To_extensions_ScaleStatus,
|
||||
Convert_extensions_ScaleStatus_To_v1beta2_ScaleStatus,
|
||||
Convert_v1beta2_Scale_To_autoscaling_Scale,
|
||||
Convert_autoscaling_Scale_To_v1beta2_Scale,
|
||||
Convert_v1beta2_ScaleSpec_To_autoscaling_ScaleSpec,
|
||||
Convert_autoscaling_ScaleSpec_To_v1beta2_ScaleSpec,
|
||||
Convert_v1beta2_ScaleStatus_To_autoscaling_ScaleStatus,
|
||||
Convert_autoscaling_ScaleStatus_To_v1beta2_ScaleStatus,
|
||||
Convert_v1beta2_StatefulSet_To_apps_StatefulSet,
|
||||
Convert_apps_StatefulSet_To_v1beta2_StatefulSet,
|
||||
Convert_v1beta2_StatefulSetCondition_To_apps_StatefulSetCondition,
|
||||
|
@ -756,68 +757,68 @@ func Convert_apps_RollingUpdateStatefulSetStrategy_To_v1beta2_RollingUpdateState
|
|||
return autoConvert_apps_RollingUpdateStatefulSetStrategy_To_v1beta2_RollingUpdateStatefulSetStrategy(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1beta2_Scale_To_extensions_Scale(in *v1beta2.Scale, out *extensions.Scale, s conversion.Scope) error {
|
||||
func autoConvert_v1beta2_Scale_To_autoscaling_Scale(in *v1beta2.Scale, out *autoscaling.Scale, s conversion.Scope) error {
|
||||
out.ObjectMeta = in.ObjectMeta
|
||||
if err := Convert_v1beta2_ScaleSpec_To_extensions_ScaleSpec(&in.Spec, &out.Spec, s); err != nil {
|
||||
if err := Convert_v1beta2_ScaleSpec_To_autoscaling_ScaleSpec(&in.Spec, &out.Spec, s); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := Convert_v1beta2_ScaleStatus_To_extensions_ScaleStatus(&in.Status, &out.Status, s); err != nil {
|
||||
if err := Convert_v1beta2_ScaleStatus_To_autoscaling_ScaleStatus(&in.Status, &out.Status, s); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1beta2_Scale_To_extensions_Scale is an autogenerated conversion function.
|
||||
func Convert_v1beta2_Scale_To_extensions_Scale(in *v1beta2.Scale, out *extensions.Scale, s conversion.Scope) error {
|
||||
return autoConvert_v1beta2_Scale_To_extensions_Scale(in, out, s)
|
||||
// Convert_v1beta2_Scale_To_autoscaling_Scale is an autogenerated conversion function.
|
||||
func Convert_v1beta2_Scale_To_autoscaling_Scale(in *v1beta2.Scale, out *autoscaling.Scale, s conversion.Scope) error {
|
||||
return autoConvert_v1beta2_Scale_To_autoscaling_Scale(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_extensions_Scale_To_v1beta2_Scale(in *extensions.Scale, out *v1beta2.Scale, s conversion.Scope) error {
|
||||
func autoConvert_autoscaling_Scale_To_v1beta2_Scale(in *autoscaling.Scale, out *v1beta2.Scale, s conversion.Scope) error {
|
||||
out.ObjectMeta = in.ObjectMeta
|
||||
if err := Convert_extensions_ScaleSpec_To_v1beta2_ScaleSpec(&in.Spec, &out.Spec, s); err != nil {
|
||||
if err := Convert_autoscaling_ScaleSpec_To_v1beta2_ScaleSpec(&in.Spec, &out.Spec, s); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := Convert_extensions_ScaleStatus_To_v1beta2_ScaleStatus(&in.Status, &out.Status, s); err != nil {
|
||||
if err := Convert_autoscaling_ScaleStatus_To_v1beta2_ScaleStatus(&in.Status, &out.Status, s); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_extensions_Scale_To_v1beta2_Scale is an autogenerated conversion function.
|
||||
func Convert_extensions_Scale_To_v1beta2_Scale(in *extensions.Scale, out *v1beta2.Scale, s conversion.Scope) error {
|
||||
return autoConvert_extensions_Scale_To_v1beta2_Scale(in, out, s)
|
||||
// Convert_autoscaling_Scale_To_v1beta2_Scale is an autogenerated conversion function.
|
||||
func Convert_autoscaling_Scale_To_v1beta2_Scale(in *autoscaling.Scale, out *v1beta2.Scale, s conversion.Scope) error {
|
||||
return autoConvert_autoscaling_Scale_To_v1beta2_Scale(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1beta2_ScaleSpec_To_extensions_ScaleSpec(in *v1beta2.ScaleSpec, out *extensions.ScaleSpec, s conversion.Scope) error {
|
||||
func autoConvert_v1beta2_ScaleSpec_To_autoscaling_ScaleSpec(in *v1beta2.ScaleSpec, out *autoscaling.ScaleSpec, s conversion.Scope) error {
|
||||
out.Replicas = in.Replicas
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1beta2_ScaleSpec_To_extensions_ScaleSpec is an autogenerated conversion function.
|
||||
func Convert_v1beta2_ScaleSpec_To_extensions_ScaleSpec(in *v1beta2.ScaleSpec, out *extensions.ScaleSpec, s conversion.Scope) error {
|
||||
return autoConvert_v1beta2_ScaleSpec_To_extensions_ScaleSpec(in, out, s)
|
||||
// Convert_v1beta2_ScaleSpec_To_autoscaling_ScaleSpec is an autogenerated conversion function.
|
||||
func Convert_v1beta2_ScaleSpec_To_autoscaling_ScaleSpec(in *v1beta2.ScaleSpec, out *autoscaling.ScaleSpec, s conversion.Scope) error {
|
||||
return autoConvert_v1beta2_ScaleSpec_To_autoscaling_ScaleSpec(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_extensions_ScaleSpec_To_v1beta2_ScaleSpec(in *extensions.ScaleSpec, out *v1beta2.ScaleSpec, s conversion.Scope) error {
|
||||
func autoConvert_autoscaling_ScaleSpec_To_v1beta2_ScaleSpec(in *autoscaling.ScaleSpec, out *v1beta2.ScaleSpec, s conversion.Scope) error {
|
||||
out.Replicas = in.Replicas
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_extensions_ScaleSpec_To_v1beta2_ScaleSpec is an autogenerated conversion function.
|
||||
func Convert_extensions_ScaleSpec_To_v1beta2_ScaleSpec(in *extensions.ScaleSpec, out *v1beta2.ScaleSpec, s conversion.Scope) error {
|
||||
return autoConvert_extensions_ScaleSpec_To_v1beta2_ScaleSpec(in, out, s)
|
||||
// Convert_autoscaling_ScaleSpec_To_v1beta2_ScaleSpec is an autogenerated conversion function.
|
||||
func Convert_autoscaling_ScaleSpec_To_v1beta2_ScaleSpec(in *autoscaling.ScaleSpec, out *v1beta2.ScaleSpec, s conversion.Scope) error {
|
||||
return autoConvert_autoscaling_ScaleSpec_To_v1beta2_ScaleSpec(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1beta2_ScaleStatus_To_extensions_ScaleStatus(in *v1beta2.ScaleStatus, out *extensions.ScaleStatus, s conversion.Scope) error {
|
||||
func autoConvert_v1beta2_ScaleStatus_To_autoscaling_ScaleStatus(in *v1beta2.ScaleStatus, out *autoscaling.ScaleStatus, s conversion.Scope) error {
|
||||
out.Replicas = in.Replicas
|
||||
// WARNING: in.Selector requires manual conversion: inconvertible types (map[string]string vs *k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector)
|
||||
// WARNING: in.Selector requires manual conversion: inconvertible types (map[string]string vs string)
|
||||
// WARNING: in.TargetSelector requires manual conversion: does not exist in peer-type
|
||||
return nil
|
||||
}
|
||||
|
||||
func autoConvert_extensions_ScaleStatus_To_v1beta2_ScaleStatus(in *extensions.ScaleStatus, out *v1beta2.ScaleStatus, s conversion.Scope) error {
|
||||
func autoConvert_autoscaling_ScaleStatus_To_v1beta2_ScaleStatus(in *autoscaling.ScaleStatus, out *v1beta2.ScaleStatus, s conversion.Scope) error {
|
||||
out.Replicas = in.Replicas
|
||||
// WARNING: in.Selector requires manual conversion: inconvertible types (*k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector vs map[string]string)
|
||||
// WARNING: in.Selector requires manual conversion: inconvertible types (string vs map[string]string)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ go_library(
|
|||
"//pkg/apis/core:go_default_library",
|
||||
"//vendor/github.com/google/gofuzz:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/api/resource:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/runtime/serializer:go_default_library",
|
||||
],
|
||||
)
|
||||
|
|
|
@ -18,7 +18,9 @@ package fuzzer
|
|||
|
||||
import (
|
||||
fuzz "github.com/google/gofuzz"
|
||||
|
||||
"k8s.io/apimachinery/pkg/api/resource"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
runtimeserializer "k8s.io/apimachinery/pkg/runtime/serializer"
|
||||
"k8s.io/kubernetes/pkg/apis/autoscaling"
|
||||
api "k8s.io/kubernetes/pkg/apis/core"
|
||||
|
@ -27,6 +29,15 @@ import (
|
|||
// Funcs returns the fuzzer functions for the autoscaling api group.
|
||||
var Funcs = func(codecs runtimeserializer.CodecFactory) []interface{} {
|
||||
return []interface{}{
|
||||
func(s *autoscaling.ScaleStatus, c fuzz.Continue) {
|
||||
c.FuzzNoCustom(s) // fuzz self without calling this function again
|
||||
|
||||
// ensure we have a valid selector
|
||||
metaSelector := &metav1.LabelSelector{}
|
||||
c.Fuzz(metaSelector)
|
||||
labelSelector, _ := metav1.LabelSelectorAsSelector(metaSelector)
|
||||
s.Selector = labelSelector.String()
|
||||
},
|
||||
func(s *autoscaling.HorizontalPodAutoscalerSpec, c fuzz.Continue) {
|
||||
c.FuzzNoCustom(s) // fuzz self without calling this function again
|
||||
minReplicas := int32(c.Rand.Int31())
|
||||
|
|
|
@ -2725,8 +2725,8 @@ type ReplicationControllerCondition struct {
|
|||
}
|
||||
|
||||
// +genclient
|
||||
// +genclient:method=GetScale,verb=get,subresource=scale,result=k8s.io/kubernetes/pkg/apis/extensions.Scale
|
||||
// +genclient:method=UpdateScale,verb=update,subresource=scale,input=k8s.io/kubernetes/pkg/apis/extensions.Scale,result=k8s.io/kubernetes/pkg/apis/extensions.Scale
|
||||
// +genclient:method=GetScale,verb=get,subresource=scale,result=k8s.io/kubernetes/pkg/apis/autoscaling.Scale
|
||||
// +genclient:method=UpdateScale,verb=update,subresource=scale,input=k8s.io/kubernetes/pkg/apis/autoscaling.Scale,result=k8s.io/kubernetes/pkg/apis/autoscaling.Scale
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// ReplicationController represents the configuration of a replication controller.
|
||||
|
|
|
@ -24,6 +24,7 @@ go_library(
|
|||
],
|
||||
importpath = "k8s.io/kubernetes/pkg/apis/extensions",
|
||||
deps = [
|
||||
"//pkg/apis/autoscaling:go_default_library",
|
||||
"//pkg/apis/core:go_default_library",
|
||||
"//pkg/apis/networking:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/api/resource:go_default_library",
|
||||
|
|
|
@ -19,6 +19,7 @@ package extensions
|
|||
import (
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/kubernetes/pkg/apis/autoscaling"
|
||||
"k8s.io/kubernetes/pkg/apis/networking"
|
||||
)
|
||||
|
||||
|
@ -51,7 +52,6 @@ func addKnownTypes(scheme *runtime.Scheme) error {
|
|||
&DeploymentList{},
|
||||
&DeploymentRollback{},
|
||||
&ReplicationControllerDummy{},
|
||||
&Scale{},
|
||||
&DaemonSetList{},
|
||||
&DaemonSet{},
|
||||
&Ingress{},
|
||||
|
@ -60,6 +60,7 @@ func addKnownTypes(scheme *runtime.Scheme) error {
|
|||
&ReplicaSetList{},
|
||||
&PodSecurityPolicy{},
|
||||
&PodSecurityPolicyList{},
|
||||
&autoscaling.Scale{},
|
||||
&networking.NetworkPolicy{},
|
||||
&networking.NetworkPolicyList{},
|
||||
)
|
||||
|
|
|
@ -42,44 +42,6 @@ const (
|
|||
SysctlsPodSecurityPolicyAnnotationKey string = "security.alpha.kubernetes.io/sysctls"
|
||||
)
|
||||
|
||||
// describes the attributes of a scale subresource
|
||||
type ScaleSpec struct {
|
||||
// desired number of instances for the scaled object.
|
||||
// +optional
|
||||
Replicas int32
|
||||
}
|
||||
|
||||
// represents the current status of a scale subresource.
|
||||
type ScaleStatus struct {
|
||||
// actual number of observed instances of the scaled object.
|
||||
Replicas int32
|
||||
|
||||
// label query over pods that should match the replicas count.
|
||||
// More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors
|
||||
// +optional
|
||||
Selector *metav1.LabelSelector
|
||||
}
|
||||
|
||||
// +genclient
|
||||
// +genclient:noVerbs
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// represents a scaling request for a resource.
|
||||
type Scale struct {
|
||||
metav1.TypeMeta
|
||||
// Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata.
|
||||
// +optional
|
||||
metav1.ObjectMeta
|
||||
|
||||
// defines the behavior of the scale. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status.
|
||||
// +optional
|
||||
Spec ScaleSpec
|
||||
|
||||
// current status of the scale. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status. Read-only.
|
||||
// +optional
|
||||
Status ScaleStatus
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// Dummy definition
|
||||
|
@ -111,8 +73,8 @@ type CustomMetricCurrentStatusList struct {
|
|||
}
|
||||
|
||||
// +genclient
|
||||
// +genclient:method=GetScale,verb=get,subresource=scale,result=Scale
|
||||
// +genclient:method=UpdateScale,verb=update,subresource=scale,input=Scale,result=Scale
|
||||
// +genclient:method=GetScale,verb=get,subresource=scale,result=k8s.io/kubernetes/pkg/apis/autoscaling.Scale
|
||||
// +genclient:method=UpdateScale,verb=update,subresource=scale,input=k8s.io/kubernetes/pkg/apis/autoscaling.Scale,result=k8s.io/kubernetes/pkg/apis/autoscaling.Scale
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
type Deployment struct {
|
||||
|
@ -709,8 +671,8 @@ type IngressBackend struct {
|
|||
}
|
||||
|
||||
// +genclient
|
||||
// +genclient:method=GetScale,verb=get,subresource=scale,result=Scale
|
||||
// +genclient:method=UpdateScale,verb=update,subresource=scale,input=Scale,result=Scale
|
||||
// +genclient:method=GetScale,verb=get,subresource=scale,result=k8s.io/kubernetes/pkg/apis/autoscaling.Scale
|
||||
// +genclient:method=UpdateScale,verb=update,subresource=scale,input=k8s.io/kubernetes/pkg/apis/autoscaling.Scale,result=k8s.io/kubernetes/pkg/apis/autoscaling.Scale
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// ReplicaSet ensures that a specified number of pod replicas are running at any given time.
|
||||
|
|
|
@ -18,6 +18,7 @@ go_library(
|
|||
],
|
||||
importpath = "k8s.io/kubernetes/pkg/apis/extensions/v1beta1",
|
||||
deps = [
|
||||
"//pkg/apis/autoscaling:go_default_library",
|
||||
"//pkg/apis/core:go_default_library",
|
||||
"//pkg/apis/core/v1:go_default_library",
|
||||
"//pkg/apis/extensions:go_default_library",
|
||||
|
@ -26,6 +27,7 @@ go_library(
|
|||
"//vendor/k8s.io/api/extensions/v1beta1:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/conversion:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/labels:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/util/intstr:go_default_library",
|
||||
|
|
|
@ -24,8 +24,10 @@ import (
|
|||
v1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/conversion"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
"k8s.io/kubernetes/pkg/apis/autoscaling"
|
||||
api "k8s.io/kubernetes/pkg/apis/core"
|
||||
k8s_api_v1 "k8s.io/kubernetes/pkg/apis/core/v1"
|
||||
"k8s.io/kubernetes/pkg/apis/extensions"
|
||||
|
@ -35,8 +37,8 @@ import (
|
|||
func addConversionFuncs(scheme *runtime.Scheme) error {
|
||||
// Add non-generated conversion functions
|
||||
err := scheme.AddConversionFuncs(
|
||||
Convert_extensions_ScaleStatus_To_v1beta1_ScaleStatus,
|
||||
Convert_v1beta1_ScaleStatus_To_extensions_ScaleStatus,
|
||||
Convert_autoscaling_ScaleStatus_To_v1beta1_ScaleStatus,
|
||||
Convert_v1beta1_ScaleStatus_To_autoscaling_ScaleStatus,
|
||||
Convert_extensions_DeploymentSpec_To_v1beta1_DeploymentSpec,
|
||||
Convert_v1beta1_DeploymentSpec_To_extensions_DeploymentSpec,
|
||||
Convert_extensions_DeploymentStrategy_To_v1beta1_DeploymentStrategy,
|
||||
|
@ -72,48 +74,35 @@ func addConversionFuncs(scheme *runtime.Scheme) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func Convert_extensions_ScaleStatus_To_v1beta1_ScaleStatus(in *extensions.ScaleStatus, out *extensionsv1beta1.ScaleStatus, s conversion.Scope) error {
|
||||
func Convert_autoscaling_ScaleStatus_To_v1beta1_ScaleStatus(in *autoscaling.ScaleStatus, out *extensionsv1beta1.ScaleStatus, s conversion.Scope) error {
|
||||
out.Replicas = int32(in.Replicas)
|
||||
out.TargetSelector = in.Selector
|
||||
|
||||
out.Selector = nil
|
||||
out.TargetSelector = ""
|
||||
if in.Selector != nil {
|
||||
if in.Selector.MatchExpressions == nil || len(in.Selector.MatchExpressions) == 0 {
|
||||
out.Selector = in.Selector.MatchLabels
|
||||
}
|
||||
|
||||
selector, err := metav1.LabelSelectorAsSelector(in.Selector)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid label selector: %v", err)
|
||||
}
|
||||
out.TargetSelector = selector.String()
|
||||
selector, err := metav1.ParseToLabelSelector(in.Selector)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to parse selector: %v", err)
|
||||
}
|
||||
if len(selector.MatchExpressions) == 0 {
|
||||
out.Selector = selector.MatchLabels
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_v1beta1_ScaleStatus_To_extensions_ScaleStatus(in *extensionsv1beta1.ScaleStatus, out *extensions.ScaleStatus, s conversion.Scope) error {
|
||||
func Convert_v1beta1_ScaleStatus_To_autoscaling_ScaleStatus(in *extensionsv1beta1.ScaleStatus, out *autoscaling.ScaleStatus, s conversion.Scope) error {
|
||||
out.Replicas = in.Replicas
|
||||
|
||||
// Normally when 2 fields map to the same internal value we favor the old field, since
|
||||
// old clients can't be expected to know about new fields but clients that know about the
|
||||
// new field can be expected to know about the old field (though that's not quite true, due
|
||||
// to kubectl apply). However, these fields are readonly, so any non-nil value should work.
|
||||
if in.TargetSelector != "" {
|
||||
labelSelector, err := metav1.ParseToLabelSelector(in.TargetSelector)
|
||||
if err != nil {
|
||||
out.Selector = nil
|
||||
return fmt.Errorf("failed to parse target selector: %v", err)
|
||||
}
|
||||
out.Selector = labelSelector
|
||||
out.Selector = in.TargetSelector
|
||||
} else if in.Selector != nil {
|
||||
out.Selector = new(metav1.LabelSelector)
|
||||
selector := make(map[string]string)
|
||||
set := labels.Set{}
|
||||
for key, val := range in.Selector {
|
||||
selector[key] = val
|
||||
set[key] = val
|
||||
}
|
||||
out.Selector.MatchLabels = selector
|
||||
out.Selector = labels.SelectorFromSet(set).String()
|
||||
} else {
|
||||
out.Selector = nil
|
||||
out.Selector = ""
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ limitations under the License.
|
|||
*/
|
||||
|
||||
// +k8s:conversion-gen=k8s.io/kubernetes/pkg/apis/extensions
|
||||
// +k8s:conversion-gen=k8s.io/kubernetes/pkg/apis/autoscaling
|
||||
// +k8s:conversion-gen-external-types=../../../../vendor/k8s.io/api/extensions/v1beta1
|
||||
// +k8s:defaulter-gen=TypeMeta
|
||||
// +k8s:defaulter-gen-input=../../../../vendor/k8s.io/api/extensions/v1beta1
|
||||
|
|
|
@ -26,6 +26,7 @@ import (
|
|||
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
conversion "k8s.io/apimachinery/pkg/conversion"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
autoscaling "k8s.io/kubernetes/pkg/apis/autoscaling"
|
||||
core "k8s.io/kubernetes/pkg/apis/core"
|
||||
core_v1 "k8s.io/kubernetes/pkg/apis/core/v1"
|
||||
extensions "k8s.io/kubernetes/pkg/apis/extensions"
|
||||
|
@ -128,12 +129,12 @@ func RegisterConversions(scheme *runtime.Scheme) error {
|
|||
Convert_extensions_RunAsUserStrategyOptions_To_v1beta1_RunAsUserStrategyOptions,
|
||||
Convert_v1beta1_SELinuxStrategyOptions_To_extensions_SELinuxStrategyOptions,
|
||||
Convert_extensions_SELinuxStrategyOptions_To_v1beta1_SELinuxStrategyOptions,
|
||||
Convert_v1beta1_Scale_To_extensions_Scale,
|
||||
Convert_extensions_Scale_To_v1beta1_Scale,
|
||||
Convert_v1beta1_ScaleSpec_To_extensions_ScaleSpec,
|
||||
Convert_extensions_ScaleSpec_To_v1beta1_ScaleSpec,
|
||||
Convert_v1beta1_ScaleStatus_To_extensions_ScaleStatus,
|
||||
Convert_extensions_ScaleStatus_To_v1beta1_ScaleStatus,
|
||||
Convert_v1beta1_Scale_To_autoscaling_Scale,
|
||||
Convert_autoscaling_Scale_To_v1beta1_Scale,
|
||||
Convert_v1beta1_ScaleSpec_To_autoscaling_ScaleSpec,
|
||||
Convert_autoscaling_ScaleSpec_To_v1beta1_ScaleSpec,
|
||||
Convert_v1beta1_ScaleStatus_To_autoscaling_ScaleStatus,
|
||||
Convert_autoscaling_ScaleStatus_To_v1beta1_ScaleStatus,
|
||||
Convert_v1beta1_SupplementalGroupsStrategyOptions_To_extensions_SupplementalGroupsStrategyOptions,
|
||||
Convert_extensions_SupplementalGroupsStrategyOptions_To_v1beta1_SupplementalGroupsStrategyOptions,
|
||||
)
|
||||
|
@ -1390,68 +1391,68 @@ func Convert_extensions_SELinuxStrategyOptions_To_v1beta1_SELinuxStrategyOptions
|
|||
return autoConvert_extensions_SELinuxStrategyOptions_To_v1beta1_SELinuxStrategyOptions(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1beta1_Scale_To_extensions_Scale(in *v1beta1.Scale, out *extensions.Scale, s conversion.Scope) error {
|
||||
func autoConvert_v1beta1_Scale_To_autoscaling_Scale(in *v1beta1.Scale, out *autoscaling.Scale, s conversion.Scope) error {
|
||||
out.ObjectMeta = in.ObjectMeta
|
||||
if err := Convert_v1beta1_ScaleSpec_To_extensions_ScaleSpec(&in.Spec, &out.Spec, s); err != nil {
|
||||
if err := Convert_v1beta1_ScaleSpec_To_autoscaling_ScaleSpec(&in.Spec, &out.Spec, s); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := Convert_v1beta1_ScaleStatus_To_extensions_ScaleStatus(&in.Status, &out.Status, s); err != nil {
|
||||
if err := Convert_v1beta1_ScaleStatus_To_autoscaling_ScaleStatus(&in.Status, &out.Status, s); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1beta1_Scale_To_extensions_Scale is an autogenerated conversion function.
|
||||
func Convert_v1beta1_Scale_To_extensions_Scale(in *v1beta1.Scale, out *extensions.Scale, s conversion.Scope) error {
|
||||
return autoConvert_v1beta1_Scale_To_extensions_Scale(in, out, s)
|
||||
// Convert_v1beta1_Scale_To_autoscaling_Scale is an autogenerated conversion function.
|
||||
func Convert_v1beta1_Scale_To_autoscaling_Scale(in *v1beta1.Scale, out *autoscaling.Scale, s conversion.Scope) error {
|
||||
return autoConvert_v1beta1_Scale_To_autoscaling_Scale(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_extensions_Scale_To_v1beta1_Scale(in *extensions.Scale, out *v1beta1.Scale, s conversion.Scope) error {
|
||||
func autoConvert_autoscaling_Scale_To_v1beta1_Scale(in *autoscaling.Scale, out *v1beta1.Scale, s conversion.Scope) error {
|
||||
out.ObjectMeta = in.ObjectMeta
|
||||
if err := Convert_extensions_ScaleSpec_To_v1beta1_ScaleSpec(&in.Spec, &out.Spec, s); err != nil {
|
||||
if err := Convert_autoscaling_ScaleSpec_To_v1beta1_ScaleSpec(&in.Spec, &out.Spec, s); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := Convert_extensions_ScaleStatus_To_v1beta1_ScaleStatus(&in.Status, &out.Status, s); err != nil {
|
||||
if err := Convert_autoscaling_ScaleStatus_To_v1beta1_ScaleStatus(&in.Status, &out.Status, s); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_extensions_Scale_To_v1beta1_Scale is an autogenerated conversion function.
|
||||
func Convert_extensions_Scale_To_v1beta1_Scale(in *extensions.Scale, out *v1beta1.Scale, s conversion.Scope) error {
|
||||
return autoConvert_extensions_Scale_To_v1beta1_Scale(in, out, s)
|
||||
// Convert_autoscaling_Scale_To_v1beta1_Scale is an autogenerated conversion function.
|
||||
func Convert_autoscaling_Scale_To_v1beta1_Scale(in *autoscaling.Scale, out *v1beta1.Scale, s conversion.Scope) error {
|
||||
return autoConvert_autoscaling_Scale_To_v1beta1_Scale(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1beta1_ScaleSpec_To_extensions_ScaleSpec(in *v1beta1.ScaleSpec, out *extensions.ScaleSpec, s conversion.Scope) error {
|
||||
func autoConvert_v1beta1_ScaleSpec_To_autoscaling_ScaleSpec(in *v1beta1.ScaleSpec, out *autoscaling.ScaleSpec, s conversion.Scope) error {
|
||||
out.Replicas = in.Replicas
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1beta1_ScaleSpec_To_extensions_ScaleSpec is an autogenerated conversion function.
|
||||
func Convert_v1beta1_ScaleSpec_To_extensions_ScaleSpec(in *v1beta1.ScaleSpec, out *extensions.ScaleSpec, s conversion.Scope) error {
|
||||
return autoConvert_v1beta1_ScaleSpec_To_extensions_ScaleSpec(in, out, s)
|
||||
// Convert_v1beta1_ScaleSpec_To_autoscaling_ScaleSpec is an autogenerated conversion function.
|
||||
func Convert_v1beta1_ScaleSpec_To_autoscaling_ScaleSpec(in *v1beta1.ScaleSpec, out *autoscaling.ScaleSpec, s conversion.Scope) error {
|
||||
return autoConvert_v1beta1_ScaleSpec_To_autoscaling_ScaleSpec(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_extensions_ScaleSpec_To_v1beta1_ScaleSpec(in *extensions.ScaleSpec, out *v1beta1.ScaleSpec, s conversion.Scope) error {
|
||||
func autoConvert_autoscaling_ScaleSpec_To_v1beta1_ScaleSpec(in *autoscaling.ScaleSpec, out *v1beta1.ScaleSpec, s conversion.Scope) error {
|
||||
out.Replicas = in.Replicas
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_extensions_ScaleSpec_To_v1beta1_ScaleSpec is an autogenerated conversion function.
|
||||
func Convert_extensions_ScaleSpec_To_v1beta1_ScaleSpec(in *extensions.ScaleSpec, out *v1beta1.ScaleSpec, s conversion.Scope) error {
|
||||
return autoConvert_extensions_ScaleSpec_To_v1beta1_ScaleSpec(in, out, s)
|
||||
// Convert_autoscaling_ScaleSpec_To_v1beta1_ScaleSpec is an autogenerated conversion function.
|
||||
func Convert_autoscaling_ScaleSpec_To_v1beta1_ScaleSpec(in *autoscaling.ScaleSpec, out *v1beta1.ScaleSpec, s conversion.Scope) error {
|
||||
return autoConvert_autoscaling_ScaleSpec_To_v1beta1_ScaleSpec(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1beta1_ScaleStatus_To_extensions_ScaleStatus(in *v1beta1.ScaleStatus, out *extensions.ScaleStatus, s conversion.Scope) error {
|
||||
func autoConvert_v1beta1_ScaleStatus_To_autoscaling_ScaleStatus(in *v1beta1.ScaleStatus, out *autoscaling.ScaleStatus, s conversion.Scope) error {
|
||||
out.Replicas = in.Replicas
|
||||
// WARNING: in.Selector requires manual conversion: inconvertible types (map[string]string vs *k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector)
|
||||
// WARNING: in.Selector requires manual conversion: inconvertible types (map[string]string vs string)
|
||||
// WARNING: in.TargetSelector requires manual conversion: does not exist in peer-type
|
||||
return nil
|
||||
}
|
||||
|
||||
func autoConvert_extensions_ScaleStatus_To_v1beta1_ScaleStatus(in *extensions.ScaleStatus, out *v1beta1.ScaleStatus, s conversion.Scope) error {
|
||||
func autoConvert_autoscaling_ScaleStatus_To_v1beta1_ScaleStatus(in *autoscaling.ScaleStatus, out *v1beta1.ScaleStatus, s conversion.Scope) error {
|
||||
out.Replicas = in.Replicas
|
||||
// WARNING: in.Selector requires manual conversion: inconvertible types (*k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector vs map[string]string)
|
||||
// WARNING: in.Selector requires manual conversion: inconvertible types (string vs map[string]string)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -522,17 +522,6 @@ func validateIngressBackend(backend *extensions.IngressBackend, fldPath *field.P
|
|||
return allErrs
|
||||
}
|
||||
|
||||
func ValidateScale(scale *extensions.Scale) field.ErrorList {
|
||||
allErrs := field.ErrorList{}
|
||||
allErrs = append(allErrs, apivalidation.ValidateObjectMeta(&scale.ObjectMeta, true, apivalidation.NameIsDNSSubdomain, field.NewPath("metadata"))...)
|
||||
|
||||
if scale.Spec.Replicas < 0 {
|
||||
allErrs = append(allErrs, field.Invalid(field.NewPath("spec", "replicas"), scale.Spec.Replicas, "must be greater than or equal to 0"))
|
||||
}
|
||||
|
||||
return allErrs
|
||||
}
|
||||
|
||||
// ValidateReplicaSetName can be used to check whether the given ReplicaSet
|
||||
// name is valid.
|
||||
// Prefix indicates this name will be used as part of generation, in which case
|
||||
|
|
|
@ -1750,70 +1750,6 @@ func TestValidateIngressStatusUpdate(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestValidateScale(t *testing.T) {
|
||||
successCases := []extensions.Scale{
|
||||
{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "frontend",
|
||||
Namespace: metav1.NamespaceDefault,
|
||||
},
|
||||
Spec: extensions.ScaleSpec{
|
||||
Replicas: 1,
|
||||
},
|
||||
},
|
||||
{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "frontend",
|
||||
Namespace: metav1.NamespaceDefault,
|
||||
},
|
||||
Spec: extensions.ScaleSpec{
|
||||
Replicas: 10,
|
||||
},
|
||||
},
|
||||
{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "frontend",
|
||||
Namespace: metav1.NamespaceDefault,
|
||||
},
|
||||
Spec: extensions.ScaleSpec{
|
||||
Replicas: 0,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, successCase := range successCases {
|
||||
if errs := ValidateScale(&successCase); len(errs) != 0 {
|
||||
t.Errorf("expected success: %v", errs)
|
||||
}
|
||||
}
|
||||
|
||||
errorCases := []struct {
|
||||
scale extensions.Scale
|
||||
msg string
|
||||
}{
|
||||
{
|
||||
scale: extensions.Scale{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "frontend",
|
||||
Namespace: metav1.NamespaceDefault,
|
||||
},
|
||||
Spec: extensions.ScaleSpec{
|
||||
Replicas: -1,
|
||||
},
|
||||
},
|
||||
msg: "must be greater than or equal to 0",
|
||||
},
|
||||
}
|
||||
|
||||
for _, c := range errorCases {
|
||||
if errs := ValidateScale(&c.scale); len(errs) == 0 {
|
||||
t.Errorf("expected failure for %s", c.msg)
|
||||
} else if !strings.Contains(errs[0].Error(), c.msg) {
|
||||
t.Errorf("unexpected error: %v, expected: %s", errs[0], c.msg)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidateReplicaSetStatus(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
|
|
|
@ -218,18 +218,6 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error {
|
|||
in.(*SELinuxStrategyOptions).DeepCopyInto(out.(*SELinuxStrategyOptions))
|
||||
return nil
|
||||
}, InType: reflect.TypeOf(&SELinuxStrategyOptions{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
in.(*Scale).DeepCopyInto(out.(*Scale))
|
||||
return nil
|
||||
}, InType: reflect.TypeOf(&Scale{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
in.(*ScaleSpec).DeepCopyInto(out.(*ScaleSpec))
|
||||
return nil
|
||||
}, InType: reflect.TypeOf(&ScaleSpec{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
in.(*ScaleStatus).DeepCopyInto(out.(*ScaleStatus))
|
||||
return nil
|
||||
}, InType: reflect.TypeOf(&ScaleStatus{})},
|
||||
conversion.GeneratedDeepCopyFunc{Fn: func(in interface{}, out interface{}, c *conversion.Cloner) error {
|
||||
in.(*SupplementalGroupsStrategyOptions).DeepCopyInto(out.(*SupplementalGroupsStrategyOptions))
|
||||
return nil
|
||||
|
@ -1399,76 +1387,6 @@ func (in *SELinuxStrategyOptions) DeepCopy() *SELinuxStrategyOptions {
|
|||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Scale) DeepCopyInto(out *Scale) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
out.Spec = in.Spec
|
||||
in.Status.DeepCopyInto(&out.Status)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Scale.
|
||||
func (in *Scale) DeepCopy() *Scale {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Scale)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *Scale) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ScaleSpec) DeepCopyInto(out *ScaleSpec) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ScaleSpec.
|
||||
func (in *ScaleSpec) DeepCopy() *ScaleSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ScaleSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ScaleStatus) DeepCopyInto(out *ScaleStatus) {
|
||||
*out = *in
|
||||
if in.Selector != nil {
|
||||
in, out := &in.Selector, &out.Selector
|
||||
if *in == nil {
|
||||
*out = nil
|
||||
} else {
|
||||
*out = new(v1.LabelSelector)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ScaleStatus.
|
||||
func (in *ScaleStatus) DeepCopy() *ScaleStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ScaleStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *SupplementalGroupsStrategyOptions) DeepCopyInto(out *SupplementalGroupsStrategyOptions) {
|
||||
*out = *in
|
||||
|
|
|
@ -17,7 +17,7 @@ go_library(
|
|||
importpath = "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/apps/internalversion",
|
||||
deps = [
|
||||
"//pkg/apis/apps:go_default_library",
|
||||
"//pkg/apis/extensions:go_default_library",
|
||||
"//pkg/apis/autoscaling:go_default_library",
|
||||
"//pkg/client/clientset_generated/internalclientset/scheme:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/types:go_default_library",
|
||||
|
|
|
@ -16,7 +16,7 @@ go_library(
|
|||
importpath = "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/apps/internalversion/fake",
|
||||
deps = [
|
||||
"//pkg/apis/apps:go_default_library",
|
||||
"//pkg/apis/extensions:go_default_library",
|
||||
"//pkg/apis/autoscaling:go_default_library",
|
||||
"//pkg/client/clientset_generated/internalclientset/typed/apps/internalversion:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/labels:go_default_library",
|
||||
|
|
|
@ -24,7 +24,7 @@ import (
|
|||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
testing "k8s.io/client-go/testing"
|
||||
apps "k8s.io/kubernetes/pkg/apis/apps"
|
||||
extensions "k8s.io/kubernetes/pkg/apis/extensions"
|
||||
autoscaling "k8s.io/kubernetes/pkg/apis/autoscaling"
|
||||
)
|
||||
|
||||
// FakeStatefulSets implements StatefulSetInterface
|
||||
|
@ -139,23 +139,23 @@ func (c *FakeStatefulSets) Patch(name string, pt types.PatchType, data []byte, s
|
|||
}
|
||||
|
||||
// GetScale takes name of the statefulSet, and returns the corresponding scale object, and an error if there is any.
|
||||
func (c *FakeStatefulSets) GetScale(statefulSetName string, options v1.GetOptions) (result *extensions.Scale, err error) {
|
||||
func (c *FakeStatefulSets) GetScale(statefulSetName string, options v1.GetOptions) (result *autoscaling.Scale, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewGetSubresourceAction(statefulsetsResource, c.ns, "scale", statefulSetName), &extensions.Scale{})
|
||||
Invokes(testing.NewGetSubresourceAction(statefulsetsResource, c.ns, "scale", statefulSetName), &autoscaling.Scale{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*extensions.Scale), err
|
||||
return obj.(*autoscaling.Scale), err
|
||||
}
|
||||
|
||||
// UpdateScale takes the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any.
|
||||
func (c *FakeStatefulSets) UpdateScale(statefulSetName string, scale *extensions.Scale) (result *extensions.Scale, err error) {
|
||||
func (c *FakeStatefulSets) UpdateScale(statefulSetName string, scale *autoscaling.Scale) (result *autoscaling.Scale, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateSubresourceAction(statefulsetsResource, "scale", c.ns, scale), &extensions.Scale{})
|
||||
Invokes(testing.NewUpdateSubresourceAction(statefulsetsResource, "scale", c.ns, scale), &autoscaling.Scale{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*extensions.Scale), err
|
||||
return obj.(*autoscaling.Scale), err
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ import (
|
|||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
rest "k8s.io/client-go/rest"
|
||||
apps "k8s.io/kubernetes/pkg/apis/apps"
|
||||
extensions "k8s.io/kubernetes/pkg/apis/extensions"
|
||||
autoscaling "k8s.io/kubernetes/pkg/apis/autoscaling"
|
||||
scheme "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/scheme"
|
||||
)
|
||||
|
||||
|
@ -43,8 +43,8 @@ type StatefulSetInterface interface {
|
|||
List(opts v1.ListOptions) (*apps.StatefulSetList, error)
|
||||
Watch(opts v1.ListOptions) (watch.Interface, error)
|
||||
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *apps.StatefulSet, err error)
|
||||
GetScale(statefulSetName string, options v1.GetOptions) (*extensions.Scale, error)
|
||||
UpdateScale(statefulSetName string, scale *extensions.Scale) (*extensions.Scale, error)
|
||||
GetScale(statefulSetName string, options v1.GetOptions) (*autoscaling.Scale, error)
|
||||
UpdateScale(statefulSetName string, scale *autoscaling.Scale) (*autoscaling.Scale, error)
|
||||
|
||||
StatefulSetExpansion
|
||||
}
|
||||
|
@ -175,9 +175,9 @@ func (c *statefulSets) Patch(name string, pt types.PatchType, data []byte, subre
|
|||
return
|
||||
}
|
||||
|
||||
// GetScale takes name of the statefulSet, and returns the corresponding extensions.Scale object, and an error if there is any.
|
||||
func (c *statefulSets) GetScale(statefulSetName string, options v1.GetOptions) (result *extensions.Scale, err error) {
|
||||
result = &extensions.Scale{}
|
||||
// GetScale takes name of the statefulSet, and returns the corresponding autoscaling.Scale object, and an error if there is any.
|
||||
func (c *statefulSets) GetScale(statefulSetName string, options v1.GetOptions) (result *autoscaling.Scale, err error) {
|
||||
result = &autoscaling.Scale{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("statefulsets").
|
||||
|
@ -190,8 +190,8 @@ func (c *statefulSets) GetScale(statefulSetName string, options v1.GetOptions) (
|
|||
}
|
||||
|
||||
// UpdateScale takes the top resource name and the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any.
|
||||
func (c *statefulSets) UpdateScale(statefulSetName string, scale *extensions.Scale) (result *extensions.Scale, err error) {
|
||||
result = &extensions.Scale{}
|
||||
func (c *statefulSets) UpdateScale(statefulSetName string, scale *autoscaling.Scale) (result *autoscaling.Scale, err error) {
|
||||
result = &autoscaling.Scale{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("statefulsets").
|
||||
|
|
|
@ -37,9 +37,9 @@ go_library(
|
|||
deps = [
|
||||
"//pkg/api/legacyscheme:go_default_library",
|
||||
"//pkg/api/ref:go_default_library",
|
||||
"//pkg/apis/autoscaling:go_default_library",
|
||||
"//pkg/apis/core:go_default_library",
|
||||
"//pkg/apis/core/v1:go_default_library",
|
||||
"//pkg/apis/extensions:go_default_library",
|
||||
"//pkg/client/clientset_generated/internalclientset/scheme:go_default_library",
|
||||
"//vendor/k8s.io/api/core/v1:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||
|
|
|
@ -34,8 +34,8 @@ go_library(
|
|||
],
|
||||
importpath = "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/core/internalversion/fake",
|
||||
deps = [
|
||||
"//pkg/apis/autoscaling:go_default_library",
|
||||
"//pkg/apis/core:go_default_library",
|
||||
"//pkg/apis/extensions:go_default_library",
|
||||
"//pkg/client/clientset_generated/internalclientset/typed/core/internalversion:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/fields:go_default_library",
|
||||
|
|
|
@ -23,8 +23,8 @@ import (
|
|||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
testing "k8s.io/client-go/testing"
|
||||
autoscaling "k8s.io/kubernetes/pkg/apis/autoscaling"
|
||||
core "k8s.io/kubernetes/pkg/apis/core"
|
||||
extensions "k8s.io/kubernetes/pkg/apis/extensions"
|
||||
)
|
||||
|
||||
// FakeReplicationControllers implements ReplicationControllerInterface
|
||||
|
@ -139,23 +139,23 @@ func (c *FakeReplicationControllers) Patch(name string, pt types.PatchType, data
|
|||
}
|
||||
|
||||
// GetScale takes name of the replicationController, and returns the corresponding scale object, and an error if there is any.
|
||||
func (c *FakeReplicationControllers) GetScale(replicationControllerName string, options v1.GetOptions) (result *extensions.Scale, err error) {
|
||||
func (c *FakeReplicationControllers) GetScale(replicationControllerName string, options v1.GetOptions) (result *autoscaling.Scale, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewGetSubresourceAction(replicationcontrollersResource, c.ns, "scale", replicationControllerName), &extensions.Scale{})
|
||||
Invokes(testing.NewGetSubresourceAction(replicationcontrollersResource, c.ns, "scale", replicationControllerName), &autoscaling.Scale{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*extensions.Scale), err
|
||||
return obj.(*autoscaling.Scale), err
|
||||
}
|
||||
|
||||
// UpdateScale takes the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any.
|
||||
func (c *FakeReplicationControllers) UpdateScale(replicationControllerName string, scale *extensions.Scale) (result *extensions.Scale, err error) {
|
||||
func (c *FakeReplicationControllers) UpdateScale(replicationControllerName string, scale *autoscaling.Scale) (result *autoscaling.Scale, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateSubresourceAction(replicationcontrollersResource, "scale", c.ns, scale), &extensions.Scale{})
|
||||
Invokes(testing.NewUpdateSubresourceAction(replicationcontrollersResource, "scale", c.ns, scale), &autoscaling.Scale{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*extensions.Scale), err
|
||||
return obj.(*autoscaling.Scale), err
|
||||
}
|
||||
|
|
|
@ -21,8 +21,8 @@ import (
|
|||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
rest "k8s.io/client-go/rest"
|
||||
autoscaling "k8s.io/kubernetes/pkg/apis/autoscaling"
|
||||
core "k8s.io/kubernetes/pkg/apis/core"
|
||||
extensions "k8s.io/kubernetes/pkg/apis/extensions"
|
||||
scheme "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/scheme"
|
||||
)
|
||||
|
||||
|
@ -43,8 +43,8 @@ type ReplicationControllerInterface interface {
|
|||
List(opts v1.ListOptions) (*core.ReplicationControllerList, error)
|
||||
Watch(opts v1.ListOptions) (watch.Interface, error)
|
||||
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *core.ReplicationController, err error)
|
||||
GetScale(replicationControllerName string, options v1.GetOptions) (*extensions.Scale, error)
|
||||
UpdateScale(replicationControllerName string, scale *extensions.Scale) (*extensions.Scale, error)
|
||||
GetScale(replicationControllerName string, options v1.GetOptions) (*autoscaling.Scale, error)
|
||||
UpdateScale(replicationControllerName string, scale *autoscaling.Scale) (*autoscaling.Scale, error)
|
||||
|
||||
ReplicationControllerExpansion
|
||||
}
|
||||
|
@ -175,9 +175,9 @@ func (c *replicationControllers) Patch(name string, pt types.PatchType, data []b
|
|||
return
|
||||
}
|
||||
|
||||
// GetScale takes name of the replicationController, and returns the corresponding extensions.Scale object, and an error if there is any.
|
||||
func (c *replicationControllers) GetScale(replicationControllerName string, options v1.GetOptions) (result *extensions.Scale, err error) {
|
||||
result = &extensions.Scale{}
|
||||
// GetScale takes name of the replicationController, and returns the corresponding autoscaling.Scale object, and an error if there is any.
|
||||
func (c *replicationControllers) GetScale(replicationControllerName string, options v1.GetOptions) (result *autoscaling.Scale, err error) {
|
||||
result = &autoscaling.Scale{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("replicationcontrollers").
|
||||
|
@ -190,8 +190,8 @@ func (c *replicationControllers) GetScale(replicationControllerName string, opti
|
|||
}
|
||||
|
||||
// UpdateScale takes the top resource name and the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any.
|
||||
func (c *replicationControllers) UpdateScale(replicationControllerName string, scale *extensions.Scale) (result *extensions.Scale, err error) {
|
||||
result = &extensions.Scale{}
|
||||
func (c *replicationControllers) UpdateScale(replicationControllerName string, scale *autoscaling.Scale) (result *autoscaling.Scale, err error) {
|
||||
result = &autoscaling.Scale{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("replicationcontrollers").
|
||||
|
|
|
@ -17,16 +17,13 @@ go_library(
|
|||
"ingress.go",
|
||||
"podsecuritypolicy.go",
|
||||
"replicaset.go",
|
||||
"scale.go",
|
||||
"scale_expansion.go",
|
||||
],
|
||||
importpath = "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/extensions/internalversion",
|
||||
deps = [
|
||||
"//pkg/apis/autoscaling:go_default_library",
|
||||
"//pkg/apis/extensions:go_default_library",
|
||||
"//pkg/client/clientset_generated/internalclientset/scheme:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/api/meta:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/types:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/watch:go_default_library",
|
||||
"//vendor/k8s.io/client-go/rest:go_default_library",
|
||||
|
|
|
@ -21,6 +21,7 @@ import (
|
|||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
rest "k8s.io/client-go/rest"
|
||||
autoscaling "k8s.io/kubernetes/pkg/apis/autoscaling"
|
||||
extensions "k8s.io/kubernetes/pkg/apis/extensions"
|
||||
scheme "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/scheme"
|
||||
)
|
||||
|
@ -42,8 +43,8 @@ type DeploymentInterface interface {
|
|||
List(opts v1.ListOptions) (*extensions.DeploymentList, error)
|
||||
Watch(opts v1.ListOptions) (watch.Interface, error)
|
||||
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *extensions.Deployment, err error)
|
||||
GetScale(deploymentName string, options v1.GetOptions) (*extensions.Scale, error)
|
||||
UpdateScale(deploymentName string, scale *extensions.Scale) (*extensions.Scale, error)
|
||||
GetScale(deploymentName string, options v1.GetOptions) (*autoscaling.Scale, error)
|
||||
UpdateScale(deploymentName string, scale *autoscaling.Scale) (*autoscaling.Scale, error)
|
||||
|
||||
DeploymentExpansion
|
||||
}
|
||||
|
@ -174,9 +175,9 @@ func (c *deployments) Patch(name string, pt types.PatchType, data []byte, subres
|
|||
return
|
||||
}
|
||||
|
||||
// GetScale takes name of the deployment, and returns the corresponding extensions.Scale object, and an error if there is any.
|
||||
func (c *deployments) GetScale(deploymentName string, options v1.GetOptions) (result *extensions.Scale, err error) {
|
||||
result = &extensions.Scale{}
|
||||
// GetScale takes name of the deployment, and returns the corresponding autoscaling.Scale object, and an error if there is any.
|
||||
func (c *deployments) GetScale(deploymentName string, options v1.GetOptions) (result *autoscaling.Scale, err error) {
|
||||
result = &autoscaling.Scale{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("deployments").
|
||||
|
@ -189,8 +190,8 @@ func (c *deployments) GetScale(deploymentName string, options v1.GetOptions) (re
|
|||
}
|
||||
|
||||
// UpdateScale takes the top resource name and the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any.
|
||||
func (c *deployments) UpdateScale(deploymentName string, scale *extensions.Scale) (result *extensions.Scale, err error) {
|
||||
result = &extensions.Scale{}
|
||||
func (c *deployments) UpdateScale(deploymentName string, scale *autoscaling.Scale) (result *autoscaling.Scale, err error) {
|
||||
result = &autoscaling.Scale{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("deployments").
|
||||
|
|
|
@ -28,7 +28,6 @@ type ExtensionsInterface interface {
|
|||
IngressesGetter
|
||||
PodSecurityPoliciesGetter
|
||||
ReplicaSetsGetter
|
||||
ScalesGetter
|
||||
}
|
||||
|
||||
// ExtensionsClient is used to interact with features provided by the extensions group.
|
||||
|
@ -56,10 +55,6 @@ func (c *ExtensionsClient) ReplicaSets(namespace string) ReplicaSetInterface {
|
|||
return newReplicaSets(c, namespace)
|
||||
}
|
||||
|
||||
func (c *ExtensionsClient) Scales(namespace string) ScaleInterface {
|
||||
return newScales(c, namespace)
|
||||
}
|
||||
|
||||
// NewForConfig creates a new ExtensionsClient for the given config.
|
||||
func NewForConfig(c *rest.Config) (*ExtensionsClient, error) {
|
||||
config := *c
|
||||
|
|
|
@ -16,11 +16,10 @@ go_library(
|
|||
"fake_ingress.go",
|
||||
"fake_podsecuritypolicy.go",
|
||||
"fake_replicaset.go",
|
||||
"fake_scale.go",
|
||||
"fake_scale_expansion.go",
|
||||
],
|
||||
importpath = "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/extensions/internalversion/fake",
|
||||
deps = [
|
||||
"//pkg/apis/autoscaling:go_default_library",
|
||||
"//pkg/apis/extensions:go_default_library",
|
||||
"//pkg/client/clientset_generated/internalclientset/typed/extensions/internalversion:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||
|
|
|
@ -23,6 +23,7 @@ import (
|
|||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
testing "k8s.io/client-go/testing"
|
||||
autoscaling "k8s.io/kubernetes/pkg/apis/autoscaling"
|
||||
extensions "k8s.io/kubernetes/pkg/apis/extensions"
|
||||
)
|
||||
|
||||
|
@ -138,23 +139,23 @@ func (c *FakeDeployments) Patch(name string, pt types.PatchType, data []byte, su
|
|||
}
|
||||
|
||||
// GetScale takes name of the deployment, and returns the corresponding scale object, and an error if there is any.
|
||||
func (c *FakeDeployments) GetScale(deploymentName string, options v1.GetOptions) (result *extensions.Scale, err error) {
|
||||
func (c *FakeDeployments) GetScale(deploymentName string, options v1.GetOptions) (result *autoscaling.Scale, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewGetSubresourceAction(deploymentsResource, c.ns, "scale", deploymentName), &extensions.Scale{})
|
||||
Invokes(testing.NewGetSubresourceAction(deploymentsResource, c.ns, "scale", deploymentName), &autoscaling.Scale{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*extensions.Scale), err
|
||||
return obj.(*autoscaling.Scale), err
|
||||
}
|
||||
|
||||
// UpdateScale takes the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any.
|
||||
func (c *FakeDeployments) UpdateScale(deploymentName string, scale *extensions.Scale) (result *extensions.Scale, err error) {
|
||||
func (c *FakeDeployments) UpdateScale(deploymentName string, scale *autoscaling.Scale) (result *autoscaling.Scale, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateSubresourceAction(deploymentsResource, "scale", c.ns, scale), &extensions.Scale{})
|
||||
Invokes(testing.NewUpdateSubresourceAction(deploymentsResource, "scale", c.ns, scale), &autoscaling.Scale{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*extensions.Scale), err
|
||||
return obj.(*autoscaling.Scale), err
|
||||
}
|
||||
|
|
|
@ -46,10 +46,6 @@ func (c *FakeExtensions) ReplicaSets(namespace string) internalversion.ReplicaSe
|
|||
return &FakeReplicaSets{c, namespace}
|
||||
}
|
||||
|
||||
func (c *FakeExtensions) Scales(namespace string) internalversion.ScaleInterface {
|
||||
return &FakeScales{c, namespace}
|
||||
}
|
||||
|
||||
// RESTClient returns a RESTClient that is used to communicate
|
||||
// with API server by this client implementation.
|
||||
func (c *FakeExtensions) RESTClient() rest.Interface {
|
||||
|
|
|
@ -23,6 +23,7 @@ import (
|
|||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
testing "k8s.io/client-go/testing"
|
||||
autoscaling "k8s.io/kubernetes/pkg/apis/autoscaling"
|
||||
extensions "k8s.io/kubernetes/pkg/apis/extensions"
|
||||
)
|
||||
|
||||
|
@ -138,23 +139,23 @@ func (c *FakeReplicaSets) Patch(name string, pt types.PatchType, data []byte, su
|
|||
}
|
||||
|
||||
// GetScale takes name of the replicaSet, and returns the corresponding scale object, and an error if there is any.
|
||||
func (c *FakeReplicaSets) GetScale(replicaSetName string, options v1.GetOptions) (result *extensions.Scale, err error) {
|
||||
func (c *FakeReplicaSets) GetScale(replicaSetName string, options v1.GetOptions) (result *autoscaling.Scale, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewGetSubresourceAction(replicasetsResource, c.ns, "scale", replicaSetName), &extensions.Scale{})
|
||||
Invokes(testing.NewGetSubresourceAction(replicasetsResource, c.ns, "scale", replicaSetName), &autoscaling.Scale{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*extensions.Scale), err
|
||||
return obj.(*autoscaling.Scale), err
|
||||
}
|
||||
|
||||
// UpdateScale takes the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any.
|
||||
func (c *FakeReplicaSets) UpdateScale(replicaSetName string, scale *extensions.Scale) (result *extensions.Scale, err error) {
|
||||
func (c *FakeReplicaSets) UpdateScale(replicaSetName string, scale *autoscaling.Scale) (result *autoscaling.Scale, err error) {
|
||||
obj, err := c.Fake.
|
||||
Invokes(testing.NewUpdateSubresourceAction(replicasetsResource, "scale", c.ns, scale), &extensions.Scale{})
|
||||
Invokes(testing.NewUpdateSubresourceAction(replicasetsResource, "scale", c.ns, scale), &autoscaling.Scale{})
|
||||
|
||||
if obj == nil {
|
||||
return nil, err
|
||||
}
|
||||
return obj.(*extensions.Scale), err
|
||||
return obj.(*autoscaling.Scale), err
|
||||
}
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
/*
|
||||
Copyright 2017 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
|
||||
|
||||
// FakeScales implements ScaleInterface
|
||||
type FakeScales struct {
|
||||
Fake *FakeExtensions
|
||||
ns string
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
/*
|
||||
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 fake
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
core "k8s.io/client-go/testing"
|
||||
"k8s.io/kubernetes/pkg/apis/extensions"
|
||||
)
|
||||
|
||||
func (c *FakeScales) Get(kind string, name string) (result *extensions.Scale, err error) {
|
||||
action := core.GetActionImpl{}
|
||||
action.Verb = "get"
|
||||
action.Namespace = c.ns
|
||||
action.Resource = schema.GroupVersionResource{Resource: kind}
|
||||
action.Subresource = "scale"
|
||||
action.Name = name
|
||||
obj, err := c.Fake.Invokes(action, &extensions.Scale{})
|
||||
result = obj.(*extensions.Scale)
|
||||
return
|
||||
}
|
||||
|
||||
func (c *FakeScales) Update(kind string, scale *extensions.Scale) (result *extensions.Scale, err error) {
|
||||
action := core.UpdateActionImpl{}
|
||||
action.Verb = "update"
|
||||
action.Namespace = c.ns
|
||||
action.Resource = schema.GroupVersionResource{Resource: kind}
|
||||
action.Subresource = "scale"
|
||||
action.Object = scale
|
||||
obj, err := c.Fake.Invokes(action, scale)
|
||||
result = obj.(*extensions.Scale)
|
||||
return
|
||||
}
|
|
@ -21,6 +21,7 @@ import (
|
|||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
rest "k8s.io/client-go/rest"
|
||||
autoscaling "k8s.io/kubernetes/pkg/apis/autoscaling"
|
||||
extensions "k8s.io/kubernetes/pkg/apis/extensions"
|
||||
scheme "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/scheme"
|
||||
)
|
||||
|
@ -42,8 +43,8 @@ type ReplicaSetInterface interface {
|
|||
List(opts v1.ListOptions) (*extensions.ReplicaSetList, error)
|
||||
Watch(opts v1.ListOptions) (watch.Interface, error)
|
||||
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *extensions.ReplicaSet, err error)
|
||||
GetScale(replicaSetName string, options v1.GetOptions) (*extensions.Scale, error)
|
||||
UpdateScale(replicaSetName string, scale *extensions.Scale) (*extensions.Scale, error)
|
||||
GetScale(replicaSetName string, options v1.GetOptions) (*autoscaling.Scale, error)
|
||||
UpdateScale(replicaSetName string, scale *autoscaling.Scale) (*autoscaling.Scale, error)
|
||||
|
||||
ReplicaSetExpansion
|
||||
}
|
||||
|
@ -174,9 +175,9 @@ func (c *replicaSets) Patch(name string, pt types.PatchType, data []byte, subres
|
|||
return
|
||||
}
|
||||
|
||||
// GetScale takes name of the replicaSet, and returns the corresponding extensions.Scale object, and an error if there is any.
|
||||
func (c *replicaSets) GetScale(replicaSetName string, options v1.GetOptions) (result *extensions.Scale, err error) {
|
||||
result = &extensions.Scale{}
|
||||
// GetScale takes name of the replicaSet, and returns the corresponding autoscaling.Scale object, and an error if there is any.
|
||||
func (c *replicaSets) GetScale(replicaSetName string, options v1.GetOptions) (result *autoscaling.Scale, err error) {
|
||||
result = &autoscaling.Scale{}
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource("replicasets").
|
||||
|
@ -189,8 +190,8 @@ func (c *replicaSets) GetScale(replicaSetName string, options v1.GetOptions) (re
|
|||
}
|
||||
|
||||
// UpdateScale takes the top resource name and the representation of a scale and updates it. Returns the server's representation of the scale, and an error, if there is any.
|
||||
func (c *replicaSets) UpdateScale(replicaSetName string, scale *extensions.Scale) (result *extensions.Scale, err error) {
|
||||
result = &extensions.Scale{}
|
||||
func (c *replicaSets) UpdateScale(replicaSetName string, scale *autoscaling.Scale) (result *autoscaling.Scale, err error) {
|
||||
result = &autoscaling.Scale{}
|
||||
err = c.client.Put().
|
||||
Namespace(c.ns).
|
||||
Resource("replicasets").
|
||||
|
|
|
@ -1,46 +0,0 @@
|
|||
/*
|
||||
Copyright 2017 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 internalversion
|
||||
|
||||
import (
|
||||
rest "k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
// ScalesGetter has a method to return a ScaleInterface.
|
||||
// A group's client should implement this interface.
|
||||
type ScalesGetter interface {
|
||||
Scales(namespace string) ScaleInterface
|
||||
}
|
||||
|
||||
// ScaleInterface has methods to work with Scale resources.
|
||||
type ScaleInterface interface {
|
||||
ScaleExpansion
|
||||
}
|
||||
|
||||
// scales implements ScaleInterface
|
||||
type scales struct {
|
||||
client rest.Interface
|
||||
ns string
|
||||
}
|
||||
|
||||
// newScales returns a Scales
|
||||
func newScales(c *ExtensionsClient, namespace string) *scales {
|
||||
return &scales{
|
||||
client: c.RESTClient(),
|
||||
ns: namespace,
|
||||
}
|
||||
}
|
|
@ -1,65 +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 internalversion
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/api/meta"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/kubernetes/pkg/apis/extensions"
|
||||
)
|
||||
|
||||
// The ScaleExpansion interface allows manually adding extra methods to the ScaleInterface.
|
||||
type ScaleExpansion interface {
|
||||
Get(kind string, name string) (*extensions.Scale, error)
|
||||
Update(kind string, scale *extensions.Scale) (*extensions.Scale, error)
|
||||
}
|
||||
|
||||
// Get takes the reference to scale subresource and returns the subresource or error, if one occurs.
|
||||
func (c *scales) Get(kind string, name string) (result *extensions.Scale, err error) {
|
||||
result = &extensions.Scale{}
|
||||
|
||||
// TODO this method needs to take a proper unambiguous kind
|
||||
fullyQualifiedKind := schema.GroupVersionKind{Kind: kind}
|
||||
resource, _ := meta.UnsafeGuessKindToResource(fullyQualifiedKind)
|
||||
|
||||
err = c.client.Get().
|
||||
Namespace(c.ns).
|
||||
Resource(resource.Resource).
|
||||
Name(name).
|
||||
SubResource("scale").
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
||||
|
||||
func (c *scales) Update(kind string, scale *extensions.Scale) (result *extensions.Scale, err error) {
|
||||
result = &extensions.Scale{}
|
||||
|
||||
// TODO this method needs to take a proper unambiguous kind
|
||||
fullyQualifiedKind := schema.GroupVersionKind{Kind: kind}
|
||||
resource, _ := meta.UnsafeGuessKindToResource(fullyQualifiedKind)
|
||||
|
||||
err = c.client.Put().
|
||||
Namespace(scale.Namespace).
|
||||
Resource(resource.Resource).
|
||||
Name(scale.Name).
|
||||
SubResource("scale").
|
||||
Body(scale).
|
||||
Do().
|
||||
Into(result)
|
||||
return
|
||||
}
|
|
@ -18,7 +18,6 @@ go_library(
|
|||
"podsecuritypolicy.go",
|
||||
"replicaset.go",
|
||||
"replicaset_expansion.go",
|
||||
"scale.go",
|
||||
],
|
||||
importpath = "k8s.io/kubernetes/pkg/client/listers/extensions/internalversion",
|
||||
deps = [
|
||||
|
|
|
@ -29,11 +29,3 @@ type IngressNamespaceListerExpansion interface{}
|
|||
// PodSecurityPolicyListerExpansion allows custom methods to be added to
|
||||
// PodSecurityPolicyLister.
|
||||
type PodSecurityPolicyListerExpansion interface{}
|
||||
|
||||
// ScaleListerExpansion allows custom methods to be added to
|
||||
// ScaleLister.
|
||||
type ScaleListerExpansion interface{}
|
||||
|
||||
// ScaleNamespaceListerExpansion allows custom methods to be added to
|
||||
// ScaleNamespaceLister.
|
||||
type ScaleNamespaceListerExpansion interface{}
|
||||
|
|
|
@ -1,94 +0,0 @@
|
|||
/*
|
||||
Copyright 2017 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 automatically generated by lister-gen
|
||||
|
||||
package internalversion
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
extensions "k8s.io/kubernetes/pkg/apis/extensions"
|
||||
)
|
||||
|
||||
// ScaleLister helps list Scales.
|
||||
type ScaleLister interface {
|
||||
// List lists all Scales in the indexer.
|
||||
List(selector labels.Selector) (ret []*extensions.Scale, err error)
|
||||
// Scales returns an object that can list and get Scales.
|
||||
Scales(namespace string) ScaleNamespaceLister
|
||||
ScaleListerExpansion
|
||||
}
|
||||
|
||||
// scaleLister implements the ScaleLister interface.
|
||||
type scaleLister struct {
|
||||
indexer cache.Indexer
|
||||
}
|
||||
|
||||
// NewScaleLister returns a new ScaleLister.
|
||||
func NewScaleLister(indexer cache.Indexer) ScaleLister {
|
||||
return &scaleLister{indexer: indexer}
|
||||
}
|
||||
|
||||
// List lists all Scales in the indexer.
|
||||
func (s *scaleLister) List(selector labels.Selector) (ret []*extensions.Scale, err error) {
|
||||
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
|
||||
ret = append(ret, m.(*extensions.Scale))
|
||||
})
|
||||
return ret, err
|
||||
}
|
||||
|
||||
// Scales returns an object that can list and get Scales.
|
||||
func (s *scaleLister) Scales(namespace string) ScaleNamespaceLister {
|
||||
return scaleNamespaceLister{indexer: s.indexer, namespace: namespace}
|
||||
}
|
||||
|
||||
// ScaleNamespaceLister helps list and get Scales.
|
||||
type ScaleNamespaceLister interface {
|
||||
// List lists all Scales in the indexer for a given namespace.
|
||||
List(selector labels.Selector) (ret []*extensions.Scale, err error)
|
||||
// Get retrieves the Scale from the indexer for a given namespace and name.
|
||||
Get(name string) (*extensions.Scale, error)
|
||||
ScaleNamespaceListerExpansion
|
||||
}
|
||||
|
||||
// scaleNamespaceLister implements the ScaleNamespaceLister
|
||||
// interface.
|
||||
type scaleNamespaceLister struct {
|
||||
indexer cache.Indexer
|
||||
namespace string
|
||||
}
|
||||
|
||||
// List lists all Scales in the indexer for a given namespace.
|
||||
func (s scaleNamespaceLister) List(selector labels.Selector) (ret []*extensions.Scale, err error) {
|
||||
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
|
||||
ret = append(ret, m.(*extensions.Scale))
|
||||
})
|
||||
return ret, err
|
||||
}
|
||||
|
||||
// Get retrieves the Scale from the indexer for a given namespace and name.
|
||||
func (s scaleNamespaceLister) Get(name string) (*extensions.Scale, error) {
|
||||
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !exists {
|
||||
return nil, errors.NewNotFound(extensions.Resource("scale"), name)
|
||||
}
|
||||
return obj.(*extensions.Scale), nil
|
||||
}
|
|
@ -122,11 +122,13 @@ func (p RESTStorageProvider) v1Storage(apiResourceConfigSource serverstorage.API
|
|||
deploymentStorage := deploymentstore.NewStorage(restOptionsGetter)
|
||||
storage["deployments"] = deploymentStorage.Deployment
|
||||
storage["deployments/status"] = deploymentStorage.Status
|
||||
storage["deployments/scale"] = deploymentStorage.Scale
|
||||
}
|
||||
if apiResourceConfigSource.ResourceEnabled(version.WithResource("statefulsets")) {
|
||||
statefulSetStorage := statefulsetstore.NewStorage(restOptionsGetter)
|
||||
storage["statefulsets"] = statefulSetStorage.StatefulSet
|
||||
storage["statefulsets/status"] = statefulSetStorage.Status
|
||||
storage["statefulsets/scale"] = statefulSetStorage.Scale
|
||||
}
|
||||
if apiResourceConfigSource.ResourceEnabled(version.WithResource("daemonsets")) {
|
||||
daemonSetStorage, daemonSetStatusStorage := daemonsetstore.NewREST(restOptionsGetter)
|
||||
|
@ -137,6 +139,7 @@ func (p RESTStorageProvider) v1Storage(apiResourceConfigSource serverstorage.API
|
|||
replicaSetStorage := replicasetstore.NewStorage(restOptionsGetter)
|
||||
storage["replicasets"] = replicaSetStorage.ReplicaSet
|
||||
storage["replicasets/status"] = replicaSetStorage.Status
|
||||
storage["replicasets/scale"] = replicaSetStorage.Scale
|
||||
}
|
||||
if apiResourceConfigSource.ResourceEnabled(version.WithResource("controllerrevisions")) {
|
||||
historyStorage := controllerrevisionsstore.NewREST(restOptionsGetter)
|
||||
|
|
|
@ -13,8 +13,8 @@ go_test(
|
|||
library = ":go_default_library",
|
||||
deps = [
|
||||
"//pkg/apis/apps:go_default_library",
|
||||
"//pkg/apis/autoscaling:go_default_library",
|
||||
"//pkg/apis/core:go_default_library",
|
||||
"//pkg/apis/extensions:go_default_library",
|
||||
"//pkg/registry/registrytest:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/api/equality:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/api/errors:go_default_library",
|
||||
|
@ -37,9 +37,10 @@ go_library(
|
|||
"//pkg/apis/apps:go_default_library",
|
||||
"//pkg/apis/apps/v1beta1:go_default_library",
|
||||
"//pkg/apis/apps/v1beta2:go_default_library",
|
||||
"//pkg/apis/autoscaling:go_default_library",
|
||||
"//pkg/apis/autoscaling/v1:go_default_library",
|
||||
"//pkg/apis/autoscaling/validation:go_default_library",
|
||||
"//pkg/apis/extensions:go_default_library",
|
||||
"//pkg/apis/extensions/validation:go_default_library",
|
||||
"//pkg/printers:go_default_library",
|
||||
"//pkg/printers/internalversion:go_default_library",
|
||||
"//pkg/printers/storage:go_default_library",
|
||||
|
|
|
@ -30,9 +30,10 @@ import (
|
|||
"k8s.io/kubernetes/pkg/apis/apps"
|
||||
appsv1beta1 "k8s.io/kubernetes/pkg/apis/apps/v1beta1"
|
||||
appsv1beta2 "k8s.io/kubernetes/pkg/apis/apps/v1beta2"
|
||||
"k8s.io/kubernetes/pkg/apis/autoscaling"
|
||||
autoscalingv1 "k8s.io/kubernetes/pkg/apis/autoscaling/v1"
|
||||
autoscalingvalidation "k8s.io/kubernetes/pkg/apis/autoscaling/validation"
|
||||
"k8s.io/kubernetes/pkg/apis/extensions"
|
||||
extvalidation "k8s.io/kubernetes/pkg/apis/extensions/validation"
|
||||
"k8s.io/kubernetes/pkg/printers"
|
||||
printersinternal "k8s.io/kubernetes/pkg/printers/internalversion"
|
||||
printerstorage "k8s.io/kubernetes/pkg/printers/storage"
|
||||
|
@ -141,7 +142,7 @@ func (r *ScaleREST) GroupVersionKind(containingGV schema.GroupVersion) schema.Gr
|
|||
|
||||
// New creates a new Scale object
|
||||
func (r *ScaleREST) New() runtime.Object {
|
||||
return &extensions.Scale{}
|
||||
return &autoscaling.Scale{}
|
||||
}
|
||||
|
||||
func (r *ScaleREST) Get(ctx genericapirequest.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
||||
|
@ -174,12 +175,12 @@ func (r *ScaleREST) Update(ctx genericapirequest.Context, name string, objInfo r
|
|||
if obj == nil {
|
||||
return nil, false, errors.NewBadRequest(fmt.Sprintf("nil update passed to Scale"))
|
||||
}
|
||||
scale, ok := obj.(*extensions.Scale)
|
||||
scale, ok := obj.(*autoscaling.Scale)
|
||||
if !ok {
|
||||
return nil, false, errors.NewBadRequest(fmt.Sprintf("wrong object passed to Scale update: %v", obj))
|
||||
}
|
||||
|
||||
if errs := extvalidation.ValidateScale(scale); len(errs) > 0 {
|
||||
if errs := autoscalingvalidation.ValidateScale(scale); len(errs) > 0 {
|
||||
return nil, false, errors.NewInvalid(extensions.Kind("Scale"), scale.Name, errs)
|
||||
}
|
||||
|
||||
|
@ -197,8 +198,12 @@ func (r *ScaleREST) Update(ctx genericapirequest.Context, name string, objInfo r
|
|||
}
|
||||
|
||||
// scaleFromStatefulSet returns a scale subresource for a statefulset.
|
||||
func scaleFromStatefulSet(ss *apps.StatefulSet) (*extensions.Scale, error) {
|
||||
return &extensions.Scale{
|
||||
func scaleFromStatefulSet(ss *apps.StatefulSet) (*autoscaling.Scale, error) {
|
||||
selector, err := metav1.LabelSelectorAsSelector(ss.Spec.Selector)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &autoscaling.Scale{
|
||||
// TODO: Create a variant of ObjectMeta type that only contains the fields below.
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: ss.Name,
|
||||
|
@ -207,12 +212,12 @@ func scaleFromStatefulSet(ss *apps.StatefulSet) (*extensions.Scale, error) {
|
|||
ResourceVersion: ss.ResourceVersion,
|
||||
CreationTimestamp: ss.CreationTimestamp,
|
||||
},
|
||||
Spec: extensions.ScaleSpec{
|
||||
Spec: autoscaling.ScaleSpec{
|
||||
Replicas: ss.Spec.Replicas,
|
||||
},
|
||||
Status: extensions.ScaleStatus{
|
||||
Status: autoscaling.ScaleStatus{
|
||||
Replicas: ss.Status.Replicas,
|
||||
Selector: ss.Spec.Selector,
|
||||
Selector: selector.String(),
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
|
|
@ -30,8 +30,8 @@ import (
|
|||
"k8s.io/apiserver/pkg/registry/rest"
|
||||
etcdtesting "k8s.io/apiserver/pkg/storage/etcd/testing"
|
||||
"k8s.io/kubernetes/pkg/apis/apps"
|
||||
"k8s.io/kubernetes/pkg/apis/autoscaling"
|
||||
api "k8s.io/kubernetes/pkg/apis/core"
|
||||
"k8s.io/kubernetes/pkg/apis/extensions"
|
||||
"k8s.io/kubernetes/pkg/registry/registrytest"
|
||||
)
|
||||
|
||||
|
@ -224,7 +224,11 @@ func TestScaleGet(t *testing.T) {
|
|||
t.Fatalf("error setting new statefulset (key: %s) %v: %v", key, validStatefulSet, err)
|
||||
}
|
||||
|
||||
want := &extensions.Scale{
|
||||
selector, err := metav1.LabelSelectorAsSelector(validStatefulSet.Spec.Selector)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
want := &autoscaling.Scale{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: name,
|
||||
Namespace: metav1.NamespaceDefault,
|
||||
|
@ -232,16 +236,16 @@ func TestScaleGet(t *testing.T) {
|
|||
ResourceVersion: sts.ResourceVersion,
|
||||
CreationTimestamp: sts.CreationTimestamp,
|
||||
},
|
||||
Spec: extensions.ScaleSpec{
|
||||
Spec: autoscaling.ScaleSpec{
|
||||
Replicas: validStatefulSet.Spec.Replicas,
|
||||
},
|
||||
Status: extensions.ScaleStatus{
|
||||
Status: autoscaling.ScaleStatus{
|
||||
Replicas: validStatefulSet.Status.Replicas,
|
||||
Selector: validStatefulSet.Spec.Selector,
|
||||
Selector: selector.String(),
|
||||
},
|
||||
}
|
||||
obj, err := storage.Scale.Get(ctx, name, &metav1.GetOptions{})
|
||||
got := obj.(*extensions.Scale)
|
||||
got := obj.(*autoscaling.Scale)
|
||||
if err != nil {
|
||||
t.Fatalf("error fetching scale for %s: %v", name, err)
|
||||
}
|
||||
|
@ -264,12 +268,12 @@ func TestScaleUpdate(t *testing.T) {
|
|||
t.Fatalf("error setting new statefulset (key: %s) %v: %v", key, validStatefulSet, err)
|
||||
}
|
||||
replicas := 12
|
||||
update := extensions.Scale{
|
||||
update := autoscaling.Scale{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: name,
|
||||
Namespace: metav1.NamespaceDefault,
|
||||
},
|
||||
Spec: extensions.ScaleSpec{
|
||||
Spec: autoscaling.ScaleSpec{
|
||||
Replicas: int32(replicas),
|
||||
},
|
||||
}
|
||||
|
@ -282,7 +286,7 @@ func TestScaleUpdate(t *testing.T) {
|
|||
if err != nil {
|
||||
t.Fatalf("error fetching scale for %s: %v", name, err)
|
||||
}
|
||||
scale := obj.(*extensions.Scale)
|
||||
scale := obj.(*autoscaling.Scale)
|
||||
if scale.Spec.Replicas != int32(replicas) {
|
||||
t.Errorf("wrong replicas count expected: %d got: %d", replicas, scale.Spec.Replicas)
|
||||
}
|
||||
|
|
|
@ -12,8 +12,8 @@ go_test(
|
|||
importpath = "k8s.io/kubernetes/pkg/registry/extensions/controller/storage",
|
||||
library = ":go_default_library",
|
||||
deps = [
|
||||
"//pkg/apis/autoscaling:go_default_library",
|
||||
"//pkg/apis/core:go_default_library",
|
||||
"//pkg/apis/extensions:go_default_library",
|
||||
"//pkg/registry/registrytest:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||
"//vendor/k8s.io/apiserver/pkg/endpoints/request:go_default_library",
|
||||
|
@ -30,13 +30,15 @@ go_library(
|
|||
srcs = ["storage.go"],
|
||||
importpath = "k8s.io/kubernetes/pkg/registry/extensions/controller/storage",
|
||||
deps = [
|
||||
"//pkg/apis/autoscaling:go_default_library",
|
||||
"//pkg/apis/autoscaling/validation:go_default_library",
|
||||
"//pkg/apis/core:go_default_library",
|
||||
"//pkg/apis/extensions:go_default_library",
|
||||
"//pkg/apis/extensions/validation:go_default_library",
|
||||
"//pkg/registry/core/replicationcontroller:go_default_library",
|
||||
"//pkg/registry/core/replicationcontroller/storage:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/api/errors:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/labels:go_default_library",
|
||||
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||
"//vendor/k8s.io/apiserver/pkg/endpoints/request:go_default_library",
|
||||
"//vendor/k8s.io/apiserver/pkg/registry/generic:go_default_library",
|
||||
|
|
|
@ -21,13 +21,15 @@ import (
|
|||
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
genericapirequest "k8s.io/apiserver/pkg/endpoints/request"
|
||||
"k8s.io/apiserver/pkg/registry/generic"
|
||||
"k8s.io/apiserver/pkg/registry/rest"
|
||||
"k8s.io/kubernetes/pkg/apis/autoscaling"
|
||||
autoscalingvalidation "k8s.io/kubernetes/pkg/apis/autoscaling/validation"
|
||||
api "k8s.io/kubernetes/pkg/apis/core"
|
||||
"k8s.io/kubernetes/pkg/apis/extensions"
|
||||
extvalidation "k8s.io/kubernetes/pkg/apis/extensions/validation"
|
||||
"k8s.io/kubernetes/pkg/registry/core/replicationcontroller"
|
||||
controllerstore "k8s.io/kubernetes/pkg/registry/core/replicationcontroller/storage"
|
||||
)
|
||||
|
@ -58,7 +60,7 @@ var _ = rest.Patcher(&ScaleREST{})
|
|||
|
||||
// New creates a new Scale object
|
||||
func (r *ScaleREST) New() runtime.Object {
|
||||
return &extensions.Scale{}
|
||||
return &autoscaling.Scale{}
|
||||
}
|
||||
|
||||
func (r *ScaleREST) Get(ctx genericapirequest.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
||||
|
@ -81,12 +83,12 @@ func (r *ScaleREST) Update(ctx genericapirequest.Context, name string, objInfo r
|
|||
if obj == nil {
|
||||
return nil, false, errors.NewBadRequest(fmt.Sprintf("nil update passed to Scale"))
|
||||
}
|
||||
scale, ok := obj.(*extensions.Scale)
|
||||
scale, ok := obj.(*autoscaling.Scale)
|
||||
if !ok {
|
||||
return nil, false, errors.NewBadRequest(fmt.Sprintf("wrong object passed to Scale update: %v", obj))
|
||||
}
|
||||
|
||||
if errs := extvalidation.ValidateScale(scale); len(errs) > 0 {
|
||||
if errs := autoscalingvalidation.ValidateScale(scale); len(errs) > 0 {
|
||||
return nil, false, errors.NewInvalid(extensions.Kind("Scale"), scale.Name, errs)
|
||||
}
|
||||
|
||||
|
@ -100,8 +102,8 @@ func (r *ScaleREST) Update(ctx genericapirequest.Context, name string, objInfo r
|
|||
}
|
||||
|
||||
// scaleFromRC returns a scale subresource for a replication controller.
|
||||
func scaleFromRC(rc *api.ReplicationController) *extensions.Scale {
|
||||
return &extensions.Scale{
|
||||
func scaleFromRC(rc *api.ReplicationController) *autoscaling.Scale {
|
||||
return &autoscaling.Scale{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: rc.Name,
|
||||
Namespace: rc.Namespace,
|
||||
|
@ -109,14 +111,12 @@ func scaleFromRC(rc *api.ReplicationController) *extensions.Scale {
|
|||
ResourceVersion: rc.ResourceVersion,
|
||||
CreationTimestamp: rc.CreationTimestamp,
|
||||
},
|
||||
Spec: extensions.ScaleSpec{
|
||||
Spec: autoscaling.ScaleSpec{
|
||||
Replicas: rc.Spec.Replicas,
|
||||
},
|
||||
Status: extensions.ScaleStatus{
|
||||
Status: autoscaling.ScaleStatus{
|
||||
Replicas: rc.Status.Replicas,
|
||||
Selector: &metav1.LabelSelector{
|
||||
MatchLabels: rc.Spec.Selector,
|
||||
},
|
||||
Selector: labels.SelectorFromSet(labels.Set(rc.Spec.Selector)).String(),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,8 +26,8 @@ import (
|
|||
"k8s.io/apiserver/pkg/storage"
|
||||
etcdtesting "k8s.io/apiserver/pkg/storage/etcd/testing"
|
||||
"k8s.io/apiserver/pkg/storage/storagebackend/factory"
|
||||
"k8s.io/kubernetes/pkg/apis/autoscaling"
|
||||
api "k8s.io/kubernetes/pkg/apis/core"
|
||||
"k8s.io/kubernetes/pkg/apis/extensions"
|
||||
"k8s.io/kubernetes/pkg/registry/registrytest"
|
||||
)
|
||||
|
||||
|
@ -74,16 +74,14 @@ var validController = api.ReplicationController{
|
|||
Spec: validControllerSpec,
|
||||
}
|
||||
|
||||
var validScale = extensions.Scale{
|
||||
var validScale = autoscaling.Scale{
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "foo", Namespace: "test"},
|
||||
Spec: extensions.ScaleSpec{
|
||||
Spec: autoscaling.ScaleSpec{
|
||||
Replicas: validReplicas,
|
||||
},
|
||||
Status: extensions.ScaleStatus{
|
||||
Status: autoscaling.ScaleStatus{
|
||||
Replicas: 0,
|
||||
Selector: &metav1.LabelSelector{
|
||||
MatchLabels: validPodTemplate.Template.Labels,
|
||||
},
|
||||
Selector: "a=b",
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -100,7 +98,7 @@ func TestGet(t *testing.T) {
|
|||
if err != nil {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
scale := obj.(*extensions.Scale)
|
||||
scale := obj.(*autoscaling.Scale)
|
||||
if scale.Spec.Replicas != validReplicas {
|
||||
t.Errorf("wrong replicas count expected: %d got: %d", validReplicas, scale.Spec.Replicas)
|
||||
}
|
||||
|
@ -116,9 +114,9 @@ func TestUpdate(t *testing.T) {
|
|||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
replicas := int32(12)
|
||||
update := extensions.Scale{
|
||||
update := autoscaling.Scale{
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "foo", Namespace: "test"},
|
||||
Spec: extensions.ScaleSpec{
|
||||
Spec: autoscaling.ScaleSpec{
|
||||
Replicas: replicas,
|
||||
},
|
||||
}
|
||||
|
@ -131,7 +129,7 @@ func TestUpdate(t *testing.T) {
|
|||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
|
||||
updated := obj.(*extensions.Scale)
|
||||
updated := obj.(*autoscaling.Scale)
|
||||
if updated.Spec.Replicas != replicas {
|
||||
t.Errorf("wrong replicas count expected: %d got: %d", replicas, updated.Spec.Replicas)
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ go_test(
|
|||
importpath = "k8s.io/kubernetes/pkg/registry/extensions/deployment/storage",
|
||||
library = ":go_default_library",
|
||||
deps = [
|
||||
"//pkg/apis/autoscaling:go_default_library",
|
||||
"//pkg/apis/core:go_default_library",
|
||||
"//pkg/apis/extensions:go_default_library",
|
||||
"//pkg/registry/registrytest:go_default_library",
|
||||
|
@ -38,7 +39,9 @@ go_library(
|
|||
deps = [
|
||||
"//pkg/apis/apps/v1beta1:go_default_library",
|
||||
"//pkg/apis/apps/v1beta2:go_default_library",
|
||||
"//pkg/apis/autoscaling:go_default_library",
|
||||
"//pkg/apis/autoscaling/v1:go_default_library",
|
||||
"//pkg/apis/autoscaling/validation:go_default_library",
|
||||
"//pkg/apis/extensions:go_default_library",
|
||||
"//pkg/apis/extensions/v1beta1:go_default_library",
|
||||
"//pkg/apis/extensions/validation:go_default_library",
|
||||
|
|
|
@ -32,7 +32,9 @@ import (
|
|||
storeerr "k8s.io/apiserver/pkg/storage/errors"
|
||||
appsv1beta1 "k8s.io/kubernetes/pkg/apis/apps/v1beta1"
|
||||
appsv1beta2 "k8s.io/kubernetes/pkg/apis/apps/v1beta2"
|
||||
"k8s.io/kubernetes/pkg/apis/autoscaling"
|
||||
autoscalingv1 "k8s.io/kubernetes/pkg/apis/autoscaling/v1"
|
||||
autoscalingvalidation "k8s.io/kubernetes/pkg/apis/autoscaling/validation"
|
||||
"k8s.io/kubernetes/pkg/apis/extensions"
|
||||
extensionsv1beta1 "k8s.io/kubernetes/pkg/apis/extensions/v1beta1"
|
||||
extvalidation "k8s.io/kubernetes/pkg/apis/extensions/validation"
|
||||
|
@ -212,7 +214,7 @@ func (r *ScaleREST) GroupVersionKind(containingGV schema.GroupVersion) schema.Gr
|
|||
|
||||
// New creates a new Scale object
|
||||
func (r *ScaleREST) New() runtime.Object {
|
||||
return &extensions.Scale{}
|
||||
return &autoscaling.Scale{}
|
||||
}
|
||||
|
||||
func (r *ScaleREST) Get(ctx genericapirequest.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
||||
|
@ -245,12 +247,12 @@ func (r *ScaleREST) Update(ctx genericapirequest.Context, name string, objInfo r
|
|||
if obj == nil {
|
||||
return nil, false, errors.NewBadRequest(fmt.Sprintf("nil update passed to Scale"))
|
||||
}
|
||||
scale, ok := obj.(*extensions.Scale)
|
||||
scale, ok := obj.(*autoscaling.Scale)
|
||||
if !ok {
|
||||
return nil, false, errors.NewBadRequest(fmt.Sprintf("expected input object type to be Scale, but %T", obj))
|
||||
}
|
||||
|
||||
if errs := extvalidation.ValidateScale(scale); len(errs) > 0 {
|
||||
if errs := autoscalingvalidation.ValidateScale(scale); len(errs) > 0 {
|
||||
return nil, false, errors.NewInvalid(extensions.Kind("Scale"), name, errs)
|
||||
}
|
||||
|
||||
|
@ -268,8 +270,12 @@ func (r *ScaleREST) Update(ctx genericapirequest.Context, name string, objInfo r
|
|||
}
|
||||
|
||||
// scaleFromDeployment returns a scale subresource for a deployment.
|
||||
func scaleFromDeployment(deployment *extensions.Deployment) (*extensions.Scale, error) {
|
||||
return &extensions.Scale{
|
||||
func scaleFromDeployment(deployment *extensions.Deployment) (*autoscaling.Scale, error) {
|
||||
selector, err := metav1.LabelSelectorAsSelector(deployment.Spec.Selector)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &autoscaling.Scale{
|
||||
// TODO: Create a variant of ObjectMeta type that only contains the fields below.
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: deployment.Name,
|
||||
|
@ -278,12 +284,12 @@ func scaleFromDeployment(deployment *extensions.Deployment) (*extensions.Scale,
|
|||
ResourceVersion: deployment.ResourceVersion,
|
||||
CreationTimestamp: deployment.CreationTimestamp,
|
||||
},
|
||||
Spec: extensions.ScaleSpec{
|
||||
Spec: autoscaling.ScaleSpec{
|
||||
Replicas: deployment.Spec.Replicas,
|
||||
},
|
||||
Status: extensions.ScaleStatus{
|
||||
Status: autoscaling.ScaleStatus{
|
||||
Replicas: deployment.Status.Replicas,
|
||||
Selector: deployment.Spec.Selector,
|
||||
Selector: selector.String(),
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ import (
|
|||
"k8s.io/apiserver/pkg/registry/rest"
|
||||
storeerr "k8s.io/apiserver/pkg/storage/errors"
|
||||
etcdtesting "k8s.io/apiserver/pkg/storage/etcd/testing"
|
||||
"k8s.io/kubernetes/pkg/apis/autoscaling"
|
||||
api "k8s.io/kubernetes/pkg/apis/core"
|
||||
"k8s.io/kubernetes/pkg/apis/extensions"
|
||||
"k8s.io/kubernetes/pkg/registry/registrytest"
|
||||
|
@ -207,7 +208,11 @@ func TestScaleGet(t *testing.T) {
|
|||
t.Fatalf("error setting new deployment (key: %s) %v: %v", key, validDeployment, err)
|
||||
}
|
||||
|
||||
want := &extensions.Scale{
|
||||
selector, err := metav1.LabelSelectorAsSelector(validDeployment.Spec.Selector)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
want := &autoscaling.Scale{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: name,
|
||||
Namespace: namespace,
|
||||
|
@ -215,19 +220,19 @@ func TestScaleGet(t *testing.T) {
|
|||
ResourceVersion: deployment.ResourceVersion,
|
||||
CreationTimestamp: deployment.CreationTimestamp,
|
||||
},
|
||||
Spec: extensions.ScaleSpec{
|
||||
Spec: autoscaling.ScaleSpec{
|
||||
Replicas: validDeployment.Spec.Replicas,
|
||||
},
|
||||
Status: extensions.ScaleStatus{
|
||||
Status: autoscaling.ScaleStatus{
|
||||
Replicas: validDeployment.Status.Replicas,
|
||||
Selector: validDeployment.Spec.Selector,
|
||||
Selector: selector.String(),
|
||||
},
|
||||
}
|
||||
obj, err := storage.Scale.Get(ctx, name, &metav1.GetOptions{})
|
||||
if err != nil {
|
||||
t.Fatalf("error fetching scale for %s: %v", name, err)
|
||||
}
|
||||
got := obj.(*extensions.Scale)
|
||||
got := obj.(*autoscaling.Scale)
|
||||
if !apiequality.Semantic.DeepEqual(want, got) {
|
||||
t.Errorf("unexpected scale: %s", diff.ObjectDiff(want, got))
|
||||
}
|
||||
|
@ -244,9 +249,9 @@ func TestScaleUpdate(t *testing.T) {
|
|||
t.Fatalf("error setting new deployment (key: %s) %v: %v", key, validDeployment, err)
|
||||
}
|
||||
replicas := int32(12)
|
||||
update := extensions.Scale{
|
||||
update := autoscaling.Scale{
|
||||
ObjectMeta: metav1.ObjectMeta{Name: name, Namespace: namespace},
|
||||
Spec: extensions.ScaleSpec{
|
||||
Spec: autoscaling.ScaleSpec{
|
||||
Replicas: replicas,
|
||||
},
|
||||
}
|
||||
|
@ -258,7 +263,7 @@ func TestScaleUpdate(t *testing.T) {
|
|||
if err != nil {
|
||||
t.Fatalf("error fetching scale for %s: %v", name, err)
|
||||
}
|
||||
scale := obj.(*extensions.Scale)
|
||||
scale := obj.(*autoscaling.Scale)
|
||||
if scale.Spec.Replicas != replicas {
|
||||
t.Errorf("wrong replicas count expected: %d got: %d", replicas, deployment.Spec.Replicas)
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ go_test(
|
|||
importpath = "k8s.io/kubernetes/pkg/registry/extensions/replicaset/storage",
|
||||
library = ":go_default_library",
|
||||
deps = [
|
||||
"//pkg/apis/autoscaling:go_default_library",
|
||||
"//pkg/apis/core:go_default_library",
|
||||
"//pkg/apis/extensions:go_default_library",
|
||||
"//pkg/registry/registrytest:go_default_library",
|
||||
|
@ -36,10 +37,11 @@ go_library(
|
|||
deps = [
|
||||
"//pkg/apis/apps/v1beta1:go_default_library",
|
||||
"//pkg/apis/apps/v1beta2:go_default_library",
|
||||
"//pkg/apis/autoscaling:go_default_library",
|
||||
"//pkg/apis/autoscaling/v1:go_default_library",
|
||||
"//pkg/apis/autoscaling/validation:go_default_library",
|
||||
"//pkg/apis/extensions:go_default_library",
|
||||
"//pkg/apis/extensions/v1beta1:go_default_library",
|
||||
"//pkg/apis/extensions/validation:go_default_library",
|
||||
"//pkg/printers:go_default_library",
|
||||
"//pkg/printers/internalversion:go_default_library",
|
||||
"//pkg/printers/storage:go_default_library",
|
||||
|
|
|
@ -31,10 +31,11 @@ import (
|
|||
"k8s.io/apiserver/pkg/registry/rest"
|
||||
appsv1beta1 "k8s.io/kubernetes/pkg/apis/apps/v1beta1"
|
||||
appsv1beta2 "k8s.io/kubernetes/pkg/apis/apps/v1beta2"
|
||||
"k8s.io/kubernetes/pkg/apis/autoscaling"
|
||||
autoscalingv1 "k8s.io/kubernetes/pkg/apis/autoscaling/v1"
|
||||
autoscalingvalidation "k8s.io/kubernetes/pkg/apis/autoscaling/validation"
|
||||
"k8s.io/kubernetes/pkg/apis/extensions"
|
||||
extensionsv1beta1 "k8s.io/kubernetes/pkg/apis/extensions/v1beta1"
|
||||
extvalidation "k8s.io/kubernetes/pkg/apis/extensions/validation"
|
||||
"k8s.io/kubernetes/pkg/printers"
|
||||
printersinternal "k8s.io/kubernetes/pkg/printers/internalversion"
|
||||
printerstorage "k8s.io/kubernetes/pkg/printers/storage"
|
||||
|
@ -146,7 +147,7 @@ func (r *ScaleREST) GroupVersionKind(containingGV schema.GroupVersion) schema.Gr
|
|||
|
||||
// New creates a new Scale object
|
||||
func (r *ScaleREST) New() runtime.Object {
|
||||
return &extensions.Scale{}
|
||||
return &autoscaling.Scale{}
|
||||
}
|
||||
|
||||
func (r *ScaleREST) Get(ctx genericapirequest.Context, name string, options *metav1.GetOptions) (runtime.Object, error) {
|
||||
|
@ -180,12 +181,12 @@ func (r *ScaleREST) Update(ctx genericapirequest.Context, name string, objInfo r
|
|||
if obj == nil {
|
||||
return nil, false, errors.NewBadRequest(fmt.Sprintf("nil update passed to Scale"))
|
||||
}
|
||||
scale, ok := obj.(*extensions.Scale)
|
||||
scale, ok := obj.(*autoscaling.Scale)
|
||||
if !ok {
|
||||
return nil, false, errors.NewBadRequest(fmt.Sprintf("wrong object passed to Scale update: %v", obj))
|
||||
}
|
||||
|
||||
if errs := extvalidation.ValidateScale(scale); len(errs) > 0 {
|
||||
if errs := autoscalingvalidation.ValidateScale(scale); len(errs) > 0 {
|
||||
return nil, false, errors.NewInvalid(extensions.Kind("Scale"), scale.Name, errs)
|
||||
}
|
||||
|
||||
|
@ -203,8 +204,12 @@ func (r *ScaleREST) Update(ctx genericapirequest.Context, name string, objInfo r
|
|||
}
|
||||
|
||||
// scaleFromReplicaSet returns a scale subresource for a replica set.
|
||||
func scaleFromReplicaSet(rs *extensions.ReplicaSet) (*extensions.Scale, error) {
|
||||
return &extensions.Scale{
|
||||
func scaleFromReplicaSet(rs *extensions.ReplicaSet) (*autoscaling.Scale, error) {
|
||||
selector, err := metav1.LabelSelectorAsSelector(rs.Spec.Selector)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &autoscaling.Scale{
|
||||
// TODO: Create a variant of ObjectMeta type that only contains the fields below.
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: rs.Name,
|
||||
|
@ -213,12 +218,12 @@ func scaleFromReplicaSet(rs *extensions.ReplicaSet) (*extensions.Scale, error) {
|
|||
ResourceVersion: rs.ResourceVersion,
|
||||
CreationTimestamp: rs.CreationTimestamp,
|
||||
},
|
||||
Spec: extensions.ScaleSpec{
|
||||
Spec: autoscaling.ScaleSpec{
|
||||
Replicas: rs.Spec.Replicas,
|
||||
},
|
||||
Status: extensions.ScaleStatus{
|
||||
Status: autoscaling.ScaleStatus{
|
||||
Replicas: rs.Status.Replicas,
|
||||
Selector: rs.Spec.Selector,
|
||||
Selector: selector.String(),
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ import (
|
|||
"k8s.io/apiserver/pkg/registry/generic"
|
||||
"k8s.io/apiserver/pkg/registry/rest"
|
||||
etcdtesting "k8s.io/apiserver/pkg/storage/etcd/testing"
|
||||
"k8s.io/kubernetes/pkg/apis/autoscaling"
|
||||
api "k8s.io/kubernetes/pkg/apis/core"
|
||||
"k8s.io/kubernetes/pkg/apis/extensions"
|
||||
"k8s.io/kubernetes/pkg/registry/registrytest"
|
||||
|
@ -261,7 +262,12 @@ func TestScaleGet(t *testing.T) {
|
|||
t.Fatalf("error setting new replica set (key: %s) %v: %v", key, validReplicaSet, err)
|
||||
}
|
||||
|
||||
want := &extensions.Scale{
|
||||
selector, err := metav1.LabelSelectorAsSelector(validReplicaSet.Spec.Selector)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
want := &autoscaling.Scale{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: name,
|
||||
Namespace: metav1.NamespaceDefault,
|
||||
|
@ -269,16 +275,16 @@ func TestScaleGet(t *testing.T) {
|
|||
ResourceVersion: rs.ResourceVersion,
|
||||
CreationTimestamp: rs.CreationTimestamp,
|
||||
},
|
||||
Spec: extensions.ScaleSpec{
|
||||
Spec: autoscaling.ScaleSpec{
|
||||
Replicas: validReplicaSet.Spec.Replicas,
|
||||
},
|
||||
Status: extensions.ScaleStatus{
|
||||
Status: autoscaling.ScaleStatus{
|
||||
Replicas: validReplicaSet.Status.Replicas,
|
||||
Selector: validReplicaSet.Spec.Selector,
|
||||
Selector: selector.String(),
|
||||
},
|
||||
}
|
||||
obj, err := storage.Scale.Get(ctx, name, &metav1.GetOptions{})
|
||||
got := obj.(*extensions.Scale)
|
||||
got := obj.(*autoscaling.Scale)
|
||||
if err != nil {
|
||||
t.Fatalf("error fetching scale for %s: %v", name, err)
|
||||
}
|
||||
|
@ -301,12 +307,12 @@ func TestScaleUpdate(t *testing.T) {
|
|||
t.Fatalf("error setting new replica set (key: %s) %v: %v", key, validReplicaSet, err)
|
||||
}
|
||||
replicas := 12
|
||||
update := extensions.Scale{
|
||||
update := autoscaling.Scale{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: name,
|
||||
Namespace: metav1.NamespaceDefault,
|
||||
},
|
||||
Spec: extensions.ScaleSpec{
|
||||
Spec: autoscaling.ScaleSpec{
|
||||
Replicas: int32(replicas),
|
||||
},
|
||||
}
|
||||
|
@ -319,7 +325,7 @@ func TestScaleUpdate(t *testing.T) {
|
|||
if err != nil {
|
||||
t.Fatalf("error fetching scale for %s: %v", name, err)
|
||||
}
|
||||
scale := obj.(*extensions.Scale)
|
||||
scale := obj.(*autoscaling.Scale)
|
||||
if scale.Spec.Replicas != int32(replicas) {
|
||||
t.Errorf("wrong replicas count expected: %d got: %d", replicas, scale.Spec.Replicas)
|
||||
}
|
||||
|
|
|
@ -68,9 +68,9 @@ func TestScaleSubresources(t *testing.T) {
|
|||
makeGVR("apps", "v1beta2", "replicasets/scale"): makeGVK("apps", "v1beta2", "Scale"),
|
||||
makeGVR("apps", "v1beta2", "statefulsets/scale"): makeGVK("apps", "v1beta2", "Scale"),
|
||||
|
||||
// makeGVR("apps", "v1", "deployments/scale"): makeGVK("autoscaling", "v1", "Scale"),
|
||||
// makeGVR("apps", "v1", "replicasets/scale"): makeGVK("autoscaling", "v1", "Scale"),
|
||||
// makeGVR("apps", "v1", "statefulsets/scale"): makeGVK("autoscaling", "v1", "Scale"),
|
||||
makeGVR("apps", "v1", "deployments/scale"): makeGVK("autoscaling", "v1", "Scale"),
|
||||
makeGVR("apps", "v1", "replicasets/scale"): makeGVK("autoscaling", "v1", "Scale"),
|
||||
makeGVR("apps", "v1", "statefulsets/scale"): makeGVK("autoscaling", "v1", "Scale"),
|
||||
}
|
||||
|
||||
autoscalingGVK := schema.GroupVersionKind{Group: "autoscaling", Version: "v1", Kind: "Scale"}
|
||||
|
|
Loading…
Reference in New Issue