Skip to content

Commit

Permalink
Merge pull request #98 from yadzhang/feat/add_tmo_blockconfig
Browse files Browse the repository at this point in the history
feat(tmo) tmo block list support dynamic config
  • Loading branch information
xu282934741 authored Sep 11, 2024
2 parents 7c12399 + a8b8d33 commit d5c09c1
Show file tree
Hide file tree
Showing 5 changed files with 133 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,73 @@ spec:
x-kubernetes-list-map-keys:
- cgroupPath
x-kubernetes-list-type: map
blockConfig:
description: BlockConfig is a configuration for blocking tmo on
specified pods.
properties:
annotations:
description: Annotations indicates disable tmo if pods with
these annotations. The requirements are ORed.
items:
description: A label selector requirement is a selector
that contains values, a key, and an operator that relates
the key and values.
properties:
key:
description: key is the label key that the selector
applies to.
type: string
operator:
description: operator represents a key's relationship
to a set of values. Valid operators are In, NotIn,
Exists and DoesNotExist.
type: string
values:
description: values is an array of string values. If
the operator is In or NotIn, the values array must
be non-empty. If the operator is Exists or DoesNotExist,
the values array must be empty. This array is replaced
during a strategic merge patch.
items:
type: string
type: array
required:
- key
- operator
type: object
type: array
labels:
description: Labels indicates disable tmo if pods with these
labels. The requirements are ORed.
items:
description: A label selector requirement is a selector
that contains values, a key, and an operator that relates
the key and values.
properties:
key:
description: key is the label key that the selector
applies to.
type: string
operator:
description: operator represents a key's relationship
to a set of values. Valid operators are In, NotIn,
Exists and DoesNotExist.
type: string
values:
description: values is an array of string values. If
the operator is In or NotIn, the values array must
be non-empty. If the operator is Exists or DoesNotExist,
the values array must be empty. This array is replaced
during a strategic merge patch.
items:
type: string
type: array
required:
- key
- operator
type: object
type: array
type: object
qosLevelConfig:
description: QoSLevelConfig is a configuration for manipulating
TMO on Different QoS Level
Expand Down
19 changes: 17 additions & 2 deletions pkg/apis/config/v1alpha1/tmo.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ type TransparentMemoryOffloadingConfig struct {
// +listMapKey=cgroupPath
// +listType=map
CgroupConfig []CgroupConfig `json:"CgroupConfig,omitempty"`

// BlockConfig is a configuration for blocking tmo on specified pods.
// +optional
BlockConfig *BlockConfig `json:"blockConfig,omitempty"`
}

type QoSLevelConfig struct {
Expand Down Expand Up @@ -120,8 +124,9 @@ type TMOConfigDetail struct {
type TMOPolicyName string

const (
TMOPolicyNamePSI TMOPolicyName = "PSI"
TMOPolicyNameRefault TMOPolicyName = "Refault"
TMOPolicyNamePSI TMOPolicyName = "PSI"
TMOPolicyNameRefault TMOPolicyName = "Refault"
TMOPolicyNameIntegrated TMOPolicyName = "Integrated"
)

type PSIPolicyConf struct {
Expand All @@ -143,6 +148,16 @@ type RefaultPolicyConf struct {
ReclaimScanEfficiencyTarget *float64 `json:"reclaimScanEfficiencyTarget,omitempty"`
}

type BlockConfig struct {
// Labels indicates disable tmo if pods with these labels. The requirements are ORed.
// +optional
Labels []metav1.LabelSelectorRequirement `json:"labels,omitempty"`

// Annotations indicates disable tmo if pods with these annotations. The requirements are ORed.
// +optional
Annotations []metav1.LabelSelectorRequirement `json:"annotations,omitempty"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// TransparentMemoryOffloadingIndicators is indicator for transparent memory offloading
type TransparentMemoryOffloadingIndicators struct {
Expand Down
35 changes: 35 additions & 0 deletions pkg/apis/config/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/client/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/client/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 d5c09c1

Please sign in to comment.