Skip to content

Commit 71b0de1

Browse files
authored
Merge pull request #83 from payall4u/feature/support-memory-compress
Support memory compression.
2 parents 31991a1 + 90c30e7 commit 71b0de1

File tree

6 files changed

+127
-16
lines changed

6 files changed

+127
-16
lines changed

artifacts/deploy/ensurance.crane.io_nodeqoss.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@ spec:
9595
format: int64
9696
type: integer
9797
type: object
98+
memoryCompression:
99+
properties:
100+
enable:
101+
type: boolean
102+
type: object
98103
netLimits:
99104
description: NetLimits is the net IO limit in the node
100105
properties:

artifacts/deploy/ensurance.crane.io_podqoss.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,32 @@ spec:
274274
required:
275275
- watermarkRatio
276276
type: object
277+
memoryCompression:
278+
properties:
279+
compressionLevel:
280+
maximum: 4
281+
minimum: 0
282+
type: integer
283+
enable:
284+
type: boolean
285+
oversold:
286+
default: Allow
287+
enum:
288+
- Transparent
289+
- None
290+
- Allow
291+
type: string
292+
preference:
293+
default: Tiny
294+
description: CompressionPreference provides a quick way
295+
to set the frequency, ratio and size of compression.
296+
enum:
297+
- Tiny
298+
- Normal
299+
- FileOnly
300+
- AnonOnly
301+
type: string
302+
type: object
277303
type: object
278304
netIOQOS:
279305
properties:

ensurance/v1alpha1/types.go

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ type PodQOSSpec struct {
4040
// ResourceQOS describe the QOS limit for cpu,memory,netIO,diskIO and so on.
4141
ResourceQOS ResourceQOS `json:"resourceQOS,omitempty"`
4242

43-
//QualityProbe defines the way to probe a pod
43+
// QualityProbe defines the way to probe a pod
4444
PodQualityProbe PodQualityProbe `json:"podQualityProbe,omitempty"`
4545

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

99+
// CompressionPreference provides a quick way to set the frequency, ratio and size of compression.
100+
type CompressionPreference string
101+
102+
type CompressionOversold string
103+
104+
const (
105+
PreferenceTiny CompressionPreference = "Tiny"
106+
PreferenceNormal CompressionPreference = "Normal"
107+
PreferenceFileOnly CompressionPreference = "FileOnly"
108+
PreferenceAnonOnly CompressionPreference = "AnonOnly"
109+
110+
OversoldTransparent CompressionOversold = "Transparent"
111+
OversoldNone CompressionOversold = "None"
112+
OversoldAllow CompressionOversold = "Allow"
113+
)
114+
115+
type MemoryCompression struct {
116+
// +kubebuilder:validation:Default=false
117+
Enable bool `json:"enable,omitempty"`
118+
119+
// +kubebuilder:validation:Minimum=0
120+
// +kubebuilder:validation:Maximum=4
121+
CompressionLevel int `json:"compressionLevel,omitempty"`
122+
123+
// +kubebuilder:validation:Type=string
124+
// +kubebuilder:validation:Enum=Tiny;Normal;FileOnly;AnonOnly
125+
// +kubebuilder:default=Tiny
126+
// +optional
127+
Preference CompressionPreference `json:"preference"`
128+
129+
// +kubebuilder:validation:Type=string
130+
// +kubebuilder:validation:Enum=Transparent;None;Allow
131+
// +kubebuilder:default=Allow
132+
// +optional
133+
Oversold CompressionOversold `json:"oversold"`
134+
}
135+
99136
type CPUQOS struct {
100137
// CPUPriority define the cpu priority for the pods.
101138
// CPUPriority range [0,7], 0 is the highest level.
@@ -155,6 +192,8 @@ type MemoryQOS struct {
155192
MemAsyncReclaim MemAsyncReclaim `json:"memAsyncReclaim,omitempty"`
156193
MemWatermark MemWatermark `json:"memWatermark,omitempty"`
157194
MemPageCacheLimit MemPageCacheLimit `json:"memPageCacheLimit,omitempty"`
195+
196+
MemoryCompression MemoryCompression `json:"memoryCompression,omitempty"`
158197
}
159198

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

300+
MemoryCompression NodeMemoryCompression `json:"memoryCompression,omitempty"`
301+
261302
// NetLimits is the net IO limit in the node
262303
NetLimits NetLimits `json:"netLimits,omitempty"`
263304
}
264305

306+
type NodeMemoryCompression struct {
307+
// +kubebuilder:validation:Default=false
308+
Enable bool `json:"enable,omitempty"`
309+
}
310+
265311
type NetLimits struct {
266312
RXBpsMin *int64 `json:"rxBpsMin"`
267313
RXBpsMax *int64 `json:"rxBpsMax"`
@@ -402,7 +448,7 @@ type AvoidanceActionSpec struct {
402448
// +optional
403449
Throttle *ThrottleAction `json:"throttle,omitempty"`
404450

405-
//Eviction describes the eviction action
451+
// Eviction describes the eviction action
406452
// +optional
407453
Eviction *EvictionAction `json:"eviction,omitempty"`
408454

ensurance/v1alpha1/zz_generated.deepcopy.go

Lines changed: 34 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/generated/clientset/versioned/fake/register.go

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/generated/clientset/versioned/scheme/register.go

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)