From 962d56ff086f963b99360289881ff2f33151f916 Mon Sep 17 00:00:00 2001 From: RainbowMango Date: Fri, 28 Feb 2025 11:32:25 +0800 Subject: [PATCH] Update the API of schedule priroity feature as per the MVP version Signed-off-by: RainbowMango --- api/openapi-spec/swagger.json | 8 +++++--- .../policy.karmada.io_clusterpropagationpolicies.yaml | 5 ----- .../policy/policy.karmada.io_propagationpolicies.yaml | 5 ----- pkg/apis/policy/v1alpha1/propagation_types.go | 9 ++------- pkg/generated/openapi/zz_generated.openapi.go | 4 +++- 5 files changed, 10 insertions(+), 21 deletions(-) diff --git a/api/openapi-spec/swagger.json b/api/openapi-spec/swagger.json index dbc982595..b901b1788 100644 --- a/api/openapi-spec/swagger.json +++ b/api/openapi-spec/swagger.json @@ -19302,12 +19302,14 @@ ], "properties": { "priorityClassName": { - "description": "PriorityClassName specifies which PriorityClass to use. Its behavior depends on PriorityClassSource:\n\nBehavior of PriorityClassName:\n\nFor KubePriorityClass: - When specified: Uses the named Kubernetes PriorityClass. - When empty: Uses the cluster's default PriorityClass (i.e., the PriorityClass marked as the global default in the cluster). - If neither exists: Sets priority=0 and preemptionPolicy=Never.\n\nFor PodPriorityClass: - Uses PriorityClassName from the PodTemplate. - If the specified PriorityClass is not found, falls back to the cluster's default PriorityClass\n (i.e., the PriorityClass marked as the global default in the cluster).\n- If no valid PriorityClass is found: Sets priority=0 and preemptionPolicy=Never. - Not yet implemented.\n\nFor FederatedPriorityClass: - Not yet implemented.", - "type": "string" + "description": "PriorityClassName specifies which PriorityClass to use. Its behavior depends on PriorityClassSource:\n\nBehavior of PriorityClassName:\n\nFor KubePriorityClass: - When specified: Uses the named Kubernetes PriorityClass.\n\nFor PodPriorityClass: - Uses PriorityClassName from the PodTemplate. - Not yet implemented.\n\nFor FederatedPriorityClass: - Not yet implemented.", + "type": "string", + "default": "" }, "priorityClassSource": { "description": "PriorityClassSource specifies where Karmada should look for the PriorityClass definition. Available options: - KubePriorityClass: Uses Kubernetes PriorityClass (scheduling.k8s.io/v1) - PodPriorityClass: Uses PriorityClassName from PodTemplate: PodSpec.PriorityClassName (not yet implemented) - FederatedPriorityClass: Uses Karmada FederatedPriorityClass (not yet implemented)", - "type": "string" + "type": "string", + "default": "" } } }, diff --git a/charts/karmada/_crds/bases/policy/policy.karmada.io_clusterpropagationpolicies.yaml b/charts/karmada/_crds/bases/policy/policy.karmada.io_clusterpropagationpolicies.yaml index 504a6c284..4fa34a04f 100644 --- a/charts/karmada/_crds/bases/policy/policy.karmada.io_clusterpropagationpolicies.yaml +++ b/charts/karmada/_crds/bases/policy/policy.karmada.io_clusterpropagationpolicies.yaml @@ -888,14 +888,9 @@ spec: For KubePriorityClass: - When specified: Uses the named Kubernetes PriorityClass. - - When empty: Uses the cluster's default PriorityClass (i.e., the PriorityClass marked as the global default in the cluster). - - If neither exists: Sets priority=0 and preemptionPolicy=Never. For PodPriorityClass: - Uses PriorityClassName from the PodTemplate. - - If the specified PriorityClass is not found, falls back to the cluster's default PriorityClass - (i.e., the PriorityClass marked as the global default in the cluster). - - If no valid PriorityClass is found: Sets priority=0 and preemptionPolicy=Never. - Not yet implemented. For FederatedPriorityClass: diff --git a/charts/karmada/_crds/bases/policy/policy.karmada.io_propagationpolicies.yaml b/charts/karmada/_crds/bases/policy/policy.karmada.io_propagationpolicies.yaml index a63390a9a..ed76b8545 100644 --- a/charts/karmada/_crds/bases/policy/policy.karmada.io_propagationpolicies.yaml +++ b/charts/karmada/_crds/bases/policy/policy.karmada.io_propagationpolicies.yaml @@ -885,14 +885,9 @@ spec: For KubePriorityClass: - When specified: Uses the named Kubernetes PriorityClass. - - When empty: Uses the cluster's default PriorityClass (i.e., the PriorityClass marked as the global default in the cluster). - - If neither exists: Sets priority=0 and preemptionPolicy=Never. For PodPriorityClass: - Uses PriorityClassName from the PodTemplate. - - If the specified PriorityClass is not found, falls back to the cluster's default PriorityClass - (i.e., the PriorityClass marked as the global default in the cluster). - - If no valid PriorityClass is found: Sets priority=0 and preemptionPolicy=Never. - Not yet implemented. For FederatedPriorityClass: diff --git a/pkg/apis/policy/v1alpha1/propagation_types.go b/pkg/apis/policy/v1alpha1/propagation_types.go index 59c4b4010..f0bbef40d 100644 --- a/pkg/apis/policy/v1alpha1/propagation_types.go +++ b/pkg/apis/policy/v1alpha1/propagation_types.go @@ -688,7 +688,7 @@ type SchedulePriority struct { // // +kubebuilder:validation:Enum=KubePriorityClass // +required - PriorityClassSource PriorityClassSource `json:"priorityClassSource,omitempty"` + PriorityClassSource PriorityClassSource `json:"priorityClassSource"` // PriorityClassName specifies which PriorityClass to use. Its behavior depends on PriorityClassSource: // @@ -696,21 +696,16 @@ type SchedulePriority struct { // // For KubePriorityClass: // - When specified: Uses the named Kubernetes PriorityClass. - // - When empty: Uses the cluster's default PriorityClass (i.e., the PriorityClass marked as the global default in the cluster). - // - If neither exists: Sets priority=0 and preemptionPolicy=Never. // // For PodPriorityClass: // - Uses PriorityClassName from the PodTemplate. - // - If the specified PriorityClass is not found, falls back to the cluster's default PriorityClass - // (i.e., the PriorityClass marked as the global default in the cluster). - // - If no valid PriorityClass is found: Sets priority=0 and preemptionPolicy=Never. // - Not yet implemented. // // For FederatedPriorityClass: // - Not yet implemented. // // +required - PriorityClassName string `json:"priorityClassName,omitempty"` + PriorityClassName string `json:"priorityClassName"` } // PriorityClassSource defines the type for PriorityClassSource field. diff --git a/pkg/generated/openapi/zz_generated.openapi.go b/pkg/generated/openapi/zz_generated.openapi.go index 05fd24275..a6bc30f03 100644 --- a/pkg/generated/openapi/zz_generated.openapi.go +++ b/pkg/generated/openapi/zz_generated.openapi.go @@ -5151,13 +5151,15 @@ func schema_pkg_apis_policy_v1alpha1_SchedulePriority(ref common.ReferenceCallba "priorityClassSource": { SchemaProps: spec.SchemaProps{ Description: "PriorityClassSource specifies where Karmada should look for the PriorityClass definition. Available options: - KubePriorityClass: Uses Kubernetes PriorityClass (scheduling.k8s.io/v1) - PodPriorityClass: Uses PriorityClassName from PodTemplate: PodSpec.PriorityClassName (not yet implemented) - FederatedPriorityClass: Uses Karmada FederatedPriorityClass (not yet implemented)", + Default: "", Type: []string{"string"}, Format: "", }, }, "priorityClassName": { SchemaProps: spec.SchemaProps{ - Description: "PriorityClassName specifies which PriorityClass to use. Its behavior depends on PriorityClassSource:\n\nBehavior of PriorityClassName:\n\nFor KubePriorityClass: - When specified: Uses the named Kubernetes PriorityClass. - When empty: Uses the cluster's default PriorityClass (i.e., the PriorityClass marked as the global default in the cluster). - If neither exists: Sets priority=0 and preemptionPolicy=Never.\n\nFor PodPriorityClass: - Uses PriorityClassName from the PodTemplate. - If the specified PriorityClass is not found, falls back to the cluster's default PriorityClass\n (i.e., the PriorityClass marked as the global default in the cluster).\n- If no valid PriorityClass is found: Sets priority=0 and preemptionPolicy=Never. - Not yet implemented.\n\nFor FederatedPriorityClass: - Not yet implemented.", + Description: "PriorityClassName specifies which PriorityClass to use. Its behavior depends on PriorityClassSource:\n\nBehavior of PriorityClassName:\n\nFor KubePriorityClass: - When specified: Uses the named Kubernetes PriorityClass.\n\nFor PodPriorityClass: - Uses PriorityClassName from the PodTemplate. - Not yet implemented.\n\nFor FederatedPriorityClass: - Not yet implemented.", + Default: "", Type: []string{"string"}, Format: "", },