diff --git a/artifacts/deploy/ensurance.crane.io_nodeqoss.yaml b/artifacts/deploy/ensurance.crane.io_nodeqoss.yaml index 4be6e57..adea0bb 100644 --- a/artifacts/deploy/ensurance.crane.io_nodeqoss.yaml +++ b/artifacts/deploy/ensurance.crane.io_nodeqoss.yaml @@ -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: diff --git a/artifacts/deploy/ensurance.crane.io_podqoss.yaml b/artifacts/deploy/ensurance.crane.io_podqoss.yaml index 2a07897..2420b0e 100644 --- a/artifacts/deploy/ensurance.crane.io_podqoss.yaml +++ b/artifacts/deploy/ensurance.crane.io_podqoss.yaml @@ -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: diff --git a/ensurance/v1alpha1/types.go b/ensurance/v1alpha1/types.go index 670f975..f374e6c 100644 --- a/ensurance/v1alpha1/types.go +++ b/ensurance/v1alpha1/types.go @@ -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 @@ -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. @@ -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 { @@ -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"` @@ -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"` diff --git a/ensurance/v1alpha1/zz_generated.deepcopy.go b/ensurance/v1alpha1/zz_generated.deepcopy.go index dc14198..334faa1 100644 --- a/ensurance/v1alpha1/zz_generated.deepcopy.go +++ b/ensurance/v1alpha1/zz_generated.deepcopy.go @@ -509,6 +509,22 @@ func (in *MemWatermark) DeepCopy() *MemWatermark { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MemoryCompression) DeepCopyInto(out *MemoryCompression) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MemoryCompression. +func (in *MemoryCompression) DeepCopy() *MemoryCompression { + if in == nil { + return nil + } + out := new(MemoryCompression) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MemoryQOS) DeepCopyInto(out *MemoryQOS) { *out = *in @@ -520,6 +536,7 @@ func (in *MemoryQOS) DeepCopyInto(out *MemoryQOS) { in.MemAsyncReclaim.DeepCopyInto(&out.MemAsyncReclaim) in.MemWatermark.DeepCopyInto(&out.MemWatermark) in.MemPageCacheLimit.DeepCopyInto(&out.MemPageCacheLimit) + out.MemoryCompression = in.MemoryCompression return } @@ -676,6 +693,22 @@ func (in *NodeLocalGet) DeepCopy() *NodeLocalGet { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NodeMemoryCompression) DeepCopyInto(out *NodeMemoryCompression) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeMemoryCompression. +func (in *NodeMemoryCompression) DeepCopy() *NodeMemoryCompression { + if in == nil { + return nil + } + out := new(NodeMemoryCompression) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *NodeQOS) DeepCopyInto(out *NodeQOS) { *out = *in @@ -755,6 +788,7 @@ func (in *NodeQOSSpec) DeepCopyInto(out *NodeQOSSpec) { } in.ElasticCpuLimit.DeepCopyInto(&out.ElasticCpuLimit) in.MemoryLimit.DeepCopyInto(&out.MemoryLimit) + out.MemoryCompression = in.MemoryCompression in.NetLimits.DeepCopyInto(&out.NetLimits) return } diff --git a/pkg/generated/clientset/versioned/fake/register.go b/pkg/generated/clientset/versioned/fake/register.go index 59f35b9..e102649 100644 --- a/pkg/generated/clientset/versioned/fake/register.go +++ b/pkg/generated/clientset/versioned/fake/register.go @@ -31,14 +31,14 @@ var localSchemeBuilder = runtime.SchemeBuilder{ // AddToScheme adds all types of this clientset into the given scheme. This allows composition // of clientsets, like in: // -// import ( -// "k8s.io/client-go/kubernetes" -// clientsetscheme "k8s.io/client-go/kubernetes/scheme" -// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" -// ) +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kubernetes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) // -// kclientset, _ := kubernetes.NewForConfig(c) -// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// kclientset, _ := kubernetes.NewForConfig(c) +// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) // // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types // correctly. diff --git a/pkg/generated/clientset/versioned/scheme/register.go b/pkg/generated/clientset/versioned/scheme/register.go index 035184f..1b8d58d 100644 --- a/pkg/generated/clientset/versioned/scheme/register.go +++ b/pkg/generated/clientset/versioned/scheme/register.go @@ -31,14 +31,14 @@ var localSchemeBuilder = runtime.SchemeBuilder{ // AddToScheme adds all types of this clientset into the given scheme. This allows composition // of clientsets, like in: // -// import ( -// "k8s.io/client-go/kubernetes" -// clientsetscheme "k8s.io/client-go/kubernetes/scheme" -// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" -// ) +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kubernetes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) // -// kclientset, _ := kubernetes.NewForConfig(c) -// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// kclientset, _ := kubernetes.NewForConfig(c) +// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) // // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types // correctly.