Skip to content

Commit

Permalink
configurable qos resources for clustermanager and klusterlet deployments
Browse files Browse the repository at this point in the history
  • Loading branch information
dongbeiqing91 committed Jan 18, 2024
1 parent cb76224 commit 6c35afe
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions operator/v1/types_clustermanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
14 changes: 11 additions & 3 deletions operator/v1/types_klusterlet.go
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -87,25 +90,30 @@ 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"`
}

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
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
Expand Down
6 changes: 4 additions & 2 deletions operator/v1/zz_generated.swagger_doc_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6c35afe

Please sign in to comment.