diff --git a/crdsv1beta1/0001_00_operator.open-cluster-management.io_klusterlets.crd.yaml b/crdsv1beta1/0001_00_operator.open-cluster-management.io_klusterlets.crd.yaml index 9ccbdae5d..0f20b036f 100644 --- a/crdsv1beta1/0001_00_operator.open-cluster-management.io_klusterlets.crd.yaml +++ b/crdsv1beta1/0001_00_operator.open-cluster-management.io_klusterlets.crd.yaml @@ -156,9 +156,18 @@ spec: description: RegistrationImagePullSpec represents the desired image configuration of registration agent. quay.io/open-cluster-management.io/registration:latest will be used if unspecified. type: string resourceRequirement: - description: ResourceRequirement specify QoS classes of klusterlet deployment + description: ResourceRequirement specify QoS classes of deployments managed by klusterlet type: object properties: + resources: + description: Resources defines resource requests and limits when Type is ResourceQosClassConfigurable + type: object + additionalProperties: + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true type: type: string default: Default diff --git a/operator/v1/0000_00_operator.open-cluster-management.io_klusterlets.crd.yaml b/operator/v1/0000_00_operator.open-cluster-management.io_klusterlets.crd.yaml index df8d8324d..728687083 100644 --- a/operator/v1/0000_00_operator.open-cluster-management.io_klusterlets.crd.yaml +++ b/operator/v1/0000_00_operator.open-cluster-management.io_klusterlets.crd.yaml @@ -244,9 +244,19 @@ spec: will be used if unspecified. type: string resourceRequirement: - description: ResourceRequirement specify QoS classes of klusterlet - deployment + description: ResourceRequirement specify QoS classes of deployments + managed by klusterlet properties: + resources: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: Resources defines resource requests and limits when + Type is ResourceQosClassConfigurable + type: object type: default: Default enum: diff --git a/operator/v1/0000_01_operator.open-cluster-management.io_clustermanagers.crd.yaml b/operator/v1/0000_01_operator.open-cluster-management.io_clustermanagers.crd.yaml index b57e95f5f..0c3ae826e 100644 --- a/operator/v1/0000_01_operator.open-cluster-management.io_clustermanagers.crd.yaml +++ b/operator/v1/0000_01_operator.open-cluster-management.io_clustermanagers.crd.yaml @@ -259,6 +259,27 @@ spec: description: RegistrationImagePullSpec represents the desired image of registration controller/webhook installed on hub. type: string + resourceRequirement: + description: ResourceRequirement specify QoS classes of deployments + managed by clustermanager + properties: + resources: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + description: Resources defines resource requests and limits when + Type is ResourceQosClassConfigurable + type: object + type: + default: Default + enum: + - Default + - BestEffort + type: string + type: object workConfiguration: description: WorkConfiguration contains the configuration of work properties: diff --git a/operator/v1/types_clustermanager.go b/operator/v1/types_clustermanager.go index ed97ffd4c..5eebe02df 100644 --- a/operator/v1/types_clustermanager.go +++ b/operator/v1/types_clustermanager.go @@ -70,6 +70,10 @@ type ClusterManagerSpec struct { // AddOnManagerConfiguration contains the configuration of addon manager // +optional AddOnManagerConfiguration *AddOnManagerConfiguration `json:"addOnManagerConfiguration,omitempty"` + + // ResourceRequirement specify QoS classes of deployments managed by clustermanager + // +optional + ResourceRequirement *ResourceRequirement `json:"resourceRequirement,omitempty"` } // NodePlacement describes node scheduling configuration for the pods. diff --git a/operator/v1/types_klusterlet.go b/operator/v1/types_klusterlet.go index 2ae4bef9b..51b276326 100644 --- a/operator/v1/types_klusterlet.go +++ b/operator/v1/types_klusterlet.go @@ -1,6 +1,9 @@ package v1 -import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +import ( + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) // +genclient // +genclient:nonNamespaced @@ -87,7 +90,7 @@ type KlusterletSpec struct { // +optional HubApiServerHostAlias *HubApiServerHostAlias `json:"hubApiServerHostAlias,omitempty"` - // ResourceRequirement specify QoS classes of klusterlet deployment + // ResourceRequirement specify QoS classes of deployments managed by klusterlet // +optional ResourceRequirement *ResourceRequirement `json:"resourceRequirement,omitempty"` } @@ -95,10 +98,12 @@ type KlusterletSpec struct { type ResourceQosClass string const ( - // Default use resource setting in the template file + // Default use resource setting in the template file (with requests but no limits in the resources) ResourceQosClassDefault ResourceQosClass = "Default" // If all containers in the pod don't set resource request and limits, the pod is treated as BestEffort. ResourceQosClassBestEffort ResourceQosClass = "BestEffort" + // Configurable resources with requests and limits + ResourceQosClassConfigurable ResourceQosClass = "Configurable" ) // ResourceRequirement allow user override the default pod QoS classes @@ -106,6 +111,9 @@ type ResourceRequirement struct { // +kubebuilder:validation:Enum=Default;BestEffort // +kubebuilder:default:=Default Type ResourceQosClass `json:"type"` + // Resources defines resource requests and limits when Type is ResourceQosClassConfigurable + // +optional + Resources *corev1.ResourceList `json:"resources,omitempty"` } // ServerURL represents the apiserver url and ca bundle that is accessible externally diff --git a/operator/v1/zz_generated.swagger_doc_generated.go b/operator/v1/zz_generated.swagger_doc_generated.go index 330df7997..24c4ee680 100644 --- a/operator/v1/zz_generated.swagger_doc_generated.go +++ b/operator/v1/zz_generated.swagger_doc_generated.go @@ -60,6 +60,7 @@ var map_ClusterManagerSpec = map[string]string{ "registrationConfiguration": "RegistrationConfiguration contains the configuration of registration", "workConfiguration": "WorkConfiguration contains the configuration of work", "addOnManagerConfiguration": "AddOnManagerConfiguration contains the configuration of addon manager", + "resourceRequirement": "ResourceRequirement specify QoS classes of deployments managed by clustermanager", } func (ClusterManagerSpec) SwaggerDoc() map[string]string { @@ -213,7 +214,7 @@ var map_KlusterletSpec = map[string]string{ "registrationConfiguration": "RegistrationConfiguration contains the configuration of registration", "workConfiguration": "WorkConfiguration contains the configuration of work", "hubApiServerHostAlias": "HubApiServerHostAlias contains the host alias for hub api server. registration-agent and work-agent will use it to communicate with hub api server.", - "resourceRequirement": "ResourceRequirement specify QoS classes of klusterlet deployment", + "resourceRequirement": "ResourceRequirement specify QoS classes of deployments managed by klusterlet", } func (KlusterletSpec) SwaggerDoc() map[string]string { @@ -245,7 +246,8 @@ func (RegistrationConfiguration) SwaggerDoc() map[string]string { } var map_ResourceRequirement = map[string]string{ - "": "ResourceRequirement allow user override the default pod QoS classes", + "": "ResourceRequirement allow user override the default pod QoS classes", + "resources": "Resources defines resource requests and limits when Type is ResourceQosClassConfigurable", } func (ResourceRequirement) SwaggerDoc() map[string]string {