add remedy api in the swagger.json

Signed-off-by: changzhen <changzhen5@huawei.com>
This commit is contained in:
changzhen 2024-03-04 19:43:21 +08:00
parent 7d292ed9fd
commit 2db3ca2629
5 changed files with 1260 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@ -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,
})

View File

@ -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" \

View File

@ -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
)

View File

@ -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{