Skip to content

Commit

Permalink
Merge pull request #83 from payall4u/feature/support-memory-compress
Browse files Browse the repository at this point in the history
Support memory compression.
  • Loading branch information
mfanjie authored Nov 7, 2024
2 parents 31991a1 + 90c30e7 commit 71b0de1
Show file tree
Hide file tree
Showing 6 changed files with 127 additions and 16 deletions.
5 changes: 5 additions & 0 deletions artifacts/deploy/ensurance.crane.io_nodeqoss.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ spec:
format: int64
type: integer
type: object
memoryCompression:
properties:
enable:
type: boolean
type: object
netLimits:
description: NetLimits is the net IO limit in the node
properties:
Expand Down
26 changes: 26 additions & 0 deletions artifacts/deploy/ensurance.crane.io_podqoss.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,32 @@ spec:
required:
- watermarkRatio
type: object
memoryCompression:
properties:
compressionLevel:
maximum: 4
minimum: 0
type: integer
enable:
type: boolean
oversold:
default: Allow
enum:
- Transparent
- None
- Allow
type: string
preference:
default: Tiny
description: CompressionPreference provides a quick way
to set the frequency, ratio and size of compression.
enum:
- Tiny
- Normal
- FileOnly
- AnonOnly
type: string
type: object
type: object
netIOQOS:
properties:
Expand Down
50 changes: 48 additions & 2 deletions ensurance/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ type PodQOSSpec struct {
// ResourceQOS describe the QOS limit for cpu,memory,netIO,diskIO and so on.
ResourceQOS ResourceQOS `json:"resourceQOS,omitempty"`

//QualityProbe defines the way to probe a pod
// QualityProbe defines the way to probe a pod
PodQualityProbe PodQualityProbe `json:"podQualityProbe,omitempty"`

// AllowedActions limits the set of actions that the pods is allowed to perform by NodeQOS
Expand Down Expand Up @@ -96,6 +96,43 @@ type ResourceQOS struct {
DiskIOQOS *DiskIOQOS `json:"diskIOQOS,omitempty"`
}

// CompressionPreference provides a quick way to set the frequency, ratio and size of compression.
type CompressionPreference string

type CompressionOversold string

const (
PreferenceTiny CompressionPreference = "Tiny"
PreferenceNormal CompressionPreference = "Normal"
PreferenceFileOnly CompressionPreference = "FileOnly"
PreferenceAnonOnly CompressionPreference = "AnonOnly"

OversoldTransparent CompressionOversold = "Transparent"
OversoldNone CompressionOversold = "None"
OversoldAllow CompressionOversold = "Allow"
)

type MemoryCompression struct {
// +kubebuilder:validation:Default=false
Enable bool `json:"enable,omitempty"`

// +kubebuilder:validation:Minimum=0
// +kubebuilder:validation:Maximum=4
CompressionLevel int `json:"compressionLevel,omitempty"`

// +kubebuilder:validation:Type=string
// +kubebuilder:validation:Enum=Tiny;Normal;FileOnly;AnonOnly
// +kubebuilder:default=Tiny
// +optional
Preference CompressionPreference `json:"preference"`

// +kubebuilder:validation:Type=string
// +kubebuilder:validation:Enum=Transparent;None;Allow
// +kubebuilder:default=Allow
// +optional
Oversold CompressionOversold `json:"oversold"`
}

type CPUQOS struct {
// CPUPriority define the cpu priority for the pods.
// CPUPriority range [0,7], 0 is the highest level.
Expand Down Expand Up @@ -155,6 +192,8 @@ type MemoryQOS struct {
MemAsyncReclaim MemAsyncReclaim `json:"memAsyncReclaim,omitempty"`
MemWatermark MemWatermark `json:"memWatermark,omitempty"`
MemPageCacheLimit MemPageCacheLimit `json:"memPageCacheLimit,omitempty"`

MemoryCompression MemoryCompression `json:"memoryCompression,omitempty"`
}

type MemPageCacheLimit struct {
Expand Down Expand Up @@ -258,10 +297,17 @@ type NodeQOSSpec struct {
// MemoryLimit is the mem limit in the node
MemoryLimit MemLimit `json:"memLimit,omitempty"`

MemoryCompression NodeMemoryCompression `json:"memoryCompression,omitempty"`

// NetLimits is the net IO limit in the node
NetLimits NetLimits `json:"netLimits,omitempty"`
}

type NodeMemoryCompression struct {
// +kubebuilder:validation:Default=false
Enable bool `json:"enable,omitempty"`
}

type NetLimits struct {
RXBpsMin *int64 `json:"rxBpsMin"`
RXBpsMax *int64 `json:"rxBpsMax"`
Expand Down Expand Up @@ -402,7 +448,7 @@ type AvoidanceActionSpec struct {
// +optional
Throttle *ThrottleAction `json:"throttle,omitempty"`

//Eviction describes the eviction action
// Eviction describes the eviction action
// +optional
Eviction *EvictionAction `json:"eviction,omitempty"`

Expand Down
34 changes: 34 additions & 0 deletions ensurance/v1alpha1/zz_generated.deepcopy.go

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

14 changes: 7 additions & 7 deletions pkg/generated/clientset/versioned/fake/register.go

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

14 changes: 7 additions & 7 deletions pkg/generated/clientset/versioned/scheme/register.go

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

0 comments on commit 71b0de1

Please sign in to comment.