From 2db3ca26299fdc6bb48f6e3ad6394c66a9db5b60 Mon Sep 17 00:00:00 2001 From: changzhen Date: Mon, 4 Mar 2024 19:43:21 +0800 Subject: [PATCH] add remedy api in the swagger.json Signed-off-by: changzhen --- api/openapi-spec/swagger.json | 990 ++++++++++++++++++ hack/tools/swagger/generateswagger.go | 6 + hack/update-codegen.sh | 1 + .../remedy/v1alpha1/well_known_constants.go | 28 + pkg/generated/openapi/zz_generated.openapi.go | 235 +++++ 5 files changed, 1260 insertions(+) create mode 100644 pkg/apis/remedy/v1alpha1/well_known_constants.go diff --git a/api/openapi-spec/swagger.json b/api/openapi-spec/swagger.json index 1e0d401f4..f6ba791bb 100644 --- a/api/openapi-spec/swagger.json +++ b/api/openapi-spec/swagger.json @@ -11324,6 +11324,852 @@ } ] }, + "/apis/remedy.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": [ + "remedyKarmadaIo" + ], + "operationId": "getRemedyKarmadaIoAPIGroup", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.APIGroup" + } + } + } + } + }, + "/apis/remedy.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": [ + "remedyKarmadaIo_v1alpha1" + ], + "operationId": "getRemedyKarmadaIoV1alpha1APIResources", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.APIResourceList" + } + } + } + } + }, + "/apis/remedy.karmada.io/v1alpha1/remedies": { + "get": { + "description": "list or watch objects of kind Remedy", + "consumes": [ + "*/*" + ], + "produces": [ + "application/json", + "application/yaml", + "application/vnd.kubernetes.protobuf", + "application/json;stream=watch", + "application/vnd.kubernetes.protobuf;stream=watch" + ], + "schemes": [ + "https" + ], + "tags": [ + "remedyKarmadaIo_v1alpha1" + ], + "operationId": "listRemedyKarmadaIoV1alpha1Remedy", + "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.remedy.v1alpha1.RemedyList" + } + } + }, + "x-kubernetes-action": "list", + "x-kubernetes-group-version-kind": { + "group": "remedy.karmada.io", + "version": "v1alpha1", + "kind": "Remedy" + } + }, + "post": { + "description": "create a Remedy", + "consumes": [ + "*/*" + ], + "produces": [ + "application/json", + "application/yaml", + "application/vnd.kubernetes.protobuf" + ], + "schemes": [ + "https" + ], + "tags": [ + "remedyKarmadaIo_v1alpha1" + ], + "operationId": "createRemedyKarmadaIoV1alpha1Remedy", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.remedy.v1alpha1.Remedy" + } + }, + { + "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.remedy.v1alpha1.Remedy" + } + }, + "201": { + "description": "Created", + "schema": { + "$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.remedy.v1alpha1.Remedy" + } + }, + "202": { + "description": "Accepted", + "schema": { + "$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.remedy.v1alpha1.Remedy" + } + } + }, + "x-kubernetes-action": "post", + "x-kubernetes-group-version-kind": { + "group": "remedy.karmada.io", + "version": "v1alpha1", + "kind": "Remedy" + } + }, + "delete": { + "description": "delete collection of Remedy", + "consumes": [ + "*/*" + ], + "produces": [ + "application/json", + "application/yaml", + "application/vnd.kubernetes.protobuf" + ], + "schemes": [ + "https" + ], + "tags": [ + "remedyKarmadaIo_v1alpha1" + ], + "operationId": "deleteRemedyKarmadaIoV1alpha1CollectionRemedy", + "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": "remedy.karmada.io", + "version": "v1alpha1", + "kind": "Remedy" + } + }, + "parameters": [ + { + "$ref": "#/parameters/pretty-nN7o5FEq" + } + ] + }, + "/apis/remedy.karmada.io/v1alpha1/remedies/{name}": { + "get": { + "description": "read the specified Remedy", + "consumes": [ + "*/*" + ], + "produces": [ + "application/json", + "application/yaml", + "application/vnd.kubernetes.protobuf" + ], + "schemes": [ + "https" + ], + "tags": [ + "remedyKarmadaIo_v1alpha1" + ], + "operationId": "readRemedyKarmadaIoV1alpha1Remedy", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.remedy.v1alpha1.Remedy" + } + } + }, + "x-kubernetes-action": "get", + "x-kubernetes-group-version-kind": { + "group": "remedy.karmada.io", + "version": "v1alpha1", + "kind": "Remedy" + } + }, + "put": { + "description": "replace the specified Remedy", + "consumes": [ + "*/*" + ], + "produces": [ + "application/json", + "application/yaml", + "application/vnd.kubernetes.protobuf" + ], + "schemes": [ + "https" + ], + "tags": [ + "remedyKarmadaIo_v1alpha1" + ], + "operationId": "replaceRemedyKarmadaIoV1alpha1Remedy", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.remedy.v1alpha1.Remedy" + } + }, + { + "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.remedy.v1alpha1.Remedy" + } + }, + "201": { + "description": "Created", + "schema": { + "$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.remedy.v1alpha1.Remedy" + } + } + }, + "x-kubernetes-action": "put", + "x-kubernetes-group-version-kind": { + "group": "remedy.karmada.io", + "version": "v1alpha1", + "kind": "Remedy" + } + }, + "delete": { + "description": "delete a Remedy", + "consumes": [ + "*/*" + ], + "produces": [ + "application/json", + "application/yaml", + "application/vnd.kubernetes.protobuf" + ], + "schemes": [ + "https" + ], + "tags": [ + "remedyKarmadaIo_v1alpha1" + ], + "operationId": "deleteRemedyKarmadaIoV1alpha1Remedy", + "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": "remedy.karmada.io", + "version": "v1alpha1", + "kind": "Remedy" + } + }, + "patch": { + "description": "partially update the specified Remedy", + "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": [ + "remedyKarmadaIo_v1alpha1" + ], + "operationId": "patchRemedyKarmadaIoV1alpha1Remedy", + "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.remedy.v1alpha1.Remedy" + } + }, + "201": { + "description": "Created", + "schema": { + "$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.remedy.v1alpha1.Remedy" + } + } + }, + "x-kubernetes-action": "patch", + "x-kubernetes-group-version-kind": { + "group": "remedy.karmada.io", + "version": "v1alpha1", + "kind": "Remedy" + } + }, + "parameters": [ + { + "uniqueItems": true, + "type": "string", + "description": "name of the Remedy", + "name": "name", + "in": "path", + "required": true + }, + { + "$ref": "#/parameters/pretty-nN7o5FEq" + } + ] + }, + "/apis/remedy.karmada.io/v1alpha1/remedies/{name}/status": { + "get": { + "description": "read status of the specified Remedy", + "consumes": [ + "*/*" + ], + "produces": [ + "application/json", + "application/yaml", + "application/vnd.kubernetes.protobuf" + ], + "schemes": [ + "https" + ], + "tags": [ + "remedyKarmadaIo_v1alpha1" + ], + "operationId": "readRemedyKarmadaIoV1alpha1RemedyStatus", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.remedy.v1alpha1.Remedy" + } + } + }, + "x-kubernetes-action": "get", + "x-kubernetes-group-version-kind": { + "group": "remedy.karmada.io", + "version": "v1alpha1", + "kind": "Remedy" + } + }, + "put": { + "description": "replace status of the specified Remedy", + "consumes": [ + "*/*" + ], + "produces": [ + "application/json", + "application/yaml", + "application/vnd.kubernetes.protobuf" + ], + "schemes": [ + "https" + ], + "tags": [ + "remedyKarmadaIo_v1alpha1" + ], + "operationId": "replaceRemedyKarmadaIoV1alpha1RemedyStatus", + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.remedy.v1alpha1.Remedy" + } + }, + { + "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.remedy.v1alpha1.Remedy" + } + }, + "201": { + "description": "Created", + "schema": { + "$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.remedy.v1alpha1.Remedy" + } + } + }, + "x-kubernetes-action": "put", + "x-kubernetes-group-version-kind": { + "group": "remedy.karmada.io", + "version": "v1alpha1", + "kind": "Remedy" + } + }, + "patch": { + "description": "partially update status of the specified Remedy", + "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": [ + "remedyKarmadaIo_v1alpha1" + ], + "operationId": "patchRemedyKarmadaIoV1alpha1RemedyStatus", + "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.remedy.v1alpha1.Remedy" + } + }, + "201": { + "description": "Created", + "schema": { + "$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.remedy.v1alpha1.Remedy" + } + } + }, + "x-kubernetes-action": "patch", + "x-kubernetes-group-version-kind": { + "group": "remedy.karmada.io", + "version": "v1alpha1", + "kind": "Remedy" + } + }, + "parameters": [ + { + "uniqueItems": true, + "type": "string", + "description": "name of the Remedy", + "name": "name", + "in": "path", + "required": true + }, + { + "$ref": "#/parameters/pretty-nN7o5FEq" + } + ] + }, + "/apis/remedy.karmada.io/v1alpha1/watch/remedies": { + "get": { + "description": "watch individual changes to a list of Remedy. 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": [ + "remedyKarmadaIo_v1alpha1" + ], + "operationId": "watchRemedyKarmadaIoV1alpha1RemedyList", + "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": "remedy.karmada.io", + "version": "v1alpha1", + "kind": "Remedy" + } + }, + "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/remedy.karmada.io/v1alpha1/watch/remedies/{name}": { + "get": { + "description": "watch changes to an object of kind Remedy. 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": [ + "remedyKarmadaIo_v1alpha1" + ], + "operationId": "watchRemedyKarmadaIoV1alpha1Remedy", + "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": "remedy.karmada.io", + "version": "v1alpha1", + "kind": "Remedy" + } + }, + "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 Remedy", + "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/search.karmada.io/": { "get": { "description": "get information of a group", @@ -17401,6 +18247,150 @@ } } }, + "com.github.karmada-io.karmada.pkg.apis.remedy.v1alpha1.ClusterAffinity": { + "description": "ClusterAffinity represents the filter to select clusters.", + "type": "object", + "properties": { + "clusterNames": { + "description": "ClusterNames is the list of clusters to be selected.", + "type": "array", + "items": { + "type": "string", + "default": "" + } + } + } + }, + "com.github.karmada-io.karmada.pkg.apis.remedy.v1alpha1.ClusterConditionRequirement": { + "description": "ClusterConditionRequirement describes the Cluster condition requirement details.", + "type": "object", + "required": [ + "conditionType", + "operator", + "conditionStatus" + ], + "properties": { + "conditionStatus": { + "description": "ConditionStatus specifies the ClusterStatue condition status.", + "type": "string", + "default": "" + }, + "conditionType": { + "description": "ConditionType specifies the ClusterStatus condition type.", + "type": "string", + "default": "" + }, + "operator": { + "description": "Operator represents a conditionType's relationship to a conditionStatus. Valid operators are Equal, NotEqual.", + "type": "string", + "default": "" + } + } + }, + "com.github.karmada-io.karmada.pkg.apis.remedy.v1alpha1.DecisionMatch": { + "description": "DecisionMatch represents the decision match detail of activating the remedy system.", + "type": "object", + "properties": { + "clusterConditionMatch": { + "description": "ClusterConditionMatch describes the cluster condition requirement.", + "$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.remedy.v1alpha1.ClusterConditionRequirement" + } + } + }, + "com.github.karmada-io.karmada.pkg.apis.remedy.v1alpha1.Remedy": { + "description": "Remedy represents the cluster-level management strategies based on cluster conditions.", + "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 desired behavior of Remedy.", + "default": {}, + "$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.remedy.v1alpha1.RemedySpec" + } + }, + "x-kubernetes-group-version-kind": [ + { + "group": "remedy.karmada.io", + "kind": "Remedy", + "version": "v1alpha1" + } + ] + }, + "com.github.karmada-io.karmada.pkg.apis.remedy.v1alpha1.RemedyList": { + "description": "RemedyList contains a list of Remedy.", + "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": { + "type": "array", + "items": { + "default": {}, + "$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.remedy.v1alpha1.Remedy" + } + }, + "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": "remedy.karmada.io", + "kind": "RemedyList", + "version": "v1alpha1" + } + ] + }, + "com.github.karmada-io.karmada.pkg.apis.remedy.v1alpha1.RemedySpec": { + "description": "RemedySpec represents the desired behavior of Remedy.", + "type": "object", + "properties": { + "actions": { + "description": "Actions specifies the actions that remedy system needs to perform. If empty, no action will be performed.", + "type": "array", + "items": { + "type": "string", + "default": "" + } + }, + "clusterAffinity": { + "description": "ClusterAffinity specifies the clusters that Remedy needs to pay attention to. For clusters that meet the DecisionConditions, Actions will be preformed. If empty, all clusters will be selected.", + "$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.remedy.v1alpha1.ClusterAffinity" + }, + "decisionMatches": { + "description": "DecisionMatches indicates the decision matches of triggering the remedy system to perform the actions. As long as any one DecisionMatch matches, the Actions will be preformed. If empty, the Actions will be performed immediately.", + "type": "array", + "items": { + "default": {}, + "$ref": "#/definitions/com.github.karmada-io.karmada.pkg.apis.remedy.v1alpha1.DecisionMatch" + } + } + } + }, "com.github.karmada-io.karmada.pkg.apis.search.v1alpha1.BackendStoreConfig": { "description": "BackendStoreConfig specifies backend store.", "type": "object", diff --git a/hack/tools/swagger/generateswagger.go b/hack/tools/swagger/generateswagger.go index e795cfde1..243ddee2a 100644 --- a/hack/tools/swagger/generateswagger.go +++ b/hack/tools/swagger/generateswagger.go @@ -31,6 +31,7 @@ import ( 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" + remedyv1alpha1 "github.com/karmada-io/karmada/pkg/apis/remedy/v1alpha1" searchv1alpha1 "github.com/karmada-io/karmada/pkg/apis/search/v1alpha1" workv1alpha1 "github.com/karmada-io/karmada/pkg/apis/work/v1alpha1" workv1alpha2 "github.com/karmada-io/karmada/pkg/apis/work/v1alpha2" @@ -107,6 +108,10 @@ func main() { autoscalingv1alpha1.SchemeGroupVersion.WithResource(autoscalingv1alpha1.ResourcePluralCronFederatedHPA), autoscalingv1alpha1.SchemeGroupVersion.WithResource(autoscalingv1alpha1.ResourceSingularCronFederatedHPA), meta.RESTScopeRoot) + mapper.AddSpecific(remedyv1alpha1.SchemeGroupVersion.WithKind(remedyv1alpha1.ResourceKindRemedy), + remedyv1alpha1.SchemeGroupVersion.WithResource(remedyv1alpha1.ResourcePluralRemedy), + remedyv1alpha1.SchemeGroupVersion.WithResource(remedyv1alpha1.ResourceSingularRemedy), meta.RESTScopeRoot) + spec, err := lib.RenderOpenAPISpec(lib.Config{ Info: spec.InfoProps{ Title: "Karmada OpenAPI", @@ -139,6 +144,7 @@ func main() { {GVR: searchv1alpha1.SchemeGroupVersion.WithResource(searchv1alpha1.ResourcePluralResourceRegistry), NamespaceScoped: searchv1alpha1.ResourceNamespaceScopedResourceRegistry}, {GVR: autoscalingv1alpha1.SchemeGroupVersion.WithResource(autoscalingv1alpha1.ResourcePluralFederatedHPA), NamespaceScoped: autoscalingv1alpha1.ResourceNamespaceScopedFederatedHPA}, {GVR: autoscalingv1alpha1.SchemeGroupVersion.WithResource(autoscalingv1alpha1.ResourcePluralCronFederatedHPA), NamespaceScoped: autoscalingv1alpha1.ResourceNamespaceScopedCronFederatedHPA}, + {GVR: remedyv1alpha1.SchemeGroupVersion.WithResource(remedyv1alpha1.ResourcePluralRemedy), NamespaceScoped: remedyv1alpha1.ResourceNamespaceScopedRemedy}, }, Mapper: mapper, }) diff --git a/hack/update-codegen.sh b/hack/update-codegen.sh index fcdc9d772..490fb7e39 100755 --- a/hack/update-codegen.sh +++ b/hack/update-codegen.sh @@ -228,6 +228,7 @@ openapi-gen \ --input-dirs "github.com/karmada-io/karmada/pkg/apis/networking/v1alpha1" \ --input-dirs "github.com/karmada-io/karmada/pkg/apis/config/v1alpha1" \ --input-dirs "github.com/karmada-io/karmada/pkg/apis/autoscaling/v1alpha1" \ + --input-dirs "github.com/karmada-io/karmada/pkg/apis/remedy/v1alpha1" \ --input-dirs "k8s.io/api/core/v1,k8s.io/apimachinery/pkg/api/resource" \ --input-dirs "k8s.io/apimachinery/pkg/apis/meta/v1,k8s.io/apimachinery/pkg/runtime,k8s.io/apimachinery/pkg/version" \ --input-dirs "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1,k8s.io/api/admissionregistration/v1,k8s.io/api/networking/v1" \ diff --git a/pkg/apis/remedy/v1alpha1/well_known_constants.go b/pkg/apis/remedy/v1alpha1/well_known_constants.go new file mode 100644 index 000000000..8c238486d --- /dev/null +++ b/pkg/apis/remedy/v1alpha1/well_known_constants.go @@ -0,0 +1,28 @@ +/* +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 + +const ( + // ResourceKindRemedy is kind name of Remedy. + ResourceKindRemedy = "Remedy" + // ResourceSingularRemedy is singular name of Remedy. + ResourceSingularRemedy = "remedy" + // ResourcePluralRemedy is plural name of Remedy. + ResourcePluralRemedy = "remedies" + // ResourceNamespaceScopedRemedy indicates if Remedy is NamespaceScoped. + ResourceNamespaceScopedRemedy = false +) diff --git a/pkg/generated/openapi/zz_generated.openapi.go b/pkg/generated/openapi/zz_generated.openapi.go index 2ba6aa84a..722792e68 100755 --- a/pkg/generated/openapi/zz_generated.openapi.go +++ b/pkg/generated/openapi/zz_generated.openapi.go @@ -124,6 +124,12 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1.SpreadConstraint": schema_pkg_apis_policy_v1alpha1_SpreadConstraint(ref), "github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1.StaticClusterAssignment": schema_pkg_apis_policy_v1alpha1_StaticClusterAssignment(ref), "github.com/karmada-io/karmada/pkg/apis/policy/v1alpha1.StaticClusterWeight": schema_pkg_apis_policy_v1alpha1_StaticClusterWeight(ref), + "github.com/karmada-io/karmada/pkg/apis/remedy/v1alpha1.ClusterAffinity": schema_pkg_apis_remedy_v1alpha1_ClusterAffinity(ref), + "github.com/karmada-io/karmada/pkg/apis/remedy/v1alpha1.ClusterConditionRequirement": schema_pkg_apis_remedy_v1alpha1_ClusterConditionRequirement(ref), + "github.com/karmada-io/karmada/pkg/apis/remedy/v1alpha1.DecisionMatch": schema_pkg_apis_remedy_v1alpha1_DecisionMatch(ref), + "github.com/karmada-io/karmada/pkg/apis/remedy/v1alpha1.Remedy": schema_pkg_apis_remedy_v1alpha1_Remedy(ref), + "github.com/karmada-io/karmada/pkg/apis/remedy/v1alpha1.RemedyList": schema_pkg_apis_remedy_v1alpha1_RemedyList(ref), + "github.com/karmada-io/karmada/pkg/apis/remedy/v1alpha1.RemedySpec": schema_pkg_apis_remedy_v1alpha1_RemedySpec(ref), "github.com/karmada-io/karmada/pkg/apis/search/v1alpha1.BackendStoreConfig": schema_pkg_apis_search_v1alpha1_BackendStoreConfig(ref), "github.com/karmada-io/karmada/pkg/apis/search/v1alpha1.OpenSearchConfig": schema_pkg_apis_search_v1alpha1_OpenSearchConfig(ref), "github.com/karmada-io/karmada/pkg/apis/search/v1alpha1.Proxying": schema_pkg_apis_search_v1alpha1_Proxying(ref), @@ -4822,6 +4828,235 @@ func schema_pkg_apis_policy_v1alpha1_StaticClusterWeight(ref common.ReferenceCal } } +func schema_pkg_apis_remedy_v1alpha1_ClusterAffinity(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ClusterAffinity represents the filter to select clusters.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "clusterNames": { + SchemaProps: spec.SchemaProps{ + Description: "ClusterNames is the list of clusters to be selected.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + }, + }, + } +} + +func schema_pkg_apis_remedy_v1alpha1_ClusterConditionRequirement(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ClusterConditionRequirement describes the Cluster condition requirement details.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "conditionType": { + SchemaProps: spec.SchemaProps{ + Description: "ConditionType specifies the ClusterStatus condition type.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "operator": { + SchemaProps: spec.SchemaProps{ + Description: "Operator represents a conditionType's relationship to a conditionStatus. Valid operators are Equal, NotEqual.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "conditionStatus": { + SchemaProps: spec.SchemaProps{ + Description: "ConditionStatus specifies the ClusterStatue condition status.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"conditionType", "operator", "conditionStatus"}, + }, + }, + } +} + +func schema_pkg_apis_remedy_v1alpha1_DecisionMatch(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "DecisionMatch represents the decision match detail of activating the remedy system.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "clusterConditionMatch": { + SchemaProps: spec.SchemaProps{ + Description: "ClusterConditionMatch describes the cluster condition requirement.", + Ref: ref("github.com/karmada-io/karmada/pkg/apis/remedy/v1alpha1.ClusterConditionRequirement"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/karmada-io/karmada/pkg/apis/remedy/v1alpha1.ClusterConditionRequirement"}, + } +} + +func schema_pkg_apis_remedy_v1alpha1_Remedy(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Remedy represents the cluster-level management strategies based on cluster conditions.", + 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 desired behavior of Remedy.", + Default: map[string]interface{}{}, + Ref: ref("github.com/karmada-io/karmada/pkg/apis/remedy/v1alpha1.RemedySpec"), + }, + }, + }, + Required: []string{"spec"}, + }, + }, + Dependencies: []string{ + "github.com/karmada-io/karmada/pkg/apis/remedy/v1alpha1.RemedySpec", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + } +} + +func schema_pkg_apis_remedy_v1alpha1_RemedyList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "RemedyList contains a list of Remedy.", + 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{ + 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/remedy/v1alpha1.Remedy"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "github.com/karmada-io/karmada/pkg/apis/remedy/v1alpha1.Remedy", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + } +} + +func schema_pkg_apis_remedy_v1alpha1_RemedySpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "RemedySpec represents the desired behavior of Remedy.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "clusterAffinity": { + SchemaProps: spec.SchemaProps{ + Description: "ClusterAffinity specifies the clusters that Remedy needs to pay attention to. For clusters that meet the DecisionConditions, Actions will be preformed. If empty, all clusters will be selected.", + Ref: ref("github.com/karmada-io/karmada/pkg/apis/remedy/v1alpha1.ClusterAffinity"), + }, + }, + "decisionMatches": { + SchemaProps: spec.SchemaProps{ + Description: "DecisionMatches indicates the decision matches of triggering the remedy system to perform the actions. As long as any one DecisionMatch matches, the Actions will be preformed. If empty, the Actions will be performed immediately.", + 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/remedy/v1alpha1.DecisionMatch"), + }, + }, + }, + }, + }, + "actions": { + SchemaProps: spec.SchemaProps{ + Description: "Actions specifies the actions that remedy system needs to perform. If empty, no action will be performed.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/karmada-io/karmada/pkg/apis/remedy/v1alpha1.ClusterAffinity", "github.com/karmada-io/karmada/pkg/apis/remedy/v1alpha1.DecisionMatch"}, + } +} + func schema_pkg_apis_search_v1alpha1_BackendStoreConfig(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{