diff --git a/config/crd/bases/config.katalyst.kubewharf.io_userwatermarkconfigurations.yaml b/config/crd/bases/config.katalyst.kubewharf.io_userwatermarkconfigurations.yaml new file mode 100644 index 0000000..6660f0a --- /dev/null +++ b/config/crd/bases/config.katalyst.kubewharf.io_userwatermarkconfigurations.yaml @@ -0,0 +1,579 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.15.0 + name: userwatermarkconfigurations.config.katalyst.kubewharf.io +spec: + group: config.katalyst.kubewharf.io + names: + kind: UserWatermarkConfiguration + listKind: UserWatermarkConfigurationList + plural: userwatermarkconfigurations + shortNames: + - uwm + singular: userwatermarkconfiguration + scope: Namespaced + versions: + - additionalPrinterColumns: + - jsonPath: .metadata.creationTimestamp + name: AGE + type: date + - jsonPath: .spec.paused + name: PAUSED + type: boolean + - jsonPath: .spec.nodeLabelSelector + name: SELECTOR + type: string + - jsonPath: .spec.priority + name: PRIORITY + type: string + - jsonPath: .spec.ephemeralSelector.nodeNames + name: NODES + type: string + - jsonPath: .spec.ephemeralSelector.lastDuration + name: DURATION + type: string + - jsonPath: .status.targetNodes + name: TARGET + type: integer + - jsonPath: .status.canaryNodes + name: CANARY + type: integer + - jsonPath: .status.updatedTargetNodes + name: UPDATED-TARGET + type: integer + - jsonPath: .status.currentHash + name: HASH + type: string + - jsonPath: .status.conditions[?(@.type=="Valid")].status + name: VALID + type: string + - jsonPath: .status.conditions[?(@.type=="Valid")].reason + name: REASON + type: string + - jsonPath: .status.conditions[?(@.type=="Valid")].message + name: MESSAGE + type: string + name: v1alpha1 + schema: + openAPIV3Schema: + description: UserWatermarkConfiguration is the Schema for the configuration + API used by User Watermark + 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: + type: object + spec: + description: UserWatermarkConfigurationSpec defines the desired state + of UserWatermarkConfiguration + properties: + config: + description: Config is custom field for UserWatermark configuration + properties: + cgroupConfig: + description: CgroupConfig is a configuration used to reclaim user + watermark on specified cgroups + items: + properties: + cgroupPath: + description: CgroupPath is an cgroupV2 absolute path, e.g. + /sys/fs/cgroup/hdfs + type: string + configDetail: + description: ConfigDetail is configuration details of UserWatermark + properties: + backoffDuration: + description: BackoffDuration is the duration the reclaimer + will wait before next reclaim cycle + type: string + enableMemoryReclaim: + description: EnableMemoryReclaim is whether to enable + memory reclaim on target objective + type: boolean + failureFreezePeriod: + description: |- + FailureFreezePeriod is the duration the reclaimer will wait before next reclaim cycle after + consecutive reclaim failed times reach the threshold. + type: string + feedbackPolicy: + description: FeedbackPolicy is the policy used to feedback + memory reclaim status to reclaimer + type: string + psiPolicy: + description: PSIPolicyConf is a configuration that uses + the psi indicator to report memory reclamation status + properties: + psiAvg60Threshold: + description: |- + PSIAvg60Threshold indicates the threshold of memory pressure. If observed pressure exceeds + this threshold, memory reclaiming will be paused. + type: number + type: object + reclaimFailedThreshold: + description: |- + ReclaimFailedThreshold is the threshold of consecutive reclaim failed times. If the threshold + is reached, the reclaimer will pause reclaiming. + format: int64 + type: integer + reclaimInterval: + description: ReclaimInterval is the minimum duration + the objectives got memory reclaimed by reclaimer + format: int64 + type: integer + refaultPolicy: + description: RefaultPolicy is a configuration that uses + the refault indicator to report memory reclamation + status + properties: + reclaimAccuracyTarget: + description: ReclaimAccuracyTarget indicates the + desired level of precision or accuracy in offloaded + pages. + type: number + reclaimScanEfficiencyTarget: + description: |- + ReclaimScanEfficiencyTarget indicates the desired level of efficiency in scanning and + identifying memory pages that can be offloaded. + type: number + type: object + scaleFactor: + description: ScaleFactor is the scale factor of memory + reclaim size + format: int64 + type: integer + singleReclaimFactor: + description: SingleReclaimFactor is the max memory reclaim + size ratio in one reclaim cycle + type: number + singleReclaimSize: + description: SingleReclaimSize is the max memory reclaim + size in one reclaim cycle + format: int64 + type: integer + type: object + required: + - cgroupPath + - configDetail + type: object + type: array + x-kubernetes-list-map-keys: + - cgroupPath + x-kubernetes-list-type: map + defaultConfig: + description: DefaultConfig is the default configuration for UserWatermark + properties: + backoffDuration: + description: BackoffDuration is the duration the reclaimer + will wait before next reclaim cycle + type: string + enableMemoryReclaim: + description: EnableMemoryReclaim is whether to enable memory + reclaim on target objective + type: boolean + failureFreezePeriod: + description: |- + FailureFreezePeriod is the duration the reclaimer will wait before next reclaim cycle after + consecutive reclaim failed times reach the threshold. + type: string + feedbackPolicy: + description: FeedbackPolicy is the policy used to feedback + memory reclaim status to reclaimer + type: string + psiPolicy: + description: PSIPolicyConf is a configuration that uses the + psi indicator to report memory reclamation status + properties: + psiAvg60Threshold: + description: |- + PSIAvg60Threshold indicates the threshold of memory pressure. If observed pressure exceeds + this threshold, memory reclaiming will be paused. + type: number + type: object + reclaimFailedThreshold: + description: |- + ReclaimFailedThreshold is the threshold of consecutive reclaim failed times. If the threshold + is reached, the reclaimer will pause reclaiming. + format: int64 + type: integer + reclaimInterval: + description: ReclaimInterval is the minimum duration the objectives + got memory reclaimed by reclaimer + format: int64 + type: integer + refaultPolicy: + description: RefaultPolicy is a configuration that uses the + refault indicator to report memory reclamation status + properties: + reclaimAccuracyTarget: + description: ReclaimAccuracyTarget indicates the desired + level of precision or accuracy in offloaded pages. + type: number + reclaimScanEfficiencyTarget: + description: |- + ReclaimScanEfficiencyTarget indicates the desired level of efficiency in scanning and + identifying memory pages that can be offloaded. + type: number + type: object + scaleFactor: + description: ScaleFactor is the scale factor of memory reclaim + size + format: int64 + type: integer + singleReclaimFactor: + description: SingleReclaimFactor is the max memory reclaim + size ratio in one reclaim cycle + type: number + singleReclaimSize: + description: SingleReclaimSize is the max memory reclaim size + in one reclaim cycle + format: int64 + type: integer + type: object + enableReclaimer: + description: EnableReclaimer is whether to enable reclaimer on + target objective + type: boolean + qosLevelConfig: + description: QoSLevelConfig is a configuration used to reclaim + user watermark on specified qos levels + items: + properties: + configDetail: + description: ConfigDetail is configuration details of UserWatermark + properties: + backoffDuration: + description: BackoffDuration is the duration the reclaimer + will wait before next reclaim cycle + type: string + enableMemoryReclaim: + description: EnableMemoryReclaim is whether to enable + memory reclaim on target objective + type: boolean + failureFreezePeriod: + description: |- + FailureFreezePeriod is the duration the reclaimer will wait before next reclaim cycle after + consecutive reclaim failed times reach the threshold. + type: string + feedbackPolicy: + description: FeedbackPolicy is the policy used to feedback + memory reclaim status to reclaimer + type: string + psiPolicy: + description: PSIPolicyConf is a configuration that uses + the psi indicator to report memory reclamation status + properties: + psiAvg60Threshold: + description: |- + PSIAvg60Threshold indicates the threshold of memory pressure. If observed pressure exceeds + this threshold, memory reclaiming will be paused. + type: number + type: object + reclaimFailedThreshold: + description: |- + ReclaimFailedThreshold is the threshold of consecutive reclaim failed times. If the threshold + is reached, the reclaimer will pause reclaiming. + format: int64 + type: integer + reclaimInterval: + description: ReclaimInterval is the minimum duration + the objectives got memory reclaimed by reclaimer + format: int64 + type: integer + refaultPolicy: + description: RefaultPolicy is a configuration that uses + the refault indicator to report memory reclamation + status + properties: + reclaimAccuracyTarget: + description: ReclaimAccuracyTarget indicates the + desired level of precision or accuracy in offloaded + pages. + type: number + reclaimScanEfficiencyTarget: + description: |- + ReclaimScanEfficiencyTarget indicates the desired level of efficiency in scanning and + identifying memory pages that can be offloaded. + type: number + type: object + scaleFactor: + description: ScaleFactor is the scale factor of memory + reclaim size + format: int64 + type: integer + singleReclaimFactor: + description: SingleReclaimFactor is the max memory reclaim + size ratio in one reclaim cycle + type: number + singleReclaimSize: + description: SingleReclaimSize is the max memory reclaim + size in one reclaim cycle + format: int64 + type: integer + type: object + qosLevel: + description: QoSLevel is either of reclaimed_cores, shared_cores, + dedicated_cores, system_cores + type: string + required: + - configDetail + - qosLevel + type: object + type: array + x-kubernetes-list-map-keys: + - qosLevel + x-kubernetes-list-type: map + reconcileInterval: + description: ReconcileInterval is the minimum duration the objectives + got memory reclaimed by reclaimer + format: int64 + type: integer + serviceConfig: + description: ServiceConfig is a configuration used to reclaim + user watermark on specified services + items: + properties: + configDetail: + description: ConfigDetail is configuration details of UserWatermark + properties: + backoffDuration: + description: BackoffDuration is the duration the reclaimer + will wait before next reclaim cycle + type: string + enableMemoryReclaim: + description: EnableMemoryReclaim is whether to enable + memory reclaim on target objective + type: boolean + failureFreezePeriod: + description: |- + FailureFreezePeriod is the duration the reclaimer will wait before next reclaim cycle after + consecutive reclaim failed times reach the threshold. + type: string + feedbackPolicy: + description: FeedbackPolicy is the policy used to feedback + memory reclaim status to reclaimer + type: string + psiPolicy: + description: PSIPolicyConf is a configuration that uses + the psi indicator to report memory reclamation status + properties: + psiAvg60Threshold: + description: |- + PSIAvg60Threshold indicates the threshold of memory pressure. If observed pressure exceeds + this threshold, memory reclaiming will be paused. + type: number + type: object + reclaimFailedThreshold: + description: |- + ReclaimFailedThreshold is the threshold of consecutive reclaim failed times. If the threshold + is reached, the reclaimer will pause reclaiming. + format: int64 + type: integer + reclaimInterval: + description: ReclaimInterval is the minimum duration + the objectives got memory reclaimed by reclaimer + format: int64 + type: integer + refaultPolicy: + description: RefaultPolicy is a configuration that uses + the refault indicator to report memory reclamation + status + properties: + reclaimAccuracyTarget: + description: ReclaimAccuracyTarget indicates the + desired level of precision or accuracy in offloaded + pages. + type: number + reclaimScanEfficiencyTarget: + description: |- + ReclaimScanEfficiencyTarget indicates the desired level of efficiency in scanning and + identifying memory pages that can be offloaded. + type: number + type: object + scaleFactor: + description: ScaleFactor is the scale factor of memory + reclaim size + format: int64 + type: integer + singleReclaimFactor: + description: SingleReclaimFactor is the max memory reclaim + size ratio in one reclaim cycle + type: number + singleReclaimSize: + description: SingleReclaimSize is the max memory reclaim + size in one reclaim cycle + format: int64 + type: integer + type: object + serviceName: + description: ServiceName is the name of the service to be + configured + type: string + required: + - configDetail + - serviceName + type: object + type: array + x-kubernetes-list-map-keys: + - serviceName + x-kubernetes-list-type: map + serviceLabel: + description: ServiceLabel is the label selector to filter services + that need to be configured + type: string + type: object + ephemeralSelector: + description: EphemeralSelector is a selector for temporary use only + properties: + lastDuration: + description: |- + define the duration this configuration will last from creationTimestamp. + must and only set when NodeNames already set + type: string + nodeNames: + description: Specific nodes' name the configurations will be effected. + items: + type: string + type: array + type: object + nodeLabelSelector: + description: |- + NodeLabelSelector select nodes to apply these configurations, + the priority and node label selector must be matched according + to KatalystCustomConfig.spec.nodeLabelSelectorAllowedKeyList, + otherwise it will not be synced. + type: string + paused: + description: Indicates that the config is paused. + type: boolean + priority: + description: |- + Priority is used by one node matched by NodeLabelSelector of more + than one configuration, and the higher priority will be considered. + The priority only be supported when NodeLabelSelector set + format: int32 + type: integer + revisionHistoryLimit: + default: 3 + description: |- + RevisionHistoryLimit is the maximum number of revisions that will + be maintained in the resource's revision history. The revision history + consists of all revisions not represented by a currently applied + Spec version. The default value is 3. + format: int64 + type: integer + updateStrategy: + description: An update strategy to replace existing CustomNodeConfig + configurations with new ones. + properties: + rollingUpdate: + description: |- + Rolling update config params. Present only if type = "RollingUpdate". + --- + TODO: Update this to follow our convention for oneOf, whatever we decide it + to be. Same as Deployment `strategy.rollingUpdate`. + See https://github.com/kubernetes/kubernetes/issues/35345 + properties: + canary: + anyOf: + - type: integer + - type: string + description: |- + The number or percentage of target CustomNodeConfigs to update to the current configuration. + For example: `100`` and `20%` are valid values. + pattern: ^(100|[1-9][0-9]?|0)%$ + x-kubernetes-int-or-string: true + type: object + type: + description: Type of config update. Only `RollingUpdate` is supported. + enum: + - RollingUpdate + type: string + type: object + required: + - config + type: object + status: + properties: + canaryNodes: + description: The number of nodes that this config is targeting and + should be updated given the current strategy. + format: int32 + type: integer + collisionCount: + description: |- + Count of hash collisions for this cr. The kcc controller + uses this field as a collision avoidance mechanism when it needs to + create the name for the newest ControllerRevision. + format: int32 + type: integer + conditions: + description: Represents the latest available observations of a config's + current state. + items: + properties: + lastTransitionTime: + description: Last time the condition transit from one status + to another. + format: date-time + type: string + message: + description: message is a human-readable explanation containing + details about the transition + type: string + reason: + description: reason is the reason for the condition's last transition. + type: string + status: + description: Status of the condition, one of True, False, Unknown. + type: string + type: + description: Type of config condition + type: string + required: + - status + - type + type: object + type: array + currentHash: + description: The hash of the current config observed by the kcc controller. + type: string + observedGeneration: + description: The most recent generation observed by the kcc controller. + format: int64 + type: integer + targetNodes: + description: The number of nodes that this config is targeting. + format: int32 + type: integer + updatedNodes: + description: The number of nodes (including non-target nodes) that + have been updated by this config. + format: int32 + type: integer + updatedTargetNodes: + description: The number of target nodes that have been updated by + this config. + format: int32 + type: integer + type: object + type: object + served: true + storage: true + subresources: + status: {} diff --git a/pkg/apis/config/v1alpha1/register.go b/pkg/apis/config/v1alpha1/register.go index a0e8181..b4db1ca 100644 --- a/pkg/apis/config/v1alpha1/register.go +++ b/pkg/apis/config/v1alpha1/register.go @@ -49,6 +49,7 @@ const ( ResourceNameStrategyGroupConfigurations = "strategygroupconfigurations" ResourceNameStrategyGroups = "strategygroups" ResourceNameIRQTuningConfigurations = "irqtuningconfigurations" + ResourceNameUserWatermarkConfigurations = "userwatermarkconfigurations" ) // Resource takes an unqualified resource and returns a Group qualified GroupResource @@ -92,6 +93,8 @@ func addKnownTypes(scheme *runtime.Scheme) error { &StrategyGroupList{}, &IRQTuningConfiguration{}, &IRQTuningConfigurationList{}, + &UserWatermarkConfiguration{}, + &UserWatermarkConfigurationList{}, // global resource portrait configuration &GlobalResourcePortraitConfiguration{}, diff --git a/pkg/apis/config/v1alpha1/userwatermark.go b/pkg/apis/config/v1alpha1/userwatermark.go new file mode 100644 index 0000000..26f6aa6 --- /dev/null +++ b/pkg/apis/config/v1alpha1/userwatermark.go @@ -0,0 +1,188 @@ +/* +Copyright 2022 The Katalyst 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 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + "github.com/kubewharf/katalyst-api/pkg/consts" +) + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:object:root=true +// +kubebuilder:resource:path=userwatermarkconfigurations,shortName=uwm +// +kubebuilder:subresource:status +// +kubebuilder:printcolumn:name="AGE",type=date,JSONPath=.metadata.creationTimestamp +// +kubebuilder:printcolumn:name="PAUSED",type=boolean,JSONPath=".spec.paused" +// +kubebuilder:printcolumn:name="SELECTOR",type=string,JSONPath=".spec.nodeLabelSelector" +// +kubebuilder:printcolumn:name="PRIORITY",type=string,JSONPath=".spec.priority" +// +kubebuilder:printcolumn:name="NODES",type=string,JSONPath=".spec.ephemeralSelector.nodeNames" +// +kubebuilder:printcolumn:name="DURATION",type=string,JSONPath=".spec.ephemeralSelector.lastDuration" +// +kubebuilder:printcolumn:name="TARGET",type=integer,JSONPath=".status.targetNodes" +// +kubebuilder:printcolumn:name="CANARY",type=integer,JSONPath=".status.canaryNodes" +// +kubebuilder:printcolumn:name="UPDATED-TARGET",type=integer,JSONPath=".status.updatedTargetNodes" +// +kubebuilder:printcolumn:name="HASH",type=string,JSONPath=".status.currentHash" +// +kubebuilder:printcolumn:name="VALID",type=string,JSONPath=".status.conditions[?(@.type==\"Valid\")].status" +// +kubebuilder:printcolumn:name="REASON",type=string,JSONPath=".status.conditions[?(@.type==\"Valid\")].reason" +// +kubebuilder:printcolumn:name="MESSAGE",type=string,JSONPath=".status.conditions[?(@.type==\"Valid\")].message" + +// UserWatermarkConfiguration is the Schema for the configuration API used by User Watermark +type UserWatermarkConfiguration struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec UserWatermarkConfigurationSpec `json:"spec,omitempty"` + Status GenericConfigStatus `json:"status,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:object:root=true + +// UserWatermarkConfigurationList contains a list of UserWatermarkConfiguration +type UserWatermarkConfigurationList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []UserWatermarkConfiguration `json:"items"` +} + +// UserWatermarkConfigurationSpec defines the desired state of UserWatermarkConfiguration +type UserWatermarkConfigurationSpec struct { + GenericConfigSpec `json:",inline"` + + // Config is custom field for UserWatermark configuration + Config UserWatermarkConfig `json:"config"` +} + +type UserWatermarkConfig struct { + // EnableReclaimer is whether to enable reclaimer on target objective + // +optional + EnableReclaimer *bool `json:"enableReclaimer,omitempty"` + // ReconcileInterval is the minimum duration the objectives got memory reclaimed by reclaimer + // +optional + ReconcileInterval *int64 `json:"reconcileInterval,omitempty"` + // ServiceLabel is the label selector to filter services that need to be configured + // +optional + ServiceLabel string `json:"serviceLabel,omitempty"` + + // DefaultConfig is the default configuration for UserWatermark + // +optional + DefaultConfig *ReclaimConfigDetail `json:"defaultConfig,omitempty"` + + // ServiceConfig is a configuration used to reclaim user watermark on specified services + // +optional + // +listMapKey=serviceName + // +listType=map + ServiceConfig []UserWatermarkServiceConfig `json:"serviceConfig,omitempty"` + + // QoSLevelConfig is a configuration used to reclaim user watermark on specified qos levels + // +optional + // +listMapKey=qosLevel + // +listType=map + QoSLevelConfig []UserWatermarkQoSLevelConfig `json:"qosLevelConfig,omitempty"` + + // CgroupConfig is a configuration used to reclaim user watermark on specified cgroups + // +optional + // +listMapKey=cgroupPath + // +listType=map + CgroupConfig []UserWatermarkCgroupConfig `json:"cgroupConfig,omitempty"` +} + +type UserWatermarkServiceConfig struct { + // ServiceName is the name of the service to be configured + ServiceName string `json:"serviceName"` + + // ConfigDetail is configuration details of UserWatermark + ConfigDetail ReclaimConfigDetail `json:"configDetail"` +} + +type UserWatermarkQoSLevelConfig struct { + // QoSLevel is either of reclaimed_cores, shared_cores, dedicated_cores, system_cores + QoSLevel consts.QoSLevel `json:"qosLevel"` + + // ConfigDetail is configuration details of UserWatermark + ConfigDetail ReclaimConfigDetail `json:"configDetail"` +} + +type UserWatermarkCgroupConfig struct { + // CgroupPath is an cgroupV2 absolute path, e.g. /sys/fs/cgroup/hdfs + CgroupPath string `json:"cgroupPath"` + + // ConfigDetail is configuration details of UserWatermark + ConfigDetail ReclaimConfigDetail `json:"configDetail"` +} + +type ReclaimConfigDetail struct { + // EnableMemoryReclaim is whether to enable memory reclaim on target objective + // +optional + EnableMemoryReclaim *bool `json:"enableMemoryReclaim,omitempty"` + // ReclaimInterval is the minimum duration the objectives got memory reclaimed by reclaimer + // +optional + ReclaimInterval *int64 `json:"reclaimInterval,omitempty"` + // ScaleFactor is the scale factor of memory reclaim size + // +optional + ScaleFactor *uint64 `json:"scaleFactor,omitempty"` + // SingleReclaimFactor is the max memory reclaim size ratio in one reclaim cycle + // +optional + SingleReclaimFactor *float64 `json:"singleReclaimFactor,omitempty"` + // SingleReclaimSize is the max memory reclaim size in one reclaim cycle + // +optional + SingleReclaimSize *uint64 `json:"singleReclaimSize,omitempty"` + // BackoffDuration is the duration the reclaimer will wait before next reclaim cycle + // +optional + BackoffDuration *metav1.Duration `json:"backoffDuration,omitempty"` + // FeedbackPolicy is the policy used to feedback memory reclaim status to reclaimer + // +optional + FeedbackPolicy *UserWatermarkPolicyName `json:"feedbackPolicy,omitempty"` + // ReclaimFailedThreshold is the threshold of consecutive reclaim failed times. If the threshold + // is reached, the reclaimer will pause reclaiming. + // +optional + ReclaimFailedThreshold *uint64 `json:"reclaimFailedThreshold,omitempty"` + // FailureFreezePeriod is the duration the reclaimer will wait before next reclaim cycle after + // consecutive reclaim failed times reach the threshold. + // +optional + FailureFreezePeriod *metav1.Duration `json:"failureFreezePeriod,omitempty"` + + // PSIPolicyConf is a configuration that uses the psi indicator to report memory reclamation status + // +optional + PSIPolicyConf *UserWatermarkPSIPolicyConf `json:"psiPolicy,omitempty"` + + // RefaultPolicy is a configuration that uses the refault indicator to report memory reclamation status + // +optional + RefaultPolicConf *UserWatermarkRefaultPolicyConf `json:"refaultPolicy,omitempty"` +} + +type UserWatermarkPolicyName string + +const ( + UserWatermarkPolicyNamePSI UserWatermarkPolicyName = "PSI" + UserWatermarkPolicyNameRefault UserWatermarkPolicyName = "Refault" + UserWatermarkPolicyNameIntegrated UserWatermarkPolicyName = "Integrated" +) + +type UserWatermarkPSIPolicyConf struct { + // PSIAvg60Threshold indicates the threshold of memory pressure. If observed pressure exceeds + // this threshold, memory reclaiming will be paused. + PSIAvg60Threshold *float64 `json:"psiAvg60Threshold,omitempty"` +} + +type UserWatermarkRefaultPolicyConf struct { + // ReclaimAccuracyTarget indicates the desired level of precision or accuracy in offloaded pages. + ReclaimAccuracyTarget *float64 `json:"reclaimAccuracyTarget,omitempty"` + // ReclaimScanEfficiencyTarget indicates the desired level of efficiency in scanning and + // identifying memory pages that can be offloaded. + ReclaimScanEfficiencyTarget *float64 `json:"reclaimScanEfficiencyTarget,omitempty"` +} diff --git a/pkg/apis/config/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/config/v1alpha1/zz_generated.deepcopy.go index ff59e41..91f8814 100644 --- a/pkg/apis/config/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/config/v1alpha1/zz_generated.deepcopy.go @@ -2320,6 +2320,77 @@ func (in *RPSExcludeIRQCoresThreshold) DeepCopy() *RPSExcludeIRQCoresThreshold { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ReclaimConfigDetail) DeepCopyInto(out *ReclaimConfigDetail) { + *out = *in + if in.EnableMemoryReclaim != nil { + in, out := &in.EnableMemoryReclaim, &out.EnableMemoryReclaim + *out = new(bool) + **out = **in + } + if in.ReclaimInterval != nil { + in, out := &in.ReclaimInterval, &out.ReclaimInterval + *out = new(int64) + **out = **in + } + if in.ScaleFactor != nil { + in, out := &in.ScaleFactor, &out.ScaleFactor + *out = new(uint64) + **out = **in + } + if in.SingleReclaimFactor != nil { + in, out := &in.SingleReclaimFactor, &out.SingleReclaimFactor + *out = new(float64) + **out = **in + } + if in.SingleReclaimSize != nil { + in, out := &in.SingleReclaimSize, &out.SingleReclaimSize + *out = new(uint64) + **out = **in + } + if in.BackoffDuration != nil { + in, out := &in.BackoffDuration, &out.BackoffDuration + *out = new(v1.Duration) + **out = **in + } + if in.FeedbackPolicy != nil { + in, out := &in.FeedbackPolicy, &out.FeedbackPolicy + *out = new(UserWatermarkPolicyName) + **out = **in + } + if in.ReclaimFailedThreshold != nil { + in, out := &in.ReclaimFailedThreshold, &out.ReclaimFailedThreshold + *out = new(uint64) + **out = **in + } + if in.FailureFreezePeriod != nil { + in, out := &in.FailureFreezePeriod, &out.FailureFreezePeriod + *out = new(v1.Duration) + **out = **in + } + if in.PSIPolicyConf != nil { + in, out := &in.PSIPolicyConf, &out.PSIPolicyConf + *out = new(UserWatermarkPSIPolicyConf) + (*in).DeepCopyInto(*out) + } + if in.RefaultPolicConf != nil { + in, out := &in.RefaultPolicConf, &out.RefaultPolicConf + *out = new(UserWatermarkRefaultPolicyConf) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReclaimConfigDetail. +func (in *ReclaimConfigDetail) DeepCopy() *ReclaimConfigDetail { + if in == nil { + return nil + } + out := new(ReclaimConfigDetail) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ReclaimResourceIndicators) DeepCopyInto(out *ReclaimResourceIndicators) { *out = *in @@ -3335,3 +3406,232 @@ func (in *UserPasswordPair) DeepCopy() *UserPasswordPair { in.DeepCopyInto(out) return out } + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *UserWatermarkCgroupConfig) DeepCopyInto(out *UserWatermarkCgroupConfig) { + *out = *in + in.ConfigDetail.DeepCopyInto(&out.ConfigDetail) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UserWatermarkCgroupConfig. +func (in *UserWatermarkCgroupConfig) DeepCopy() *UserWatermarkCgroupConfig { + if in == nil { + return nil + } + out := new(UserWatermarkCgroupConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *UserWatermarkConfig) DeepCopyInto(out *UserWatermarkConfig) { + *out = *in + if in.EnableReclaimer != nil { + in, out := &in.EnableReclaimer, &out.EnableReclaimer + *out = new(bool) + **out = **in + } + if in.ReconcileInterval != nil { + in, out := &in.ReconcileInterval, &out.ReconcileInterval + *out = new(int64) + **out = **in + } + if in.DefaultConfig != nil { + in, out := &in.DefaultConfig, &out.DefaultConfig + *out = new(ReclaimConfigDetail) + (*in).DeepCopyInto(*out) + } + if in.ServiceConfig != nil { + in, out := &in.ServiceConfig, &out.ServiceConfig + *out = make([]UserWatermarkServiceConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.QoSLevelConfig != nil { + in, out := &in.QoSLevelConfig, &out.QoSLevelConfig + *out = make([]UserWatermarkQoSLevelConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.CgroupConfig != nil { + in, out := &in.CgroupConfig, &out.CgroupConfig + *out = make([]UserWatermarkCgroupConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UserWatermarkConfig. +func (in *UserWatermarkConfig) DeepCopy() *UserWatermarkConfig { + if in == nil { + return nil + } + out := new(UserWatermarkConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *UserWatermarkConfiguration) DeepCopyInto(out *UserWatermarkConfiguration) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UserWatermarkConfiguration. +func (in *UserWatermarkConfiguration) DeepCopy() *UserWatermarkConfiguration { + if in == nil { + return nil + } + out := new(UserWatermarkConfiguration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *UserWatermarkConfiguration) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *UserWatermarkConfigurationList) DeepCopyInto(out *UserWatermarkConfigurationList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]UserWatermarkConfiguration, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UserWatermarkConfigurationList. +func (in *UserWatermarkConfigurationList) DeepCopy() *UserWatermarkConfigurationList { + if in == nil { + return nil + } + out := new(UserWatermarkConfigurationList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *UserWatermarkConfigurationList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *UserWatermarkConfigurationSpec) DeepCopyInto(out *UserWatermarkConfigurationSpec) { + *out = *in + in.GenericConfigSpec.DeepCopyInto(&out.GenericConfigSpec) + in.Config.DeepCopyInto(&out.Config) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UserWatermarkConfigurationSpec. +func (in *UserWatermarkConfigurationSpec) DeepCopy() *UserWatermarkConfigurationSpec { + if in == nil { + return nil + } + out := new(UserWatermarkConfigurationSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *UserWatermarkPSIPolicyConf) DeepCopyInto(out *UserWatermarkPSIPolicyConf) { + *out = *in + if in.PSIAvg60Threshold != nil { + in, out := &in.PSIAvg60Threshold, &out.PSIAvg60Threshold + *out = new(float64) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UserWatermarkPSIPolicyConf. +func (in *UserWatermarkPSIPolicyConf) DeepCopy() *UserWatermarkPSIPolicyConf { + if in == nil { + return nil + } + out := new(UserWatermarkPSIPolicyConf) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *UserWatermarkQoSLevelConfig) DeepCopyInto(out *UserWatermarkQoSLevelConfig) { + *out = *in + in.ConfigDetail.DeepCopyInto(&out.ConfigDetail) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UserWatermarkQoSLevelConfig. +func (in *UserWatermarkQoSLevelConfig) DeepCopy() *UserWatermarkQoSLevelConfig { + if in == nil { + return nil + } + out := new(UserWatermarkQoSLevelConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *UserWatermarkRefaultPolicyConf) DeepCopyInto(out *UserWatermarkRefaultPolicyConf) { + *out = *in + if in.ReclaimAccuracyTarget != nil { + in, out := &in.ReclaimAccuracyTarget, &out.ReclaimAccuracyTarget + *out = new(float64) + **out = **in + } + if in.ReclaimScanEfficiencyTarget != nil { + in, out := &in.ReclaimScanEfficiencyTarget, &out.ReclaimScanEfficiencyTarget + *out = new(float64) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UserWatermarkRefaultPolicyConf. +func (in *UserWatermarkRefaultPolicyConf) DeepCopy() *UserWatermarkRefaultPolicyConf { + if in == nil { + return nil + } + out := new(UserWatermarkRefaultPolicyConf) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *UserWatermarkServiceConfig) DeepCopyInto(out *UserWatermarkServiceConfig) { + *out = *in + in.ConfigDetail.DeepCopyInto(&out.ConfigDetail) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UserWatermarkServiceConfig. +func (in *UserWatermarkServiceConfig) DeepCopy() *UserWatermarkServiceConfig { + if in == nil { + return nil + } + out := new(UserWatermarkServiceConfig) + in.DeepCopyInto(out) + return out +}