Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(overcommit): add TimeBounds for cron overcommit #95

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,16 @@ spec:
spec:
description: NodeOvercommitConfigSpec is a description of a NodeOvercommitConfig
properties:
CronConsistency:
description: If CronConsistency is true, controller will ensure ResourceOvercommitRatio
is consistent with the configuration of the TimeBound that should
have been executed last time
type: boolean
StartingDeadlineSeconds:
description: controller is not going to schedule anything below now
- StartingDeadlineSeconds
format: int64
type: integer
nodeOvercommitSelectorVal:
description: NodeOvercommitSelectorVal is the value of node label
selector with key consts.NodeOvercommitSelectorKey, it decides whether
Expand All @@ -57,9 +67,47 @@ spec:
ratio that needs to inject into Node.Annotations cpu,memory are
supported.
type: object
timeBounds:
description: TimeBounds supports dynamically adjusting ResourceOvercommitRatio
items:
properties:
bounds:
items:
properties:
cronTab:
description: 'CronTab support standardSpec, requires 5
entries representing: minute, hour, day of month, month
and day of week'
type: string
resourceOvercommitRatio:
additionalProperties:
type: string
description: Node overcommit ratio will be set as ResourceOvercommitRatio
when CronTab is triggered cpu,memory are supported.
type: object
required:
- cronTab
type: object
type: array
end:
format: date-time
type: string
start:
description: TimeBound is valid between Start and End
format: date-time
type: string
type: object
type: array
required:
- CronConsistency
type: object
status:
properties:
lastScheduleTime:
description: LastScheduleTime recorded the time when the cronTab was
triggered last time
format: date-time
type: string
matchedNodeList:
description: NodeList which the nodeOvercommitConfig rules matched
items:
Expand Down
36 changes: 36 additions & 0 deletions pkg/apis/overcommit/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,47 @@ type NodeOvercommitConfigSpec struct {
// cpu,memory are supported.
// +optional
ResourceOvercommitRatio map[v1.ResourceName]string `json:"resourceOvercommitRatio,omitempty"`

// TimeBounds supports dynamically adjusting ResourceOvercommitRatio
// +optional
TimeBounds []TimeBound `json:"timeBounds,omitempty"`

// If CronConsistency is true, controller will ensure ResourceOvercommitRatio is consistent with the configuration of the TimeBound that should have been executed last time
CronConsistency bool `json:"CronConsistency"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Field names should start with a lowercase letter.


// controller is not going to schedule anything below now - StartingDeadlineSeconds
StartingDeadlineSeconds *int64 `json:"StartingDeadlineSeconds,omitempty"`
}

type NodeOvercommitConfigStatus struct {
// NodeList which the nodeOvercommitConfig rules matched
MatchedNodeList []string `json:"matchedNodeList,omitempty"`

// LastScheduleTime recorded the time when the cronTab was triggered last time
LastScheduleTime *metav1.Time `json:"lastScheduleTime,omitempty"`
}

type TimeBound struct {
// TimeBound is valid between Start and End
// +optional
Start *metav1.Time `json:"start,omitempty"`

// +optional
End *metav1.Time `json:"end,omitempty"`

// +optional
Bounds []Bound `json:"bounds,omitempty"`
}

type Bound struct {
// CronTab support standardSpec, requires 5 entries
// representing: minute, hour, day of month, month and day of week
CronTab string `json:"cronTab"`

// Node overcommit ratio will be set as ResourceOvercommitRatio when CronTab is triggered
// cpu,memory are supported.
// +optional
ResourceOvercommitRatio map[v1.ResourceName]string `json:"resourceOvercommitRatio,omitempty"`
}

// +genclient
Expand Down
70 changes: 70 additions & 0 deletions pkg/apis/overcommit/v1alpha1/zz_generated.deepcopy.go

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

Loading