diff --git a/api/openapi-spec/swagger.json b/api/openapi-spec/swagger.json index f6ba791bbfb4..d7e393869fcc 100644 --- a/api/openapi-spec/swagger.json +++ b/api/openapi-spec/swagger.json @@ -3285,6 +3285,852 @@ } ] }, + "/apis/command.karmada.io/": { + "get": { + "description": "get information of a group", + "consumes": [ + "application/json", + "application/yaml", + "application/vnd.kubernetes.protobuf" + ], + "produces": [ + "application/json", + "application/yaml", + "application/vnd.kubernetes.protobuf" + ], + "schemes": [ + "https" + ], + "tags": [ + "commandKarmadaIo" + ], + "operationId": "getCommandKarmadaIoAPIGroup", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.APIGroup" + } + } + } + } + }, + "/apis/command.karmada.io/v1alpha1/": { + "get": { + "description": "get available resources", + "consumes": [ + "application/json", + "application/yaml", + "application/vnd.kubernetes.protobuf" + ], + "produces": [ + "application/json", + "application/yaml", + "application/vnd.kubernetes.protobuf" + ], + "schemes": [ + "https" + ], + "tags": [ + "commandKarmadaIo_v1alpha1" + ], + "operationId": "getCommandKarmadaIoV1alpha1APIResources", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.APIResourceList" + } + } + } + } + }, + "/apis/command.karmada.io/v1alpha1/reschedules": { + "get": { + "description": "list or watch objects of kind Reschedule", + "consumes": [ + "*/*" + ], + "produces": [ + "application/json", + "application/yaml", + "application/vnd.kubernetes.protobuf", + "application/json;stream=watch", + "application/vnd.kubernetes.protobuf;stream=watch" + ], + "schemes": [ + "https" + ], + "tags": [ + "commandKarmadaIo_v1alpha1" + ], + "operationId": "listCommandKarmadaIoV1alpha1Reschedule", + "parameters": [ + { + "$ref": "#/parameters/allowWatchBookmarks-HC2hJt-J" + }, + { + "$ref": "#/parameters/continue-QfD61s0i" + }, + { + "$ref": "#/parameters/fieldSelector-xIcQKXFG" + }, + { + "$ref": "#/parameters/labelSelector-5Zw57w4C" + }, + { + "$ref": "#/parameters/limit-1NfNmdNH" + }, + { + "$ref": "#/parameters/resourceVersion-5WAnf1kx" + }, + { + "$ref": "#/parameters/resourceVersionMatch-t8XhRHeC" + }, + { + "$ref": "#/parameters/sendInitialEvents-rLXlEK_k" + }, + { + "$ref": "#/parameters/timeoutSeconds-yvYezaOC" + }, + { + "$ref": "#/parameters/watch-XNNPZGbK" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.command.v1alpha1.RescheduleList" + } + } + }, + "x-kubernetes-action": "list", + "x-kubernetes-group-version-kind": { + "group": "command.karmada.io", + "version": "v1alpha1", + "kind": "Reschedule" + } + }, + "post": { + "description": "create a Reschedule", + "consumes": [ + "*/*" + ], + "produces": [ + "application/json", + "application/yaml", + "application/vnd.kubernetes.protobuf" + ], + "schemes": [ + "https" + ], + "tags": [ + "commandKarmadaIo_v1alpha1" + ], + "operationId": "createCommandKarmadaIoV1alpha1Reschedule", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.command.v1alpha1.Reschedule" + } + }, + { + "uniqueItems": true, + "type": "string", + "description": "When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed", + "name": "dryRun", + "in": "query" + }, + { + "$ref": "#/parameters/fieldManager-Qy4HdaTW" + }, + { + "uniqueItems": true, + "type": "string", + "description": "fieldValidation instructs the server on how to handle objects in the request (POST/PUT/PATCH) containing unknown or duplicate fields. Valid values are: - Ignore: This will ignore any unknown fields that are silently dropped from the object, and will ignore all but the last duplicate field that the decoder encounters. This is the default behavior prior to v1.23. - Warn: This will send a warning via the standard warning response header for each unknown field that is dropped from the object, and for each duplicate field that is encountered. The request will still succeed if there are no other errors, and will only persist the last of any duplicate fields. This is the default in v1.23+ - Strict: This will fail the request with a BadRequest error if any unknown fields would be dropped from the object, or if any duplicate fields are present. The error returned from the server will contain all unknown and duplicate fields encountered.", + "name": "fieldValidation", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.command.v1alpha1.Reschedule" + } + }, + "201": { + "description": "Created", + "schema": { + "$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.command.v1alpha1.Reschedule" + } + }, + "202": { + "description": "Accepted", + "schema": { + "$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.command.v1alpha1.Reschedule" + } + } + }, + "x-kubernetes-action": "post", + "x-kubernetes-group-version-kind": { + "group": "command.karmada.io", + "version": "v1alpha1", + "kind": "Reschedule" + } + }, + "delete": { + "description": "delete collection of Reschedule", + "consumes": [ + "*/*" + ], + "produces": [ + "application/json", + "application/yaml", + "application/vnd.kubernetes.protobuf" + ], + "schemes": [ + "https" + ], + "tags": [ + "commandKarmadaIo_v1alpha1" + ], + "operationId": "deleteCommandKarmadaIoV1alpha1CollectionReschedule", + "parameters": [ + { + "$ref": "#/parameters/body-2Y1dVQaQ" + }, + { + "$ref": "#/parameters/continue-QfD61s0i" + }, + { + "uniqueItems": true, + "type": "string", + "description": "When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed", + "name": "dryRun", + "in": "query" + }, + { + "$ref": "#/parameters/fieldSelector-xIcQKXFG" + }, + { + "$ref": "#/parameters/gracePeriodSeconds--K5HaBOS" + }, + { + "$ref": "#/parameters/labelSelector-5Zw57w4C" + }, + { + "$ref": "#/parameters/limit-1NfNmdNH" + }, + { + "$ref": "#/parameters/orphanDependents-uRB25kX5" + }, + { + "$ref": "#/parameters/propagationPolicy-6jk3prlO" + }, + { + "$ref": "#/parameters/resourceVersion-5WAnf1kx" + }, + { + "$ref": "#/parameters/resourceVersionMatch-t8XhRHeC" + }, + { + "$ref": "#/parameters/sendInitialEvents-rLXlEK_k" + }, + { + "$ref": "#/parameters/timeoutSeconds-yvYezaOC" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.Status" + } + } + }, + "x-kubernetes-action": "deletecollection", + "x-kubernetes-group-version-kind": { + "group": "command.karmada.io", + "version": "v1alpha1", + "kind": "Reschedule" + } + }, + "parameters": [ + { + "$ref": "#/parameters/pretty-nN7o5FEq" + } + ] + }, + "/apis/command.karmada.io/v1alpha1/reschedules/{name}": { + "get": { + "description": "read the specified Reschedule", + "consumes": [ + "*/*" + ], + "produces": [ + "application/json", + "application/yaml", + "application/vnd.kubernetes.protobuf" + ], + "schemes": [ + "https" + ], + "tags": [ + "commandKarmadaIo_v1alpha1" + ], + "operationId": "readCommandKarmadaIoV1alpha1Reschedule", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.command.v1alpha1.Reschedule" + } + } + }, + "x-kubernetes-action": "get", + "x-kubernetes-group-version-kind": { + "group": "command.karmada.io", + "version": "v1alpha1", + "kind": "Reschedule" + } + }, + "put": { + "description": "replace the specified Reschedule", + "consumes": [ + "*/*" + ], + "produces": [ + "application/json", + "application/yaml", + "application/vnd.kubernetes.protobuf" + ], + "schemes": [ + "https" + ], + "tags": [ + "commandKarmadaIo_v1alpha1" + ], + "operationId": "replaceCommandKarmadaIoV1alpha1Reschedule", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.command.v1alpha1.Reschedule" + } + }, + { + "uniqueItems": true, + "type": "string", + "description": "When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed", + "name": "dryRun", + "in": "query" + }, + { + "$ref": "#/parameters/fieldManager-Qy4HdaTW" + }, + { + "uniqueItems": true, + "type": "string", + "description": "fieldValidation instructs the server on how to handle objects in the request (POST/PUT/PATCH) containing unknown or duplicate fields. Valid values are: - Ignore: This will ignore any unknown fields that are silently dropped from the object, and will ignore all but the last duplicate field that the decoder encounters. This is the default behavior prior to v1.23. - Warn: This will send a warning via the standard warning response header for each unknown field that is dropped from the object, and for each duplicate field that is encountered. The request will still succeed if there are no other errors, and will only persist the last of any duplicate fields. This is the default in v1.23+ - Strict: This will fail the request with a BadRequest error if any unknown fields would be dropped from the object, or if any duplicate fields are present. The error returned from the server will contain all unknown and duplicate fields encountered.", + "name": "fieldValidation", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.command.v1alpha1.Reschedule" + } + }, + "201": { + "description": "Created", + "schema": { + "$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.command.v1alpha1.Reschedule" + } + } + }, + "x-kubernetes-action": "put", + "x-kubernetes-group-version-kind": { + "group": "command.karmada.io", + "version": "v1alpha1", + "kind": "Reschedule" + } + }, + "delete": { + "description": "delete a Reschedule", + "consumes": [ + "*/*" + ], + "produces": [ + "application/json", + "application/yaml", + "application/vnd.kubernetes.protobuf" + ], + "schemes": [ + "https" + ], + "tags": [ + "commandKarmadaIo_v1alpha1" + ], + "operationId": "deleteCommandKarmadaIoV1alpha1Reschedule", + "parameters": [ + { + "$ref": "#/parameters/body-2Y1dVQaQ" + }, + { + "uniqueItems": true, + "type": "string", + "description": "When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed", + "name": "dryRun", + "in": "query" + }, + { + "$ref": "#/parameters/gracePeriodSeconds--K5HaBOS" + }, + { + "$ref": "#/parameters/orphanDependents-uRB25kX5" + }, + { + "$ref": "#/parameters/propagationPolicy-6jk3prlO" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.Status" + } + }, + "202": { + "description": "Accepted", + "schema": { + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.Status" + } + } + }, + "x-kubernetes-action": "delete", + "x-kubernetes-group-version-kind": { + "group": "command.karmada.io", + "version": "v1alpha1", + "kind": "Reschedule" + } + }, + "patch": { + "description": "partially update the specified Reschedule", + "consumes": [ + "application/json-patch+json", + "application/merge-patch+json", + "application/strategic-merge-patch+json", + "application/apply-patch+yaml" + ], + "produces": [ + "application/json", + "application/yaml", + "application/vnd.kubernetes.protobuf" + ], + "schemes": [ + "https" + ], + "tags": [ + "commandKarmadaIo_v1alpha1" + ], + "operationId": "patchCommandKarmadaIoV1alpha1Reschedule", + "parameters": [ + { + "$ref": "#/parameters/body-78PwaGsr" + }, + { + "uniqueItems": true, + "type": "string", + "description": "When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed", + "name": "dryRun", + "in": "query" + }, + { + "$ref": "#/parameters/fieldManager-7c6nTn1T" + }, + { + "uniqueItems": true, + "type": "string", + "description": "fieldValidation instructs the server on how to handle objects in the request (POST/PUT/PATCH) containing unknown or duplicate fields. Valid values are: - Ignore: This will ignore any unknown fields that are silently dropped from the object, and will ignore all but the last duplicate field that the decoder encounters. This is the default behavior prior to v1.23. - Warn: This will send a warning via the standard warning response header for each unknown field that is dropped from the object, and for each duplicate field that is encountered. The request will still succeed if there are no other errors, and will only persist the last of any duplicate fields. This is the default in v1.23+ - Strict: This will fail the request with a BadRequest error if any unknown fields would be dropped from the object, or if any duplicate fields are present. The error returned from the server will contain all unknown and duplicate fields encountered.", + "name": "fieldValidation", + "in": "query" + }, + { + "$ref": "#/parameters/force-tOGGb0Yi" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.command.v1alpha1.Reschedule" + } + }, + "201": { + "description": "Created", + "schema": { + "$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.command.v1alpha1.Reschedule" + } + } + }, + "x-kubernetes-action": "patch", + "x-kubernetes-group-version-kind": { + "group": "command.karmada.io", + "version": "v1alpha1", + "kind": "Reschedule" + } + }, + "parameters": [ + { + "uniqueItems": true, + "type": "string", + "description": "name of the Reschedule", + "name": "name", + "in": "path", + "required": true + }, + { + "$ref": "#/parameters/pretty-nN7o5FEq" + } + ] + }, + "/apis/command.karmada.io/v1alpha1/reschedules/{name}/status": { + "get": { + "description": "read status of the specified Reschedule", + "consumes": [ + "*/*" + ], + "produces": [ + "application/json", + "application/yaml", + "application/vnd.kubernetes.protobuf" + ], + "schemes": [ + "https" + ], + "tags": [ + "commandKarmadaIo_v1alpha1" + ], + "operationId": "readCommandKarmadaIoV1alpha1RescheduleStatus", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.command.v1alpha1.Reschedule" + } + } + }, + "x-kubernetes-action": "get", + "x-kubernetes-group-version-kind": { + "group": "command.karmada.io", + "version": "v1alpha1", + "kind": "Reschedule" + } + }, + "put": { + "description": "replace status of the specified Reschedule", + "consumes": [ + "*/*" + ], + "produces": [ + "application/json", + "application/yaml", + "application/vnd.kubernetes.protobuf" + ], + "schemes": [ + "https" + ], + "tags": [ + "commandKarmadaIo_v1alpha1" + ], + "operationId": "replaceCommandKarmadaIoV1alpha1RescheduleStatus", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.command.v1alpha1.Reschedule" + } + }, + { + "uniqueItems": true, + "type": "string", + "description": "When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed", + "name": "dryRun", + "in": "query" + }, + { + "$ref": "#/parameters/fieldManager-Qy4HdaTW" + }, + { + "uniqueItems": true, + "type": "string", + "description": "fieldValidation instructs the server on how to handle objects in the request (POST/PUT/PATCH) containing unknown or duplicate fields. Valid values are: - Ignore: This will ignore any unknown fields that are silently dropped from the object, and will ignore all but the last duplicate field that the decoder encounters. This is the default behavior prior to v1.23. - Warn: This will send a warning via the standard warning response header for each unknown field that is dropped from the object, and for each duplicate field that is encountered. The request will still succeed if there are no other errors, and will only persist the last of any duplicate fields. This is the default in v1.23+ - Strict: This will fail the request with a BadRequest error if any unknown fields would be dropped from the object, or if any duplicate fields are present. The error returned from the server will contain all unknown and duplicate fields encountered.", + "name": "fieldValidation", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.command.v1alpha1.Reschedule" + } + }, + "201": { + "description": "Created", + "schema": { + "$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.command.v1alpha1.Reschedule" + } + } + }, + "x-kubernetes-action": "put", + "x-kubernetes-group-version-kind": { + "group": "command.karmada.io", + "version": "v1alpha1", + "kind": "Reschedule" + } + }, + "patch": { + "description": "partially update status of the specified Reschedule", + "consumes": [ + "application/json-patch+json", + "application/merge-patch+json", + "application/strategic-merge-patch+json", + "application/apply-patch+yaml" + ], + "produces": [ + "application/json", + "application/yaml", + "application/vnd.kubernetes.protobuf" + ], + "schemes": [ + "https" + ], + "tags": [ + "commandKarmadaIo_v1alpha1" + ], + "operationId": "patchCommandKarmadaIoV1alpha1RescheduleStatus", + "parameters": [ + { + "$ref": "#/parameters/body-78PwaGsr" + }, + { + "uniqueItems": true, + "type": "string", + "description": "When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed", + "name": "dryRun", + "in": "query" + }, + { + "$ref": "#/parameters/fieldManager-7c6nTn1T" + }, + { + "uniqueItems": true, + "type": "string", + "description": "fieldValidation instructs the server on how to handle objects in the request (POST/PUT/PATCH) containing unknown or duplicate fields. Valid values are: - Ignore: This will ignore any unknown fields that are silently dropped from the object, and will ignore all but the last duplicate field that the decoder encounters. This is the default behavior prior to v1.23. - Warn: This will send a warning via the standard warning response header for each unknown field that is dropped from the object, and for each duplicate field that is encountered. The request will still succeed if there are no other errors, and will only persist the last of any duplicate fields. This is the default in v1.23+ - Strict: This will fail the request with a BadRequest error if any unknown fields would be dropped from the object, or if any duplicate fields are present. The error returned from the server will contain all unknown and duplicate fields encountered.", + "name": "fieldValidation", + "in": "query" + }, + { + "$ref": "#/parameters/force-tOGGb0Yi" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.command.v1alpha1.Reschedule" + } + }, + "201": { + "description": "Created", + "schema": { + "$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.command.v1alpha1.Reschedule" + } + } + }, + "x-kubernetes-action": "patch", + "x-kubernetes-group-version-kind": { + "group": "command.karmada.io", + "version": "v1alpha1", + "kind": "Reschedule" + } + }, + "parameters": [ + { + "uniqueItems": true, + "type": "string", + "description": "name of the Reschedule", + "name": "name", + "in": "path", + "required": true + }, + { + "$ref": "#/parameters/pretty-nN7o5FEq" + } + ] + }, + "/apis/command.karmada.io/v1alpha1/watch/reschedules": { + "get": { + "description": "watch individual changes to a list of Reschedule. deprecated: use the 'watch' parameter with a list operation instead.", + "consumes": [ + "*/*" + ], + "produces": [ + "application/json", + "application/yaml", + "application/vnd.kubernetes.protobuf", + "application/json;stream=watch", + "application/vnd.kubernetes.protobuf;stream=watch" + ], + "schemes": [ + "https" + ], + "tags": [ + "commandKarmadaIo_v1alpha1" + ], + "operationId": "watchCommandKarmadaIoV1alpha1RescheduleList", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.WatchEvent" + } + } + }, + "x-kubernetes-action": "watchlist", + "x-kubernetes-group-version-kind": { + "group": "command.karmada.io", + "version": "v1alpha1", + "kind": "Reschedule" + } + }, + "parameters": [ + { + "$ref": "#/parameters/allowWatchBookmarks-HC2hJt-J" + }, + { + "$ref": "#/parameters/continue-QfD61s0i" + }, + { + "$ref": "#/parameters/fieldSelector-xIcQKXFG" + }, + { + "$ref": "#/parameters/labelSelector-5Zw57w4C" + }, + { + "$ref": "#/parameters/limit-1NfNmdNH" + }, + { + "$ref": "#/parameters/pretty-nN7o5FEq" + }, + { + "$ref": "#/parameters/resourceVersion-5WAnf1kx" + }, + { + "$ref": "#/parameters/resourceVersionMatch-t8XhRHeC" + }, + { + "$ref": "#/parameters/sendInitialEvents-rLXlEK_k" + }, + { + "$ref": "#/parameters/timeoutSeconds-yvYezaOC" + }, + { + "$ref": "#/parameters/watch-XNNPZGbK" + } + ] + }, + "/apis/command.karmada.io/v1alpha1/watch/reschedules/{name}": { + "get": { + "description": "watch changes to an object of kind Reschedule. deprecated: use the 'watch' parameter with a list operation instead, filtered to a single item with the 'fieldSelector' parameter.", + "consumes": [ + "*/*" + ], + "produces": [ + "application/json", + "application/yaml", + "application/vnd.kubernetes.protobuf", + "application/json;stream=watch", + "application/vnd.kubernetes.protobuf;stream=watch" + ], + "schemes": [ + "https" + ], + "tags": [ + "commandKarmadaIo_v1alpha1" + ], + "operationId": "watchCommandKarmadaIoV1alpha1Reschedule", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.WatchEvent" + } + } + }, + "x-kubernetes-action": "watch", + "x-kubernetes-group-version-kind": { + "group": "command.karmada.io", + "version": "v1alpha1", + "kind": "Reschedule" + } + }, + "parameters": [ + { + "$ref": "#/parameters/allowWatchBookmarks-HC2hJt-J" + }, + { + "$ref": "#/parameters/continue-QfD61s0i" + }, + { + "$ref": "#/parameters/fieldSelector-xIcQKXFG" + }, + { + "$ref": "#/parameters/labelSelector-5Zw57w4C" + }, + { + "$ref": "#/parameters/limit-1NfNmdNH" + }, + { + "uniqueItems": true, + "type": "string", + "description": "name of the Reschedule", + "name": "name", + "in": "path", + "required": true + }, + { + "$ref": "#/parameters/pretty-nN7o5FEq" + }, + { + "$ref": "#/parameters/resourceVersion-5WAnf1kx" + }, + { + "$ref": "#/parameters/resourceVersionMatch-t8XhRHeC" + }, + { + "$ref": "#/parameters/sendInitialEvents-rLXlEK_k" + }, + { + "$ref": "#/parameters/timeoutSeconds-yvYezaOC" + }, + { + "$ref": "#/parameters/watch-XNNPZGbK" + } + ] + }, "/apis/config.karmada.io/": { "get": { "description": "get information of a group", @@ -16531,6 +17377,145 @@ } } }, + "com.github.karmada-io.karmada.pkg.apis.command.v1alpha1.PolicySelector": { + "description": "PolicySelector the resources bound policy will be selected.", + "type": "object", + "required": [ + "name" + ], + "properties": { + "name": { + "description": "Name of the target policy.", + "type": "string", + "default": "" + }, + "namespace": { + "description": "Namespace of the target policy. Default is empty, which means it is a cluster propagation policy.", + "type": "string" + } + } + }, + "com.github.karmada-io.karmada.pkg.apis.command.v1alpha1.Reschedule": { + "description": "Reschedule represents the desire state and status of a task which can enforces a rescheduling.\n\nNotes: make sure the clocks of aggregated-apiserver and scheduler are synchronized when using this API.", + "type": "object", + "required": [ + "spec" + ], + "properties": { + "apiVersion": { + "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/sig-architecture/api-conventions.md#resources", + "type": "string" + }, + "kind": { + "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/sig-architecture/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "default": {}, + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta" + }, + "spec": { + "description": "Spec represents the specification of the desired behavior of Reschedule.", + "default": {}, + "$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.command.v1alpha1.RescheduleSpec" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "command.karmada.io", + "kind": "Reschedule", + "version": "v1alpha1" + } + ] + }, + "com.github.karmada-io.karmada.pkg.apis.command.v1alpha1.RescheduleList": { + "description": "RescheduleList contains a list of Reschedule", + "type": "object", + "required": [ + "items" + ], + "properties": { + "apiVersion": { + "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/sig-architecture/api-conventions.md#resources", + "type": "string" + }, + "items": { + "description": "Items holds a list of Reschedule.", + "type": "array", + "items": { + "default": {}, + "$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.command.v1alpha1.Reschedule" + } + }, + "kind": { + "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/sig-architecture/api-conventions.md#types-kinds", + "type": "string" + }, + "metadata": { + "default": {}, + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ListMeta" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "command.karmada.io", + "kind": "RescheduleList", + "version": "v1alpha1" + } + ] + }, + "com.github.karmada-io.karmada.pkg.apis.command.v1alpha1.RescheduleSpec": { + "description": "RescheduleSpec represents the specification of the desired behavior of Reschedule.", + "type": "object", + "properties": { + "targetRefPolicy": { + "description": "TargetRefPolicy used to select batch of resources managed by certain policies.", + "type": "array", + "items": { + "default": {}, + "$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.command.v1alpha1.PolicySelector" + } + }, + "targetRefResource": { + "description": "TargetRefResource used to select resources.", + "type": "array", + "items": { + "default": {}, + "$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.command.v1alpha1.ResourceSelector" + } + } + } + }, + "com.github.karmada-io.karmada.pkg.apis.command.v1alpha1.ResourceSelector": { + "description": "ResourceSelector the resource will be selected.", + "type": "object", + "required": [ + "apiVersion", + "kind", + "name" + ], + "properties": { + "apiVersion": { + "description": "APIVersion represents the API version of the target resource.", + "type": "string", + "default": "" + }, + "kind": { + "description": "Kind represents the Kind of the target resource.", + "type": "string", + "default": "" + }, + "name": { + "description": "Name of the target resource.", + "type": "string", + "default": "" + }, + "namespace": { + "description": "Namespace of the target resource. Default is empty, which means it is a non-namespacescoped resource.", + "type": "string" + } + } + }, "com.github.karmada-io.karmada.pkg.apis.config.v1alpha1.CustomizationRules": { "description": "CustomizationRules describes the interpretation rules.", "type": "object", @@ -19151,6 +20136,11 @@ "$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.work.v1alpha2.BindingSnapshot" } }, + "rescheduleTriggeredAt": { + "description": "RescheduleTriggeredAt is a timestamp representing when the referenced resource is triggered rescheduling. Only when this timestamp is later than timestamp in status.rescheduledAt will the rescheduling actually execute.\n\nIt is represented in RFC3339 form (like '2006-01-02T15:04:05Z') and is in UTC. It is recommended to be populated by the REST handler of command.karmada.io/Reschedule API.", + "default": {}, + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.Time" + }, "resource": { "description": "Resource represents the Kubernetes resource to be propagated.", "default": {}, @@ -19182,6 +20172,11 @@ "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.Condition" } }, + "lastScheduledTime": { + "description": "LastScheduledTime is a timestamp representing scheduler successfully finished a scheduling. It is represented in RFC3339 form (like '2006-01-02T15:04:05Z') and is in UTC.", + "default": {}, + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.Time" + }, "schedulerObservedGeneration": { "description": "SchedulerObservedGeneration is the generation(.metadata.generation) observed by the scheduler. If SchedulerObservedGeneration is less than the generation in metadata means the scheduler hasn't confirmed the scheduling result or hasn't done the schedule yet.", "type": "integer", @@ -20677,6 +21672,11 @@ "kind": "DeleteOptions", "version": "v1beta1" }, + { + "group": "command.karmada.io", + "kind": "DeleteOptions", + "version": "v1alpha1" + }, { "group": "config.karmada.io", "kind": "DeleteOptions", @@ -21421,6 +22421,11 @@ "kind": "WatchEvent", "version": "v1beta1" }, + { + "group": "command.karmada.io", + "kind": "WatchEvent", + "version": "v1alpha1" + }, { "group": "config.karmada.io", "kind": "WatchEvent", diff --git a/charts/karmada/_crds/bases/work/work.karmada.io_clusterresourcebindings.yaml b/charts/karmada/_crds/bases/work/work.karmada.io_clusterresourcebindings.yaml index 9c00dfe94555..1ab19ad19915 100644 --- a/charts/karmada/_crds/bases/work/work.karmada.io_clusterresourcebindings.yaml +++ b/charts/karmada/_crds/bases/work/work.karmada.io_clusterresourcebindings.yaml @@ -1128,6 +1128,16 @@ spec: - name type: object type: array + rescheduleTriggeredAt: + description: "RescheduleTriggeredAt is a timestamp representing when + the referenced resource is triggered rescheduling. Only when this + timestamp is later than timestamp in status.rescheduledAt will the + rescheduling actually execute. \n It is represented in RFC3339 form + (like '2006-01-02T15:04:05Z') and is in UTC. It is recommended to + be populated by the REST handler of command.karmada.io/Reschedule + API." + format: date-time + type: string resource: description: Resource represents the Kubernetes resource to be propagated. properties: @@ -1279,6 +1289,12 @@ spec: - type type: object type: array + lastScheduledTime: + description: LastScheduledTime is a timestamp representing scheduler + successfully finished a scheduling. It is represented in RFC3339 + form (like '2006-01-02T15:04:05Z') and is in UTC. + format: date-time + type: string schedulerObservedGeneration: description: SchedulerObservedGeneration is the generation(.metadata.generation) observed by the scheduler. If SchedulerObservedGeneration is less diff --git a/charts/karmada/_crds/bases/work/work.karmada.io_resourcebindings.yaml b/charts/karmada/_crds/bases/work/work.karmada.io_resourcebindings.yaml index 6216500ea01f..87822db192ab 100644 --- a/charts/karmada/_crds/bases/work/work.karmada.io_resourcebindings.yaml +++ b/charts/karmada/_crds/bases/work/work.karmada.io_resourcebindings.yaml @@ -1128,6 +1128,16 @@ spec: - name type: object type: array + rescheduleTriggeredAt: + description: "RescheduleTriggeredAt is a timestamp representing when + the referenced resource is triggered rescheduling. Only when this + timestamp is later than timestamp in status.rescheduledAt will the + rescheduling actually execute. \n It is represented in RFC3339 form + (like '2006-01-02T15:04:05Z') and is in UTC. It is recommended to + be populated by the REST handler of command.karmada.io/Reschedule + API." + format: date-time + type: string resource: description: Resource represents the Kubernetes resource to be propagated. properties: @@ -1279,6 +1289,12 @@ spec: - type type: object type: array + lastScheduledTime: + description: LastScheduledTime is a timestamp representing scheduler + successfully finished a scheduling. It is represented in RFC3339 + form (like '2006-01-02T15:04:05Z') and is in UTC. + format: date-time + type: string schedulerObservedGeneration: description: SchedulerObservedGeneration is the generation(.metadata.generation) observed by the scheduler. If SchedulerObservedGeneration is less diff --git a/hack/tools/swagger/generateswagger.go b/hack/tools/swagger/generateswagger.go index 243ddee2ae8d..2937935ab589 100644 --- a/hack/tools/swagger/generateswagger.go +++ b/hack/tools/swagger/generateswagger.go @@ -28,6 +28,7 @@ import ( "github.com/karmada-io/karmada/hack/tools/swagger/lib" autoscalingv1alpha1 "github.com/karmada-io/karmada/pkg/apis/autoscaling/v1alpha1" clusterv1alpha1 "github.com/karmada-io/karmada/pkg/apis/cluster/v1alpha1" + commandv1alpha1 "github.com/karmada-io/karmada/pkg/apis/command/v1alpha1" configv1alpha1 "github.com/karmada-io/karmada/pkg/apis/config/v1alpha1" networkingv1alpha1 "github.com/karmada-io/karmada/pkg/apis/networking/v1alpha1" policyv1alpha1 "github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1" @@ -48,6 +49,10 @@ func main() { clusterv1alpha1.SchemeGroupVersion.WithResource(clusterv1alpha1.ResourcePluralCluster), clusterv1alpha1.SchemeGroupVersion.WithResource(clusterv1alpha1.ResourceSingularCluster), meta.RESTScopeRoot) + mapper.AddSpecific(commandv1alpha1.SchemeGroupVersion.WithKind(commandv1alpha1.ResourceKindReschedule), + commandv1alpha1.SchemeGroupVersion.WithResource(commandv1alpha1.ResourcePluralReschedule), + commandv1alpha1.SchemeGroupVersion.WithResource(commandv1alpha1.ResourceSingularReschedule), meta.RESTScopeRoot) + mapper.AddSpecific(configv1alpha1.SchemeGroupVersion.WithKind(configv1alpha1.ResourceKindResourceInterpreterWebhookConfiguration), configv1alpha1.SchemeGroupVersion.WithResource(configv1alpha1.ResourcePluralResourceInterpreterWebhookConfiguration), configv1alpha1.SchemeGroupVersion.WithResource(configv1alpha1.ResourceSingularResourceInterpreterWebhookConfiguration), meta.RESTScopeRoot) @@ -129,6 +134,7 @@ func main() { }, Resources: []lib.ResourceWithNamespaceScoped{ {GVR: clusterv1alpha1.SchemeGroupVersion.WithResource(clusterv1alpha1.ResourcePluralCluster), NamespaceScoped: clusterv1alpha1.ResourceNamespaceScopedCluster}, + {GVR: commandv1alpha1.SchemeGroupVersion.WithResource(commandv1alpha1.ResourcePluralReschedule), NamespaceScoped: commandv1alpha1.ResourceNamespaceScopedReschedule}, {GVR: configv1alpha1.SchemeGroupVersion.WithResource(configv1alpha1.ResourcePluralResourceInterpreterWebhookConfiguration), NamespaceScoped: configv1alpha1.ResourceNamespaceScopedResourceInterpreterWebhookConfiguration}, {GVR: configv1alpha1.SchemeGroupVersion.WithResource(configv1alpha1.ResourcePluralResourceInterpreterCustomization), NamespaceScoped: configv1alpha1.ResourceNamespaceScopedResourceInterpreterCustomization}, {GVR: networkingv1alpha1.SchemeGroupVersion.WithResource(networkingv1alpha1.ResourcePluralMultiClusterIngress), NamespaceScoped: networkingv1alpha1.ResourceNamespaceScopedMultiClusterIngress}, diff --git a/hack/update-codegen.sh b/hack/update-codegen.sh index 490fb7e39251..09aa3047bd07 100755 --- a/hack/update-codegen.sh +++ b/hack/update-codegen.sh @@ -55,6 +55,16 @@ deepcopy-gen \ --input-dirs=github.com/karmada-io/karmada/pkg/apis/cluster \ --output-package=github.com/karmada-io/karmada/pkg/apis/cluster \ --output-file-base=zz_generated.deepcopy +deepcopy-gen \ + --go-header-file hack/boilerplate/boilerplate.go.txt \ + --input-dirs=github.com/karmada-io/karmada/pkg/apis/command/v1alpha1 \ + --output-package=github.com/karmada-io/karmada/pkg/apis/command/v1alpha1 \ + --output-file-base=zz_generated.deepcopy +deepcopy-gen \ + --go-header-file hack/boilerplate/boilerplate.go.txt \ + --input-dirs=github.com/karmada-io/karmada/pkg/apis/command \ + --output-package=github.com/karmada-io/karmada/pkg/apis/command \ + --output-file-base=zz_generated.deepcopy deepcopy-gen \ --go-header-file hack/boilerplate/boilerplate.go.txt \ --input-dirs=github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1 \ @@ -117,6 +127,11 @@ register-gen \ --input-dirs=github.com/karmada-io/karmada/pkg/apis/cluster/v1alpha1 \ --output-package=github.com/karmada-io/karmada/pkg/apis/cluster/v1alpha1 \ --output-file-base=zz_generated.register +register-gen \ + --go-header-file hack/boilerplate/boilerplate.go.txt \ + --input-dirs=github.com/karmada-io/karmada/pkg/apis/command/v1alpha1 \ + --output-package=github.com/karmada-io/karmada/pkg/apis/command/v1alpha1 \ + --output-file-base=zz_generated.register register-gen \ --go-header-file hack/boilerplate/boilerplate.go.txt \ --input-dirs=github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1 \ @@ -174,6 +189,11 @@ conversion-gen \ --input-dirs=github.com/karmada-io/karmada/pkg/apis/cluster/v1alpha1 \ --output-package=github.com/karmada-io/karmada/pkg/apis/cluster/v1alpha1 \ --output-file-base=zz_generated.conversion +conversion-gen \ + --go-header-file hack/boilerplate/boilerplate.go.txt \ + --input-dirs=github.com/karmada-io/karmada/pkg/apis/command/v1alpha1 \ + --output-package=github.com/karmada-io/karmada/pkg/apis/command/v1alpha1 \ + --output-file-base=zz_generated.conversion conversion-gen \ --go-header-file hack/boilerplate/boilerplate.go.txt \ --input-dirs=github.com/karmada-io/karmada/pkg/apis/search/v1alpha1 \ @@ -184,7 +204,7 @@ echo "Generating with client-gen" client-gen \ --go-header-file hack/boilerplate/boilerplate.go.txt \ --input-base="" \ - --input=github.com/karmada-io/karmada/pkg/apis/cluster/v1alpha1,github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1,github.com/karmada-io/karmada/pkg/apis/work/v1alpha1,github.com/karmada-io/karmada/pkg/apis/work/v1alpha2,github.com/karmada-io/karmada/pkg/apis/config/v1alpha1,github.com/karmada-io/karmada/pkg/apis/networking/v1alpha1,github.com/karmada-io/karmada/pkg/apis/search/v1alpha1,github.com/karmada-io/karmada/pkg/apis/autoscaling/v1alpha1,github.com/karmada-io/karmada/pkg/apis/remedy/v1alpha1 \ + --input=github.com/karmada-io/karmada/pkg/apis/cluster/v1alpha1,github.com/karmada-io/karmada/pkg/apis/command/v1alpha1,github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1,github.com/karmada-io/karmada/pkg/apis/work/v1alpha1,github.com/karmada-io/karmada/pkg/apis/work/v1alpha2,github.com/karmada-io/karmada/pkg/apis/config/v1alpha1,github.com/karmada-io/karmada/pkg/apis/networking/v1alpha1,github.com/karmada-io/karmada/pkg/apis/search/v1alpha1,github.com/karmada-io/karmada/pkg/apis/autoscaling/v1alpha1,github.com/karmada-io/karmada/pkg/apis/remedy/v1alpha1 \ --output-package=github.com/karmada-io/karmada/pkg/generated/clientset \ --clientset-name=versioned client-gen \ @@ -197,7 +217,7 @@ client-gen \ echo "Generating with lister-gen" lister-gen \ --go-header-file hack/boilerplate/boilerplate.go.txt \ - --input-dirs=github.com/karmada-io/karmada/pkg/apis/cluster/v1alpha1,github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1,github.com/karmada-io/karmada/pkg/apis/work/v1alpha1,github.com/karmada-io/karmada/pkg/apis/work/v1alpha2,github.com/karmada-io/karmada/pkg/apis/config/v1alpha1,github.com/karmada-io/karmada/pkg/apis/networking/v1alpha1,github.com/karmada-io/karmada/pkg/apis/search/v1alpha1,github.com/karmada-io/karmada/pkg/apis/autoscaling/v1alpha1,github.com/karmada-io/karmada/pkg/apis/remedy/v1alpha1 \ + --input-dirs=github.com/karmada-io/karmada/pkg/apis/cluster/v1alpha1,github.com/karmada-io/karmada/pkg/apis/command/v1alpha1,github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1,github.com/karmada-io/karmada/pkg/apis/work/v1alpha1,github.com/karmada-io/karmada/pkg/apis/work/v1alpha2,github.com/karmada-io/karmada/pkg/apis/config/v1alpha1,github.com/karmada-io/karmada/pkg/apis/networking/v1alpha1,github.com/karmada-io/karmada/pkg/apis/search/v1alpha1,github.com/karmada-io/karmada/pkg/apis/autoscaling/v1alpha1,github.com/karmada-io/karmada/pkg/apis/remedy/v1alpha1 \ --output-package=github.com/karmada-io/karmada/pkg/generated/listers lister-gen \ --go-header-file hack/boilerplate/boilerplate.go.txt \ @@ -207,7 +227,7 @@ lister-gen \ echo "Generating with informer-gen" informer-gen \ --go-header-file hack/boilerplate/boilerplate.go.txt \ - --input-dirs=github.com/karmada-io/karmada/pkg/apis/cluster/v1alpha1,github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1,github.com/karmada-io/karmada/pkg/apis/work/v1alpha1,github.com/karmada-io/karmada/pkg/apis/work/v1alpha2,github.com/karmada-io/karmada/pkg/apis/config/v1alpha1,github.com/karmada-io/karmada/pkg/apis/networking/v1alpha1,github.com/karmada-io/karmada/pkg/apis/search/v1alpha1,github.com/karmada-io/karmada/pkg/apis/autoscaling/v1alpha1,github.com/karmada-io/karmada/pkg/apis/remedy/v1alpha1 \ + --input-dirs=github.com/karmada-io/karmada/pkg/apis/cluster/v1alpha1,github.com/karmada-io/karmada/pkg/apis/command/v1alpha1,github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1,github.com/karmada-io/karmada/pkg/apis/work/v1alpha1,github.com/karmada-io/karmada/pkg/apis/work/v1alpha2,github.com/karmada-io/karmada/pkg/apis/config/v1alpha1,github.com/karmada-io/karmada/pkg/apis/networking/v1alpha1,github.com/karmada-io/karmada/pkg/apis/search/v1alpha1,github.com/karmada-io/karmada/pkg/apis/autoscaling/v1alpha1,github.com/karmada-io/karmada/pkg/apis/remedy/v1alpha1 \ --versioned-clientset-package=github.com/karmada-io/karmada/pkg/generated/clientset/versioned \ --listers-package=github.com/karmada-io/karmada/pkg/generated/listers \ --output-package=github.com/karmada-io/karmada/pkg/generated/informers @@ -222,6 +242,7 @@ echo "Generating with openapi-gen" openapi-gen \ --go-header-file hack/boilerplate/boilerplate.go.txt \ --input-dirs "github.com/karmada-io/karmada/pkg/apis/cluster/v1alpha1" \ + --input-dirs "github.com/karmada-io/karmada/pkg/apis/command/v1alpha1" \ --input-dirs "github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1" \ --input-dirs "github.com/karmada-io/karmada/pkg/apis/work/v1alpha1" \ --input-dirs "github.com/karmada-io/karmada/pkg/apis/work/v1alpha2" \ diff --git a/pkg/apis/command/doc.go b/pkg/apis/command/doc.go new file mode 100644 index 000000000000..0a07b1b3cc39 --- /dev/null +++ b/pkg/apis/command/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2024 The Karmada 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 command is the internal version of the API. +// +k8s:deepcopy-gen=package +// +groupName=command.karmada.io +package command diff --git a/pkg/apis/command/register.go b/pkg/apis/command/register.go new file mode 100644 index 000000000000..bff806cfcc4e --- /dev/null +++ b/pkg/apis/command/register.go @@ -0,0 +1,54 @@ +/* +Copyright 2024 The Karmada 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 command + +import ( + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// GroupName specifies the group name used to register the objects. +const GroupName = "command.karmada.io" + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal} + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +// Kind takes an unqualified kind and returns a Group qualified GroupKind +func Kind(kind string) schema.GroupKind { + return SchemeGroupVersion.WithKind(kind).GroupKind() +} + +var ( + // SchemeBuilder is the scheme builder with scheme init functions to run for this API package + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + // AddToScheme is a common registration function for mapping packaged scoped group & version keys to a scheme + AddToScheme = SchemeBuilder.AddToScheme +) + +// Adds the list of known types to Scheme. +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &Reschedule{}, + &RescheduleList{}, + ) + return nil +} diff --git a/pkg/apis/command/types.go b/pkg/apis/command/types.go new file mode 100644 index 000000000000..a94ff7a97121 --- /dev/null +++ b/pkg/apis/command/types.go @@ -0,0 +1,104 @@ +/* +Copyright 2024 The Karmada 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 command + +import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + +const ( + // ResourceKindReschedule is kind name of Reschedule. + ResourceKindReschedule = "Reschedule" + // ResourceSingularReschedule is singular name of Reschedule. + ResourceSingularReschedule = "reschedule" + // ResourcePluralReschedule is plural name of Reschedule. + ResourcePluralReschedule = "reschedules" + // ResourceNamespaceScopedReschedule indicates if Reschedule is NamespaceScoped. + ResourceNamespaceScopedReschedule = false +) + +//revive:disable:exported + +// +genclient +// +genclient:nonNamespaced +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// Reschedule represents the desire state and status of a task which can enforces a rescheduling. +// +// Notes: make sure the clocks of aggregated-apiserver and scheduler are synchronized when using this API. +type Reschedule struct { + metav1.TypeMeta + metav1.ObjectMeta + + // Spec represents the specification of the desired behavior of Reschedule. + // +required + Spec RescheduleSpec +} + +// RescheduleSpec represents the specification of the desired behavior of Reschedule. +type RescheduleSpec struct { + // TargetRefPolicy used to select batch of resources managed by certain policies. + // +optional + TargetRefPolicy []PolicySelector + + // TargetRefResource used to select resources. + // +optional + TargetRefResource []ResourceSelector +} + +// PolicySelector the resources bound policy will be selected. +type PolicySelector struct { + // Name of the target policy. + // +required + Name string + + // Namespace of the target policy. + // Default is empty, which means it is a cluster propagation policy. + // +optional + Namespace string +} + +// ResourceSelector the resource will be selected. +type ResourceSelector struct { + // APIVersion represents the API version of the target resource. + // +required + APIVersion string + + // Kind represents the Kind of the target resource. + // +required + Kind string + + // Name of the target resource. + // +required + Name string + + // Namespace of the target resource. + // Default is empty, which means it is a non-namespacescoped resource. + // +optional + Namespace string +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// RescheduleList contains a list of Reschedule +type RescheduleList struct { + metav1.TypeMeta + metav1.ListMeta + + // Items holds a list of Reschedule. + Items []Reschedule +} + +//revive:enable:exported diff --git a/pkg/apis/command/v1alpha1/doc.go b/pkg/apis/command/v1alpha1/doc.go new file mode 100644 index 000000000000..ae5350d51c6f --- /dev/null +++ b/pkg/apis/command/v1alpha1/doc.go @@ -0,0 +1,22 @@ +/* +Copyright 2024 The Karmada 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 v1alpha1 is the v1alpha1 version of the API. +// +k8s:openapi-gen=true +// +k8s:deepcopy-gen=package,register +// +k8s:conversion-gen=github.com/karmada-io/karmada/pkg/apis/command +// +groupName=command.karmada.io +package v1alpha1 diff --git a/pkg/apis/command/v1alpha1/types.go b/pkg/apis/command/v1alpha1/types.go new file mode 100644 index 000000000000..43f3d62a9d53 --- /dev/null +++ b/pkg/apis/command/v1alpha1/types.go @@ -0,0 +1,101 @@ +/* +Copyright 2024 The Karmada 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 v1alpha1 + +import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + +const ( + // ResourceKindReschedule is kind name of Reschedule. + ResourceKindReschedule = "Reschedule" + // ResourceSingularReschedule is singular name of Reschedule. + ResourceSingularReschedule = "reschedule" + // ResourcePluralReschedule is plural name of Reschedule. + ResourcePluralReschedule = "reschedules" + // ResourceNamespaceScopedReschedule indicates if Reschedule is NamespaceScoped. + ResourceNamespaceScopedReschedule = false +) + +// +genclient +// +genclient:nonNamespaced +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:resource:scope="Cluster" + +// Reschedule represents the desire state and status of a task which can enforces a rescheduling. +// +// Notes: make sure the clocks of aggregated-apiserver and scheduler are synchronized when using this API. +type Reschedule struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + // Spec represents the specification of the desired behavior of Reschedule. + // +required + Spec RescheduleSpec `json:"spec"` +} + +// RescheduleSpec represents the specification of the desired behavior of Reschedule. +type RescheduleSpec struct { + // TargetRefPolicy used to select batch of resources managed by certain policies. + // +optional + TargetRefPolicy []PolicySelector `json:"targetRefPolicy,omitempty"` + + // TargetRefResource used to select resources. + // +optional + TargetRefResource []ResourceSelector `json:"targetRefResource,omitempty"` +} + +// PolicySelector the resources bound policy will be selected. +type PolicySelector struct { + // Name of the target policy. + // +required + Name string `json:"name"` + + // Namespace of the target policy. + // Default is empty, which means it is a cluster propagation policy. + // +optional + Namespace string `json:"namespace,omitempty"` +} + +// ResourceSelector the resource will be selected. +type ResourceSelector struct { + // APIVersion represents the API version of the target resource. + // +required + APIVersion string `json:"apiVersion"` + + // Kind represents the Kind of the target resource. + // +required + Kind string `json:"kind"` + + // Name of the target resource. + // +required + Name string `json:"name"` + + // Namespace of the target resource. + // Default is empty, which means it is a non-namespacescoped resource. + // +optional + Namespace string `json:"namespace,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// RescheduleList contains a list of Reschedule +type RescheduleList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + + // Items holds a list of Reschedule. + Items []Reschedule `json:"items"` +} diff --git a/pkg/apis/command/v1alpha1/zz_generated.conversion.go b/pkg/apis/command/v1alpha1/zz_generated.conversion.go new file mode 100644 index 000000000000..c99f25eee1ed --- /dev/null +++ b/pkg/apis/command/v1alpha1/zz_generated.conversion.go @@ -0,0 +1,208 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Karmada Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by conversion-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + unsafe "unsafe" + + command "github.com/karmada-io/karmada/pkg/apis/command" + conversion "k8s.io/apimachinery/pkg/conversion" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +func init() { + localSchemeBuilder.Register(RegisterConversions) +} + +// RegisterConversions adds conversion functions to the given scheme. +// Public to allow building arbitrary schemes. +func RegisterConversions(s *runtime.Scheme) error { + if err := s.AddGeneratedConversionFunc((*PolicySelector)(nil), (*command.PolicySelector)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_PolicySelector_To_command_PolicySelector(a.(*PolicySelector), b.(*command.PolicySelector), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*command.PolicySelector)(nil), (*PolicySelector)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_command_PolicySelector_To_v1alpha1_PolicySelector(a.(*command.PolicySelector), b.(*PolicySelector), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*Reschedule)(nil), (*command.Reschedule)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_Reschedule_To_command_Reschedule(a.(*Reschedule), b.(*command.Reschedule), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*command.Reschedule)(nil), (*Reschedule)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_command_Reschedule_To_v1alpha1_Reschedule(a.(*command.Reschedule), b.(*Reschedule), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*RescheduleList)(nil), (*command.RescheduleList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_RescheduleList_To_command_RescheduleList(a.(*RescheduleList), b.(*command.RescheduleList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*command.RescheduleList)(nil), (*RescheduleList)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_command_RescheduleList_To_v1alpha1_RescheduleList(a.(*command.RescheduleList), b.(*RescheduleList), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*RescheduleSpec)(nil), (*command.RescheduleSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_RescheduleSpec_To_command_RescheduleSpec(a.(*RescheduleSpec), b.(*command.RescheduleSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*command.RescheduleSpec)(nil), (*RescheduleSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_command_RescheduleSpec_To_v1alpha1_RescheduleSpec(a.(*command.RescheduleSpec), b.(*RescheduleSpec), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ResourceSelector)(nil), (*command.ResourceSelector)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_ResourceSelector_To_command_ResourceSelector(a.(*ResourceSelector), b.(*command.ResourceSelector), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*command.ResourceSelector)(nil), (*ResourceSelector)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_command_ResourceSelector_To_v1alpha1_ResourceSelector(a.(*command.ResourceSelector), b.(*ResourceSelector), scope) + }); err != nil { + return err + } + return nil +} + +func autoConvert_v1alpha1_PolicySelector_To_command_PolicySelector(in *PolicySelector, out *command.PolicySelector, s conversion.Scope) error { + out.Name = in.Name + out.Namespace = in.Namespace + return nil +} + +// Convert_v1alpha1_PolicySelector_To_command_PolicySelector is an autogenerated conversion function. +func Convert_v1alpha1_PolicySelector_To_command_PolicySelector(in *PolicySelector, out *command.PolicySelector, s conversion.Scope) error { + return autoConvert_v1alpha1_PolicySelector_To_command_PolicySelector(in, out, s) +} + +func autoConvert_command_PolicySelector_To_v1alpha1_PolicySelector(in *command.PolicySelector, out *PolicySelector, s conversion.Scope) error { + out.Name = in.Name + out.Namespace = in.Namespace + return nil +} + +// Convert_command_PolicySelector_To_v1alpha1_PolicySelector is an autogenerated conversion function. +func Convert_command_PolicySelector_To_v1alpha1_PolicySelector(in *command.PolicySelector, out *PolicySelector, s conversion.Scope) error { + return autoConvert_command_PolicySelector_To_v1alpha1_PolicySelector(in, out, s) +} + +func autoConvert_v1alpha1_Reschedule_To_command_Reschedule(in *Reschedule, out *command.Reschedule, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_v1alpha1_RescheduleSpec_To_command_RescheduleSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + return nil +} + +// Convert_v1alpha1_Reschedule_To_command_Reschedule is an autogenerated conversion function. +func Convert_v1alpha1_Reschedule_To_command_Reschedule(in *Reschedule, out *command.Reschedule, s conversion.Scope) error { + return autoConvert_v1alpha1_Reschedule_To_command_Reschedule(in, out, s) +} + +func autoConvert_command_Reschedule_To_v1alpha1_Reschedule(in *command.Reschedule, out *Reschedule, s conversion.Scope) error { + out.ObjectMeta = in.ObjectMeta + if err := Convert_command_RescheduleSpec_To_v1alpha1_RescheduleSpec(&in.Spec, &out.Spec, s); err != nil { + return err + } + return nil +} + +// Convert_command_Reschedule_To_v1alpha1_Reschedule is an autogenerated conversion function. +func Convert_command_Reschedule_To_v1alpha1_Reschedule(in *command.Reschedule, out *Reschedule, s conversion.Scope) error { + return autoConvert_command_Reschedule_To_v1alpha1_Reschedule(in, out, s) +} + +func autoConvert_v1alpha1_RescheduleList_To_command_RescheduleList(in *RescheduleList, out *command.RescheduleList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]command.Reschedule)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_v1alpha1_RescheduleList_To_command_RescheduleList is an autogenerated conversion function. +func Convert_v1alpha1_RescheduleList_To_command_RescheduleList(in *RescheduleList, out *command.RescheduleList, s conversion.Scope) error { + return autoConvert_v1alpha1_RescheduleList_To_command_RescheduleList(in, out, s) +} + +func autoConvert_command_RescheduleList_To_v1alpha1_RescheduleList(in *command.RescheduleList, out *RescheduleList, s conversion.Scope) error { + out.ListMeta = in.ListMeta + out.Items = *(*[]Reschedule)(unsafe.Pointer(&in.Items)) + return nil +} + +// Convert_command_RescheduleList_To_v1alpha1_RescheduleList is an autogenerated conversion function. +func Convert_command_RescheduleList_To_v1alpha1_RescheduleList(in *command.RescheduleList, out *RescheduleList, s conversion.Scope) error { + return autoConvert_command_RescheduleList_To_v1alpha1_RescheduleList(in, out, s) +} + +func autoConvert_v1alpha1_RescheduleSpec_To_command_RescheduleSpec(in *RescheduleSpec, out *command.RescheduleSpec, s conversion.Scope) error { + out.TargetRefPolicy = *(*[]command.PolicySelector)(unsafe.Pointer(&in.TargetRefPolicy)) + out.TargetRefResource = *(*[]command.ResourceSelector)(unsafe.Pointer(&in.TargetRefResource)) + return nil +} + +// Convert_v1alpha1_RescheduleSpec_To_command_RescheduleSpec is an autogenerated conversion function. +func Convert_v1alpha1_RescheduleSpec_To_command_RescheduleSpec(in *RescheduleSpec, out *command.RescheduleSpec, s conversion.Scope) error { + return autoConvert_v1alpha1_RescheduleSpec_To_command_RescheduleSpec(in, out, s) +} + +func autoConvert_command_RescheduleSpec_To_v1alpha1_RescheduleSpec(in *command.RescheduleSpec, out *RescheduleSpec, s conversion.Scope) error { + out.TargetRefPolicy = *(*[]PolicySelector)(unsafe.Pointer(&in.TargetRefPolicy)) + out.TargetRefResource = *(*[]ResourceSelector)(unsafe.Pointer(&in.TargetRefResource)) + return nil +} + +// Convert_command_RescheduleSpec_To_v1alpha1_RescheduleSpec is an autogenerated conversion function. +func Convert_command_RescheduleSpec_To_v1alpha1_RescheduleSpec(in *command.RescheduleSpec, out *RescheduleSpec, s conversion.Scope) error { + return autoConvert_command_RescheduleSpec_To_v1alpha1_RescheduleSpec(in, out, s) +} + +func autoConvert_v1alpha1_ResourceSelector_To_command_ResourceSelector(in *ResourceSelector, out *command.ResourceSelector, s conversion.Scope) error { + out.APIVersion = in.APIVersion + out.Kind = in.Kind + out.Name = in.Name + out.Namespace = in.Namespace + return nil +} + +// Convert_v1alpha1_ResourceSelector_To_command_ResourceSelector is an autogenerated conversion function. +func Convert_v1alpha1_ResourceSelector_To_command_ResourceSelector(in *ResourceSelector, out *command.ResourceSelector, s conversion.Scope) error { + return autoConvert_v1alpha1_ResourceSelector_To_command_ResourceSelector(in, out, s) +} + +func autoConvert_command_ResourceSelector_To_v1alpha1_ResourceSelector(in *command.ResourceSelector, out *ResourceSelector, s conversion.Scope) error { + out.APIVersion = in.APIVersion + out.Kind = in.Kind + out.Name = in.Name + out.Namespace = in.Namespace + return nil +} + +// Convert_command_ResourceSelector_To_v1alpha1_ResourceSelector is an autogenerated conversion function. +func Convert_command_ResourceSelector_To_v1alpha1_ResourceSelector(in *command.ResourceSelector, out *ResourceSelector, s conversion.Scope) error { + return autoConvert_command_ResourceSelector_To_v1alpha1_ResourceSelector(in, out, s) +} diff --git a/pkg/apis/command/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/command/v1alpha1/zz_generated.deepcopy.go new file mode 100644 index 000000000000..918c442e05eb --- /dev/null +++ b/pkg/apis/command/v1alpha1/zz_generated.deepcopy.go @@ -0,0 +1,144 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Karmada Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by deepcopy-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PolicySelector) DeepCopyInto(out *PolicySelector) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PolicySelector. +func (in *PolicySelector) DeepCopy() *PolicySelector { + if in == nil { + return nil + } + out := new(PolicySelector) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Reschedule) DeepCopyInto(out *Reschedule) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Reschedule. +func (in *Reschedule) DeepCopy() *Reschedule { + if in == nil { + return nil + } + out := new(Reschedule) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Reschedule) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RescheduleList) DeepCopyInto(out *RescheduleList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Reschedule, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RescheduleList. +func (in *RescheduleList) DeepCopy() *RescheduleList { + if in == nil { + return nil + } + out := new(RescheduleList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *RescheduleList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RescheduleSpec) DeepCopyInto(out *RescheduleSpec) { + *out = *in + if in.TargetRefPolicy != nil { + in, out := &in.TargetRefPolicy, &out.TargetRefPolicy + *out = make([]PolicySelector, len(*in)) + copy(*out, *in) + } + if in.TargetRefResource != nil { + in, out := &in.TargetRefResource, &out.TargetRefResource + *out = make([]ResourceSelector, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RescheduleSpec. +func (in *RescheduleSpec) DeepCopy() *RescheduleSpec { + if in == nil { + return nil + } + out := new(RescheduleSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ResourceSelector) DeepCopyInto(out *ResourceSelector) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceSelector. +func (in *ResourceSelector) DeepCopy() *ResourceSelector { + if in == nil { + return nil + } + out := new(ResourceSelector) + in.DeepCopyInto(out) + return out +} diff --git a/pkg/apis/command/v1alpha1/zz_generated.register.go b/pkg/apis/command/v1alpha1/zz_generated.register.go new file mode 100644 index 000000000000..54f345ae94f9 --- /dev/null +++ b/pkg/apis/command/v1alpha1/zz_generated.register.go @@ -0,0 +1,67 @@ +/* +Copyright The Karmada Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by register-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// GroupName specifies the group name used to register the objects. +const GroupName = "command.karmada.io" + +// GroupVersion specifies the group and the version used to register the objects. +var GroupVersion = v1.GroupVersion{Group: GroupName, Version: "v1alpha1"} + +// SchemeGroupVersion is group version used to register these objects +// Deprecated: use GroupVersion instead. +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"} + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +var ( + // localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes. + SchemeBuilder runtime.SchemeBuilder + localSchemeBuilder = &SchemeBuilder + // Depreciated: use Install instead + AddToScheme = localSchemeBuilder.AddToScheme + Install = localSchemeBuilder.AddToScheme +) + +func init() { + // We only register manually written functions here. The registration of the + // generated functions takes place in the generated files. The separation + // makes the code compile even when the generated files are missing. + localSchemeBuilder.Register(addKnownTypes) +} + +// Adds the list of known types to Scheme. +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &Reschedule{}, + &RescheduleList{}, + ) + // AddToGroupVersion allows the serialization of client types like ListOptions. + v1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/pkg/apis/command/zz_generated.deepcopy.go b/pkg/apis/command/zz_generated.deepcopy.go new file mode 100644 index 000000000000..cc1bacc7df2c --- /dev/null +++ b/pkg/apis/command/zz_generated.deepcopy.go @@ -0,0 +1,144 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Karmada Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by deepcopy-gen. DO NOT EDIT. + +package command + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PolicySelector) DeepCopyInto(out *PolicySelector) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PolicySelector. +func (in *PolicySelector) DeepCopy() *PolicySelector { + if in == nil { + return nil + } + out := new(PolicySelector) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Reschedule) DeepCopyInto(out *Reschedule) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Reschedule. +func (in *Reschedule) DeepCopy() *Reschedule { + if in == nil { + return nil + } + out := new(Reschedule) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Reschedule) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RescheduleList) DeepCopyInto(out *RescheduleList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Reschedule, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RescheduleList. +func (in *RescheduleList) DeepCopy() *RescheduleList { + if in == nil { + return nil + } + out := new(RescheduleList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *RescheduleList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RescheduleSpec) DeepCopyInto(out *RescheduleSpec) { + *out = *in + if in.TargetRefPolicy != nil { + in, out := &in.TargetRefPolicy, &out.TargetRefPolicy + *out = make([]PolicySelector, len(*in)) + copy(*out, *in) + } + if in.TargetRefResource != nil { + in, out := &in.TargetRefResource, &out.TargetRefResource + *out = make([]ResourceSelector, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RescheduleSpec. +func (in *RescheduleSpec) DeepCopy() *RescheduleSpec { + if in == nil { + return nil + } + out := new(RescheduleSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ResourceSelector) DeepCopyInto(out *ResourceSelector) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceSelector. +func (in *ResourceSelector) DeepCopy() *ResourceSelector { + if in == nil { + return nil + } + out := new(ResourceSelector) + in.DeepCopyInto(out) + return out +} diff --git a/pkg/apis/work/v1alpha2/binding_types.go b/pkg/apis/work/v1alpha2/binding_types.go index b9868f32528d..ac5c9a043e6b 100644 --- a/pkg/apis/work/v1alpha2/binding_types.go +++ b/pkg/apis/work/v1alpha2/binding_types.go @@ -136,6 +136,14 @@ type ResourceBindingSpec struct { // +kubebuilder:validation:Enum=Abort;Overwrite // +optional ConflictResolution policyv1alpha1.ConflictResolution `json:"conflictResolution,omitempty"` + + // RescheduleTriggeredAt is a timestamp representing when the referenced resource is triggered rescheduling. + // Only when this timestamp is later than timestamp in status.rescheduledAt will the rescheduling actually execute. + // + // It is represented in RFC3339 form (like '2006-01-02T15:04:05Z') and is in UTC. + // It is recommended to be populated by the REST handler of command.karmada.io/Reschedule API. + // +optional + RescheduleTriggeredAt metav1.Time `json:"rescheduleTriggeredAt,omitempty"` } // ObjectReference contains enough information to locate the referenced object inside current cluster. @@ -297,6 +305,11 @@ type ResourceBindingStatus struct { // +optional SchedulerObservedAffinityName string `json:"schedulerObservingAffinityName,omitempty"` + // LastScheduledTime is a timestamp representing scheduler successfully finished a scheduling. + // It is represented in RFC3339 form (like '2006-01-02T15:04:05Z') and is in UTC. + // +optional + LastScheduledTime metav1.Time `json:"lastScheduledTime,omitempty"` + // Conditions contain the different condition statuses. // +optional Conditions []metav1.Condition `json:"conditions,omitempty"` diff --git a/pkg/apis/work/v1alpha2/zz_generated.deepcopy.go b/pkg/apis/work/v1alpha2/zz_generated.deepcopy.go index 0a05f8f7a486..2447b3dee7ca 100644 --- a/pkg/apis/work/v1alpha2/zz_generated.deepcopy.go +++ b/pkg/apis/work/v1alpha2/zz_generated.deepcopy.go @@ -344,6 +344,7 @@ func (in *ResourceBindingSpec) DeepCopyInto(out *ResourceBindingSpec) { *out = new(v1alpha1.FailoverBehavior) (*in).DeepCopyInto(*out) } + in.RescheduleTriggeredAt.DeepCopyInto(&out.RescheduleTriggeredAt) return } @@ -360,6 +361,7 @@ func (in *ResourceBindingSpec) DeepCopy() *ResourceBindingSpec { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ResourceBindingStatus) DeepCopyInto(out *ResourceBindingStatus) { *out = *in + in.LastScheduledTime.DeepCopyInto(&out.LastScheduledTime) if in.Conditions != nil { in, out := &in.Conditions, &out.Conditions *out = make([]metav1.Condition, len(*in)) diff --git a/pkg/generated/clientset/versioned/clientset.go b/pkg/generated/clientset/versioned/clientset.go index 4b8ac2dfad6d..f2562a837d6d 100644 --- a/pkg/generated/clientset/versioned/clientset.go +++ b/pkg/generated/clientset/versioned/clientset.go @@ -24,6 +24,7 @@ import ( autoscalingv1alpha1 "github.com/karmada-io/karmada/pkg/generated/clientset/versioned/typed/autoscaling/v1alpha1" clusterv1alpha1 "github.com/karmada-io/karmada/pkg/generated/clientset/versioned/typed/cluster/v1alpha1" + commandv1alpha1 "github.com/karmada-io/karmada/pkg/generated/clientset/versioned/typed/command/v1alpha1" configv1alpha1 "github.com/karmada-io/karmada/pkg/generated/clientset/versioned/typed/config/v1alpha1" networkingv1alpha1 "github.com/karmada-io/karmada/pkg/generated/clientset/versioned/typed/networking/v1alpha1" policyv1alpha1 "github.com/karmada-io/karmada/pkg/generated/clientset/versioned/typed/policy/v1alpha1" @@ -40,6 +41,7 @@ type Interface interface { Discovery() discovery.DiscoveryInterface AutoscalingV1alpha1() autoscalingv1alpha1.AutoscalingV1alpha1Interface ClusterV1alpha1() clusterv1alpha1.ClusterV1alpha1Interface + CommandV1alpha1() commandv1alpha1.CommandV1alpha1Interface ConfigV1alpha1() configv1alpha1.ConfigV1alpha1Interface NetworkingV1alpha1() networkingv1alpha1.NetworkingV1alpha1Interface PolicyV1alpha1() policyv1alpha1.PolicyV1alpha1Interface @@ -54,6 +56,7 @@ type Clientset struct { *discovery.DiscoveryClient autoscalingV1alpha1 *autoscalingv1alpha1.AutoscalingV1alpha1Client clusterV1alpha1 *clusterv1alpha1.ClusterV1alpha1Client + commandV1alpha1 *commandv1alpha1.CommandV1alpha1Client configV1alpha1 *configv1alpha1.ConfigV1alpha1Client networkingV1alpha1 *networkingv1alpha1.NetworkingV1alpha1Client policyV1alpha1 *policyv1alpha1.PolicyV1alpha1Client @@ -73,6 +76,11 @@ func (c *Clientset) ClusterV1alpha1() clusterv1alpha1.ClusterV1alpha1Interface { return c.clusterV1alpha1 } +// CommandV1alpha1 retrieves the CommandV1alpha1Client +func (c *Clientset) CommandV1alpha1() commandv1alpha1.CommandV1alpha1Interface { + return c.commandV1alpha1 +} + // ConfigV1alpha1 retrieves the ConfigV1alpha1Client func (c *Clientset) ConfigV1alpha1() configv1alpha1.ConfigV1alpha1Interface { return c.configV1alpha1 @@ -160,6 +168,10 @@ func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, if err != nil { return nil, err } + cs.commandV1alpha1, err = commandv1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } cs.configV1alpha1, err = configv1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err @@ -211,6 +223,7 @@ func New(c rest.Interface) *Clientset { var cs Clientset cs.autoscalingV1alpha1 = autoscalingv1alpha1.New(c) cs.clusterV1alpha1 = clusterv1alpha1.New(c) + cs.commandV1alpha1 = commandv1alpha1.New(c) cs.configV1alpha1 = configv1alpha1.New(c) cs.networkingV1alpha1 = networkingv1alpha1.New(c) cs.policyV1alpha1 = policyv1alpha1.New(c) diff --git a/pkg/generated/clientset/versioned/doc.go b/pkg/generated/clientset/versioned/doc.go deleted file mode 100644 index 0e0c2a8900e2..000000000000 --- a/pkg/generated/clientset/versioned/doc.go +++ /dev/null @@ -1,4 +0,0 @@ -// Code generated by client-gen. DO NOT EDIT. - -// This package has the automatically generated clientset. -package versioned diff --git a/pkg/generated/clientset/versioned/fake/clientset_generated.go b/pkg/generated/clientset/versioned/fake/clientset_generated.go index 615977b708fa..5289c960bbe6 100644 --- a/pkg/generated/clientset/versioned/fake/clientset_generated.go +++ b/pkg/generated/clientset/versioned/fake/clientset_generated.go @@ -24,6 +24,8 @@ import ( fakeautoscalingv1alpha1 "github.com/karmada-io/karmada/pkg/generated/clientset/versioned/typed/autoscaling/v1alpha1/fake" clusterv1alpha1 "github.com/karmada-io/karmada/pkg/generated/clientset/versioned/typed/cluster/v1alpha1" fakeclusterv1alpha1 "github.com/karmada-io/karmada/pkg/generated/clientset/versioned/typed/cluster/v1alpha1/fake" + commandv1alpha1 "github.com/karmada-io/karmada/pkg/generated/clientset/versioned/typed/command/v1alpha1" + fakecommandv1alpha1 "github.com/karmada-io/karmada/pkg/generated/clientset/versioned/typed/command/v1alpha1/fake" configv1alpha1 "github.com/karmada-io/karmada/pkg/generated/clientset/versioned/typed/config/v1alpha1" fakeconfigv1alpha1 "github.com/karmada-io/karmada/pkg/generated/clientset/versioned/typed/config/v1alpha1/fake" networkingv1alpha1 "github.com/karmada-io/karmada/pkg/generated/clientset/versioned/typed/networking/v1alpha1" @@ -105,6 +107,11 @@ func (c *Clientset) ClusterV1alpha1() clusterv1alpha1.ClusterV1alpha1Interface { return &fakeclusterv1alpha1.FakeClusterV1alpha1{Fake: &c.Fake} } +// CommandV1alpha1 retrieves the CommandV1alpha1Client +func (c *Clientset) CommandV1alpha1() commandv1alpha1.CommandV1alpha1Interface { + return &fakecommandv1alpha1.FakeCommandV1alpha1{Fake: &c.Fake} +} + // ConfigV1alpha1 retrieves the ConfigV1alpha1Client func (c *Clientset) ConfigV1alpha1() configv1alpha1.ConfigV1alpha1Interface { return &fakeconfigv1alpha1.FakeConfigV1alpha1{Fake: &c.Fake} diff --git a/pkg/generated/clientset/versioned/fake/register.go b/pkg/generated/clientset/versioned/fake/register.go index a89c6fe3c2da..7048a613dda3 100644 --- a/pkg/generated/clientset/versioned/fake/register.go +++ b/pkg/generated/clientset/versioned/fake/register.go @@ -21,6 +21,7 @@ package fake import ( autoscalingv1alpha1 "github.com/karmada-io/karmada/pkg/apis/autoscaling/v1alpha1" clusterv1alpha1 "github.com/karmada-io/karmada/pkg/apis/cluster/v1alpha1" + commandv1alpha1 "github.com/karmada-io/karmada/pkg/apis/command/v1alpha1" configv1alpha1 "github.com/karmada-io/karmada/pkg/apis/config/v1alpha1" networkingv1alpha1 "github.com/karmada-io/karmada/pkg/apis/networking/v1alpha1" policyv1alpha1 "github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1" @@ -41,6 +42,7 @@ var codecs = serializer.NewCodecFactory(scheme) var localSchemeBuilder = runtime.SchemeBuilder{ autoscalingv1alpha1.AddToScheme, clusterv1alpha1.AddToScheme, + commandv1alpha1.AddToScheme, configv1alpha1.AddToScheme, networkingv1alpha1.AddToScheme, policyv1alpha1.AddToScheme, diff --git a/pkg/generated/clientset/versioned/scheme/register.go b/pkg/generated/clientset/versioned/scheme/register.go index e5d3cae1b722..66c2789c85fc 100644 --- a/pkg/generated/clientset/versioned/scheme/register.go +++ b/pkg/generated/clientset/versioned/scheme/register.go @@ -21,6 +21,7 @@ package scheme import ( autoscalingv1alpha1 "github.com/karmada-io/karmada/pkg/apis/autoscaling/v1alpha1" clusterv1alpha1 "github.com/karmada-io/karmada/pkg/apis/cluster/v1alpha1" + commandv1alpha1 "github.com/karmada-io/karmada/pkg/apis/command/v1alpha1" configv1alpha1 "github.com/karmada-io/karmada/pkg/apis/config/v1alpha1" networkingv1alpha1 "github.com/karmada-io/karmada/pkg/apis/networking/v1alpha1" policyv1alpha1 "github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1" @@ -41,6 +42,7 @@ var ParameterCodec = runtime.NewParameterCodec(Scheme) var localSchemeBuilder = runtime.SchemeBuilder{ autoscalingv1alpha1.AddToScheme, clusterv1alpha1.AddToScheme, + commandv1alpha1.AddToScheme, configv1alpha1.AddToScheme, networkingv1alpha1.AddToScheme, policyv1alpha1.AddToScheme, diff --git a/pkg/generated/clientset/versioned/typed/command/v1alpha1/command_client.go b/pkg/generated/clientset/versioned/typed/command/v1alpha1/command_client.go new file mode 100644 index 000000000000..841bd159a6cd --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/command/v1alpha1/command_client.go @@ -0,0 +1,107 @@ +/* +Copyright The Karmada Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "net/http" + + v1alpha1 "github.com/karmada-io/karmada/pkg/apis/command/v1alpha1" + "github.com/karmada-io/karmada/pkg/generated/clientset/versioned/scheme" + rest "k8s.io/client-go/rest" +) + +type CommandV1alpha1Interface interface { + RESTClient() rest.Interface + ReschedulesGetter +} + +// CommandV1alpha1Client is used to interact with features provided by the command.karmada.io group. +type CommandV1alpha1Client struct { + restClient rest.Interface +} + +func (c *CommandV1alpha1Client) Reschedules() RescheduleInterface { + return newReschedules(c) +} + +// NewForConfig creates a new CommandV1alpha1Client for the given config. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*CommandV1alpha1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + httpClient, err := rest.HTTPClientFor(&config) + if err != nil { + return nil, err + } + return NewForConfigAndClient(&config, httpClient) +} + +// NewForConfigAndClient creates a new CommandV1alpha1Client for the given config and http client. +// Note the http client provided takes precedence over the configured transport values. +func NewForConfigAndClient(c *rest.Config, h *http.Client) (*CommandV1alpha1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientForConfigAndClient(&config, h) + if err != nil { + return nil, err + } + return &CommandV1alpha1Client{client}, nil +} + +// NewForConfigOrDie creates a new CommandV1alpha1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *CommandV1alpha1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new CommandV1alpha1Client for the given RESTClient. +func New(c rest.Interface) *CommandV1alpha1Client { + return &CommandV1alpha1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1alpha1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *CommandV1alpha1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/generated/clientset/versioned/typed/command/v1alpha1/doc.go b/pkg/generated/clientset/versioned/typed/command/v1alpha1/doc.go new file mode 100644 index 000000000000..d7702a120bf6 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/command/v1alpha1/doc.go @@ -0,0 +1,20 @@ +/* +Copyright The Karmada Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1alpha1 diff --git a/pkg/generated/clientset/versioned/typed/command/v1alpha1/fake/doc.go b/pkg/generated/clientset/versioned/typed/command/v1alpha1/fake/doc.go new file mode 100644 index 000000000000..3a0e6b07dfb0 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/command/v1alpha1/fake/doc.go @@ -0,0 +1,20 @@ +/* +Copyright The Karmada Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/generated/clientset/versioned/typed/command/v1alpha1/fake/fake_command_client.go b/pkg/generated/clientset/versioned/typed/command/v1alpha1/fake/fake_command_client.go new file mode 100644 index 000000000000..825c53be9737 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/command/v1alpha1/fake/fake_command_client.go @@ -0,0 +1,40 @@ +/* +Copyright The Karmada Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha1 "github.com/karmada-io/karmada/pkg/generated/clientset/versioned/typed/command/v1alpha1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeCommandV1alpha1 struct { + *testing.Fake +} + +func (c *FakeCommandV1alpha1) Reschedules() v1alpha1.RescheduleInterface { + return &FakeReschedules{c} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeCommandV1alpha1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/generated/clientset/versioned/typed/command/v1alpha1/fake/fake_reschedule.go b/pkg/generated/clientset/versioned/typed/command/v1alpha1/fake/fake_reschedule.go new file mode 100644 index 000000000000..23722a1d5adb --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/command/v1alpha1/fake/fake_reschedule.go @@ -0,0 +1,121 @@ +/* +Copyright The Karmada Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + v1alpha1 "github.com/karmada-io/karmada/pkg/apis/command/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeReschedules implements RescheduleInterface +type FakeReschedules struct { + Fake *FakeCommandV1alpha1 +} + +var reschedulesResource = v1alpha1.SchemeGroupVersion.WithResource("reschedules") + +var reschedulesKind = v1alpha1.SchemeGroupVersion.WithKind("Reschedule") + +// Get takes name of the reschedule, and returns the corresponding reschedule object, and an error if there is any. +func (c *FakeReschedules) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Reschedule, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(reschedulesResource, name), &v1alpha1.Reschedule{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.Reschedule), err +} + +// List takes label and field selectors, and returns the list of Reschedules that match those selectors. +func (c *FakeReschedules) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.RescheduleList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(reschedulesResource, reschedulesKind, opts), &v1alpha1.RescheduleList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.RescheduleList{ListMeta: obj.(*v1alpha1.RescheduleList).ListMeta} + for _, item := range obj.(*v1alpha1.RescheduleList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested reschedules. +func (c *FakeReschedules) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(reschedulesResource, opts)) +} + +// Create takes the representation of a reschedule and creates it. Returns the server's representation of the reschedule, and an error, if there is any. +func (c *FakeReschedules) Create(ctx context.Context, reschedule *v1alpha1.Reschedule, opts v1.CreateOptions) (result *v1alpha1.Reschedule, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(reschedulesResource, reschedule), &v1alpha1.Reschedule{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.Reschedule), err +} + +// Update takes the representation of a reschedule and updates it. Returns the server's representation of the reschedule, and an error, if there is any. +func (c *FakeReschedules) Update(ctx context.Context, reschedule *v1alpha1.Reschedule, opts v1.UpdateOptions) (result *v1alpha1.Reschedule, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(reschedulesResource, reschedule), &v1alpha1.Reschedule{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.Reschedule), err +} + +// Delete takes name of the reschedule and deletes it. Returns an error if one occurs. +func (c *FakeReschedules) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteActionWithOptions(reschedulesResource, name, opts), &v1alpha1.Reschedule{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeReschedules) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(reschedulesResource, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.RescheduleList{}) + return err +} + +// Patch applies the patch and returns the patched reschedule. +func (c *FakeReschedules) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Reschedule, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(reschedulesResource, name, pt, data, subresources...), &v1alpha1.Reschedule{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.Reschedule), err +} diff --git a/pkg/generated/clientset/versioned/typed/command/v1alpha1/generated_expansion.go b/pkg/generated/clientset/versioned/typed/command/v1alpha1/generated_expansion.go new file mode 100644 index 000000000000..4764b94bb260 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/command/v1alpha1/generated_expansion.go @@ -0,0 +1,21 @@ +/* +Copyright The Karmada Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +type RescheduleExpansion interface{} diff --git a/pkg/generated/clientset/versioned/typed/command/v1alpha1/reschedule.go b/pkg/generated/clientset/versioned/typed/command/v1alpha1/reschedule.go new file mode 100644 index 000000000000..46ef5be4e442 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/command/v1alpha1/reschedule.go @@ -0,0 +1,168 @@ +/* +Copyright The Karmada Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + "time" + + v1alpha1 "github.com/karmada-io/karmada/pkg/apis/command/v1alpha1" + scheme "github.com/karmada-io/karmada/pkg/generated/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// ReschedulesGetter has a method to return a RescheduleInterface. +// A group's client should implement this interface. +type ReschedulesGetter interface { + Reschedules() RescheduleInterface +} + +// RescheduleInterface has methods to work with Reschedule resources. +type RescheduleInterface interface { + Create(ctx context.Context, reschedule *v1alpha1.Reschedule, opts v1.CreateOptions) (*v1alpha1.Reschedule, error) + Update(ctx context.Context, reschedule *v1alpha1.Reschedule, opts v1.UpdateOptions) (*v1alpha1.Reschedule, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.Reschedule, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.RescheduleList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Reschedule, err error) + RescheduleExpansion +} + +// reschedules implements RescheduleInterface +type reschedules struct { + client rest.Interface +} + +// newReschedules returns a Reschedules +func newReschedules(c *CommandV1alpha1Client) *reschedules { + return &reschedules{ + client: c.RESTClient(), + } +} + +// Get takes name of the reschedule, and returns the corresponding reschedule object, and an error if there is any. +func (c *reschedules) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Reschedule, err error) { + result = &v1alpha1.Reschedule{} + err = c.client.Get(). + Resource("reschedules"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Reschedules that match those selectors. +func (c *reschedules) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.RescheduleList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1alpha1.RescheduleList{} + err = c.client.Get(). + Resource("reschedules"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested reschedules. +func (c *reschedules) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Resource("reschedules"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a reschedule and creates it. Returns the server's representation of the reschedule, and an error, if there is any. +func (c *reschedules) Create(ctx context.Context, reschedule *v1alpha1.Reschedule, opts v1.CreateOptions) (result *v1alpha1.Reschedule, err error) { + result = &v1alpha1.Reschedule{} + err = c.client.Post(). + Resource("reschedules"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(reschedule). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a reschedule and updates it. Returns the server's representation of the reschedule, and an error, if there is any. +func (c *reschedules) Update(ctx context.Context, reschedule *v1alpha1.Reschedule, opts v1.UpdateOptions) (result *v1alpha1.Reschedule, err error) { + result = &v1alpha1.Reschedule{} + err = c.client.Put(). + Resource("reschedules"). + Name(reschedule.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(reschedule). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the reschedule and deletes it. Returns an error if one occurs. +func (c *reschedules) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Resource("reschedules"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *reschedules) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Resource("reschedules"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched reschedule. +func (c *reschedules) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Reschedule, err error) { + result = &v1alpha1.Reschedule{} + err = c.client.Patch(pt). + Resource("reschedules"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/generated/informers/externalversions/command/interface.go b/pkg/generated/informers/externalversions/command/interface.go new file mode 100644 index 000000000000..d615427ef20e --- /dev/null +++ b/pkg/generated/informers/externalversions/command/interface.go @@ -0,0 +1,46 @@ +/* +Copyright The Karmada Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package command + +import ( + v1alpha1 "github.com/karmada-io/karmada/pkg/generated/informers/externalversions/command/v1alpha1" + internalinterfaces "github.com/karmada-io/karmada/pkg/generated/informers/externalversions/internalinterfaces" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1alpha1 provides access to shared informers for resources in V1alpha1. + V1alpha1() v1alpha1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1alpha1 returns a new v1alpha1.Interface. +func (g *group) V1alpha1() v1alpha1.Interface { + return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/pkg/generated/informers/externalversions/command/v1alpha1/interface.go b/pkg/generated/informers/externalversions/command/v1alpha1/interface.go new file mode 100644 index 000000000000..7a199d2116c8 --- /dev/null +++ b/pkg/generated/informers/externalversions/command/v1alpha1/interface.go @@ -0,0 +1,45 @@ +/* +Copyright The Karmada Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + internalinterfaces "github.com/karmada-io/karmada/pkg/generated/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // Reschedules returns a RescheduleInformer. + Reschedules() RescheduleInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// Reschedules returns a RescheduleInformer. +func (v *version) Reschedules() RescheduleInformer { + return &rescheduleInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/pkg/generated/informers/externalversions/command/v1alpha1/reschedule.go b/pkg/generated/informers/externalversions/command/v1alpha1/reschedule.go new file mode 100644 index 000000000000..941e3f17c93d --- /dev/null +++ b/pkg/generated/informers/externalversions/command/v1alpha1/reschedule.go @@ -0,0 +1,89 @@ +/* +Copyright The Karmada Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + commandv1alpha1 "github.com/karmada-io/karmada/pkg/apis/command/v1alpha1" + versioned "github.com/karmada-io/karmada/pkg/generated/clientset/versioned" + internalinterfaces "github.com/karmada-io/karmada/pkg/generated/informers/externalversions/internalinterfaces" + v1alpha1 "github.com/karmada-io/karmada/pkg/generated/listers/command/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// RescheduleInformer provides access to a shared informer and lister for +// Reschedules. +type RescheduleInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.RescheduleLister +} + +type rescheduleInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewRescheduleInformer constructs a new informer for Reschedule type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewRescheduleInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredRescheduleInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredRescheduleInformer constructs a new informer for Reschedule type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredRescheduleInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CommandV1alpha1().Reschedules().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CommandV1alpha1().Reschedules().Watch(context.TODO(), options) + }, + }, + &commandv1alpha1.Reschedule{}, + resyncPeriod, + indexers, + ) +} + +func (f *rescheduleInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredRescheduleInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *rescheduleInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&commandv1alpha1.Reschedule{}, f.defaultInformer) +} + +func (f *rescheduleInformer) Lister() v1alpha1.RescheduleLister { + return v1alpha1.NewRescheduleLister(f.Informer().GetIndexer()) +} diff --git a/pkg/generated/informers/externalversions/factory.go b/pkg/generated/informers/externalversions/factory.go index fb3feb1f23bc..54da91357822 100644 --- a/pkg/generated/informers/externalversions/factory.go +++ b/pkg/generated/informers/externalversions/factory.go @@ -26,6 +26,7 @@ import ( versioned "github.com/karmada-io/karmada/pkg/generated/clientset/versioned" autoscaling "github.com/karmada-io/karmada/pkg/generated/informers/externalversions/autoscaling" cluster "github.com/karmada-io/karmada/pkg/generated/informers/externalversions/cluster" + command "github.com/karmada-io/karmada/pkg/generated/informers/externalversions/command" config "github.com/karmada-io/karmada/pkg/generated/informers/externalversions/config" internalinterfaces "github.com/karmada-io/karmada/pkg/generated/informers/externalversions/internalinterfaces" networking "github.com/karmada-io/karmada/pkg/generated/informers/externalversions/networking" @@ -252,6 +253,7 @@ type SharedInformerFactory interface { Autoscaling() autoscaling.Interface Cluster() cluster.Interface + Command() command.Interface Config() config.Interface Networking() networking.Interface Policy() policy.Interface @@ -268,6 +270,10 @@ func (f *sharedInformerFactory) Cluster() cluster.Interface { return cluster.New(f, f.namespace, f.tweakListOptions) } +func (f *sharedInformerFactory) Command() command.Interface { + return command.New(f, f.namespace, f.tweakListOptions) +} + func (f *sharedInformerFactory) Config() config.Interface { return config.New(f, f.namespace, f.tweakListOptions) } diff --git a/pkg/generated/informers/externalversions/generic.go b/pkg/generated/informers/externalversions/generic.go index db1d70ed164c..8c9ee38c1b98 100644 --- a/pkg/generated/informers/externalversions/generic.go +++ b/pkg/generated/informers/externalversions/generic.go @@ -23,6 +23,7 @@ import ( v1alpha1 "github.com/karmada-io/karmada/pkg/apis/autoscaling/v1alpha1" clusterv1alpha1 "github.com/karmada-io/karmada/pkg/apis/cluster/v1alpha1" + commandv1alpha1 "github.com/karmada-io/karmada/pkg/apis/command/v1alpha1" configv1alpha1 "github.com/karmada-io/karmada/pkg/apis/config/v1alpha1" networkingv1alpha1 "github.com/karmada-io/karmada/pkg/apis/networking/v1alpha1" policyv1alpha1 "github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1" @@ -70,6 +71,10 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource case clusterv1alpha1.SchemeGroupVersion.WithResource("clusters"): return &genericInformer{resource: resource.GroupResource(), informer: f.Cluster().V1alpha1().Clusters().Informer()}, nil + // Group=command.karmada.io, Version=v1alpha1 + case commandv1alpha1.SchemeGroupVersion.WithResource("reschedules"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Command().V1alpha1().Reschedules().Informer()}, nil + // Group=config.karmada.io, Version=v1alpha1 case configv1alpha1.SchemeGroupVersion.WithResource("resourceinterpretercustomizations"): return &genericInformer{resource: resource.GroupResource(), informer: f.Config().V1alpha1().ResourceInterpreterCustomizations().Informer()}, nil diff --git a/pkg/generated/listers/command/v1alpha1/expansion_generated.go b/pkg/generated/listers/command/v1alpha1/expansion_generated.go new file mode 100644 index 000000000000..485c123b58c3 --- /dev/null +++ b/pkg/generated/listers/command/v1alpha1/expansion_generated.go @@ -0,0 +1,23 @@ +/* +Copyright The Karmada Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +// RescheduleListerExpansion allows custom methods to be added to +// RescheduleLister. +type RescheduleListerExpansion interface{} diff --git a/pkg/generated/listers/command/v1alpha1/reschedule.go b/pkg/generated/listers/command/v1alpha1/reschedule.go new file mode 100644 index 000000000000..0eaeaaabe743 --- /dev/null +++ b/pkg/generated/listers/command/v1alpha1/reschedule.go @@ -0,0 +1,68 @@ +/* +Copyright The Karmada Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/karmada-io/karmada/pkg/apis/command/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// RescheduleLister helps list Reschedules. +// All objects returned here must be treated as read-only. +type RescheduleLister interface { + // List lists all Reschedules in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.Reschedule, err error) + // Get retrieves the Reschedule from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.Reschedule, error) + RescheduleListerExpansion +} + +// rescheduleLister implements the RescheduleLister interface. +type rescheduleLister struct { + indexer cache.Indexer +} + +// NewRescheduleLister returns a new RescheduleLister. +func NewRescheduleLister(indexer cache.Indexer) RescheduleLister { + return &rescheduleLister{indexer: indexer} +} + +// List lists all Reschedules in the indexer. +func (s *rescheduleLister) List(selector labels.Selector) (ret []*v1alpha1.Reschedule, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.Reschedule)) + }) + return ret, err +} + +// Get retrieves the Reschedule from the index for a given name. +func (s *rescheduleLister) Get(name string) (*v1alpha1.Reschedule, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("reschedule"), name) + } + return obj.(*v1alpha1.Reschedule), nil +} diff --git a/pkg/generated/openapi/zz_generated.openapi.go b/pkg/generated/openapi/zz_generated.openapi.go old mode 100755 new mode 100644 index 722792e6877c..c9c96eb0b758 --- a/pkg/generated/openapi/zz_generated.openapi.go +++ b/pkg/generated/openapi/zz_generated.openapi.go @@ -57,6 +57,11 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "github.com/karmada-io/karmada/pkg/apis/cluster/v1alpha1.ResourceModel": schema_pkg_apis_cluster_v1alpha1_ResourceModel(ref), "github.com/karmada-io/karmada/pkg/apis/cluster/v1alpha1.ResourceModelRange": schema_pkg_apis_cluster_v1alpha1_ResourceModelRange(ref), "github.com/karmada-io/karmada/pkg/apis/cluster/v1alpha1.ResourceSummary": schema_pkg_apis_cluster_v1alpha1_ResourceSummary(ref), + "github.com/karmada-io/karmada/pkg/apis/command/v1alpha1.PolicySelector": schema_pkg_apis_command_v1alpha1_PolicySelector(ref), + "github.com/karmada-io/karmada/pkg/apis/command/v1alpha1.Reschedule": schema_pkg_apis_command_v1alpha1_Reschedule(ref), + "github.com/karmada-io/karmada/pkg/apis/command/v1alpha1.RescheduleList": schema_pkg_apis_command_v1alpha1_RescheduleList(ref), + "github.com/karmada-io/karmada/pkg/apis/command/v1alpha1.RescheduleSpec": schema_pkg_apis_command_v1alpha1_RescheduleSpec(ref), + "github.com/karmada-io/karmada/pkg/apis/command/v1alpha1.ResourceSelector": schema_pkg_apis_command_v1alpha1_ResourceSelector(ref), "github.com/karmada-io/karmada/pkg/apis/config/v1alpha1.CustomizationRules": schema_pkg_apis_config_v1alpha1_CustomizationRules(ref), "github.com/karmada-io/karmada/pkg/apis/config/v1alpha1.CustomizationTarget": schema_pkg_apis_config_v1alpha1_CustomizationTarget(ref), "github.com/karmada-io/karmada/pkg/apis/config/v1alpha1.DependencyInterpretation": schema_pkg_apis_config_v1alpha1_DependencyInterpretation(ref), @@ -1750,6 +1755,216 @@ func schema_pkg_apis_cluster_v1alpha1_ResourceSummary(ref common.ReferenceCallba } } +func schema_pkg_apis_command_v1alpha1_PolicySelector(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PolicySelector the resources bound policy will be selected.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "Name of the target policy.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "namespace": { + SchemaProps: spec.SchemaProps{ + Description: "Namespace of the target policy. Default is empty, which means it is a cluster propagation policy.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"name"}, + }, + }, + } +} + +func schema_pkg_apis_command_v1alpha1_Reschedule(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Reschedule represents the desire state and status of a task which can enforces a rescheduling.\n\nNotes: make sure the clocks of aggregated-apiserver and scheduler are synchronized when using this API.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + 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/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + 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/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Description: "Spec represents the specification of the desired behavior of Reschedule.", + Default: map[string]interface{}{}, + Ref: ref("github.com/karmada-io/karmada/pkg/apis/command/v1alpha1.RescheduleSpec"), + }, + }, + }, + Required: []string{"spec"}, + }, + }, + Dependencies: []string{ + "github.com/karmada-io/karmada/pkg/apis/command/v1alpha1.RescheduleSpec", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_pkg_apis_command_v1alpha1_RescheduleList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "RescheduleList contains a list of Reschedule", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + 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/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + 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/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Description: "Items holds a list of Reschedule.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/karmada-io/karmada/pkg/apis/command/v1alpha1.Reschedule"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/karmada-io/karmada/pkg/apis/command/v1alpha1.Reschedule", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_pkg_apis_command_v1alpha1_RescheduleSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "RescheduleSpec represents the specification of the desired behavior of Reschedule.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "targetRefPolicy": { + SchemaProps: spec.SchemaProps{ + Description: "TargetRefPolicy used to select batch of resources managed by certain policies.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/karmada-io/karmada/pkg/apis/command/v1alpha1.PolicySelector"), + }, + }, + }, + }, + }, + "targetRefResource": { + SchemaProps: spec.SchemaProps{ + Description: "TargetRefResource used to select resources.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/karmada-io/karmada/pkg/apis/command/v1alpha1.ResourceSelector"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/karmada-io/karmada/pkg/apis/command/v1alpha1.PolicySelector", "github.com/karmada-io/karmada/pkg/apis/command/v1alpha1.ResourceSelector"}, + } +} + +func schema_pkg_apis_command_v1alpha1_ResourceSelector(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ResourceSelector the resource will be selected.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion represents the API version of the target resource.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind represents the Kind of the target resource.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "name": { + SchemaProps: spec.SchemaProps{ + Description: "Name of the target resource.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "namespace": { + SchemaProps: spec.SchemaProps{ + Description: "Namespace of the target resource. Default is empty, which means it is a non-namespacescoped resource.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"apiVersion", "kind", "name"}, + }, + }, + } +} + func schema_pkg_apis_config_v1alpha1_CustomizationRules(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -6748,12 +6963,19 @@ func schema_pkg_apis_work_v1alpha2_ResourceBindingSpec(ref common.ReferenceCallb Format: "", }, }, + "rescheduleTriggeredAt": { + SchemaProps: spec.SchemaProps{ + Description: "RescheduleTriggeredAt is a timestamp representing when the referenced resource is triggered rescheduling. Only when this timestamp is later than timestamp in status.rescheduledAt will the rescheduling actually execute.\n\nIt is represented in RFC3339 form (like '2006-01-02T15:04:05Z') and is in UTC. It is recommended to be populated by the REST handler of command.karmada.io/Reschedule API.", + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), + }, + }, }, Required: []string{"resource"}, }, }, Dependencies: []string{ - "github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1.FailoverBehavior", "github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1.Placement", "github.com/karmada-io/karmada/pkg/apis/work/v1alpha2.BindingSnapshot", "github.com/karmada-io/karmada/pkg/apis/work/v1alpha2.GracefulEvictionTask", "github.com/karmada-io/karmada/pkg/apis/work/v1alpha2.ObjectReference", "github.com/karmada-io/karmada/pkg/apis/work/v1alpha2.ReplicaRequirements", "github.com/karmada-io/karmada/pkg/apis/work/v1alpha2.TargetCluster"}, + "github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1.FailoverBehavior", "github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1.Placement", "github.com/karmada-io/karmada/pkg/apis/work/v1alpha2.BindingSnapshot", "github.com/karmada-io/karmada/pkg/apis/work/v1alpha2.GracefulEvictionTask", "github.com/karmada-io/karmada/pkg/apis/work/v1alpha2.ObjectReference", "github.com/karmada-io/karmada/pkg/apis/work/v1alpha2.ReplicaRequirements", "github.com/karmada-io/karmada/pkg/apis/work/v1alpha2.TargetCluster", "k8s.io/apimachinery/pkg/apis/meta/v1.Time"}, } } @@ -6778,6 +7000,13 @@ func schema_pkg_apis_work_v1alpha2_ResourceBindingStatus(ref common.ReferenceCal Format: "", }, }, + "lastScheduledTime": { + SchemaProps: spec.SchemaProps{ + Description: "LastScheduledTime is a timestamp representing scheduler successfully finished a scheduling. It is represented in RFC3339 form (like '2006-01-02T15:04:05Z') and is in UTC.", + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), + }, + }, "conditions": { SchemaProps: spec.SchemaProps{ Description: "Conditions contain the different condition statuses.", @@ -6810,7 +7039,7 @@ func schema_pkg_apis_work_v1alpha2_ResourceBindingStatus(ref common.ReferenceCal }, }, Dependencies: []string{ - "github.com/karmada-io/karmada/pkg/apis/work/v1alpha2.AggregatedStatusItem", "k8s.io/apimachinery/pkg/apis/meta/v1.Condition"}, + "github.com/karmada-io/karmada/pkg/apis/work/v1alpha2.AggregatedStatusItem", "k8s.io/apimachinery/pkg/apis/meta/v1.Condition", "k8s.io/apimachinery/pkg/apis/meta/v1.Time"}, } } diff --git a/pkg/util/apigroup.go b/pkg/util/apigroup.go index c7d4ac259c56..28d416da99ca 100644 --- a/pkg/util/apigroup.go +++ b/pkg/util/apigroup.go @@ -26,6 +26,7 @@ import ( autoscalingv1alpha1 "github.com/karmada-io/karmada/pkg/apis/autoscaling/v1alpha1" clusterv1alpha1 "github.com/karmada-io/karmada/pkg/apis/cluster/v1alpha1" + commandv1alpha1 "github.com/karmada-io/karmada/pkg/apis/command/v1alpha1" configv1alpha1 "github.com/karmada-io/karmada/pkg/apis/config/v1alpha1" networkingv1alpha1 "github.com/karmada-io/karmada/pkg/apis/networking/v1alpha1" policyv1alpha1 "github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1" @@ -58,6 +59,7 @@ func NewSkippedResourceConfig() *SkippedResourceConfig { } // disable karmada group by default r.DisableGroup(clusterv1alpha1.GroupVersion.Group) + r.DisableGroup(commandv1alpha1.GroupVersion.Group) r.DisableGroup(policyv1alpha1.GroupVersion.Group) r.DisableGroup(workv1alpha1.GroupVersion.Group) r.DisableGroup(configv1alpha1.GroupVersion.Group) diff --git a/pkg/util/gclient/gclient.go b/pkg/util/gclient/gclient.go index c089136a0c58..232a2e5c38a3 100644 --- a/pkg/util/gclient/gclient.go +++ b/pkg/util/gclient/gclient.go @@ -27,6 +27,7 @@ import ( autoscalingv1alpha1 "github.com/karmada-io/karmada/pkg/apis/autoscaling/v1alpha1" clusterv1alpha1 "github.com/karmada-io/karmada/pkg/apis/cluster/v1alpha1" + commandv1alpha1 "github.com/karmada-io/karmada/pkg/apis/command/v1alpha1" configv1alpha1 "github.com/karmada-io/karmada/pkg/apis/config/v1alpha1" networkingv1alpha1 "github.com/karmada-io/karmada/pkg/apis/networking/v1alpha1" policyv1alpha1 "github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1" @@ -42,6 +43,7 @@ var aggregatedScheme = runtime.NewScheme() func init() { utilruntime.Must(scheme.AddToScheme(aggregatedScheme)) // add Kubernetes schemes utilruntime.Must(clusterv1alpha1.AddToScheme(aggregatedScheme)) // add cluster schemes + utilruntime.Must(commandv1alpha1.AddToScheme(aggregatedScheme)) // add task schemes utilruntime.Must(configv1alpha1.AddToScheme(aggregatedScheme)) // add config v1alpha1 schemes utilruntime.Must(networkingv1alpha1.AddToScheme(aggregatedScheme)) // add network v1alpha1 schemes utilruntime.Must(policyv1alpha1.AddToScheme(aggregatedScheme)) // add propagation schemes