Skip to content

Commit

Permalink
chore: refactor the limit and request (#55)
Browse files Browse the repository at this point in the history
  • Loading branch information
fengluodb authored Mar 13, 2024
1 parent 5778228 commit ba8654f
Show file tree
Hide file tree
Showing 25 changed files with 299 additions and 95 deletions.
10 changes: 3 additions & 7 deletions api/v1alpha1/fio_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,9 @@ type FioSpec struct {
// +optional
Tolerations []corev1.Toleration `json:"tolerations,omitempty" protobuf:"bytes,22,opt,name=tolerations"`

// If specified, the pod's cpu.
// +optional
Cpu string `json:"cpu,omitempty" protobuf:"bytes,23,opt,name=cpu"`

// If specified, the pod's memory.
// +optional
Memory string `json:"memory,omitempty" protobuf:"bytes,24,opt,name=memory"`
// the resource requirements for the benchmark
ResourceLimits *ResourceList `json:"resourceLimits,omitempty"`
ResourceRequests *ResourceList `json:"resourceRequests,omitempty"`
}

// FioStatus defines the observed state of Fio
Expand Down
10 changes: 6 additions & 4 deletions api/v1alpha1/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,14 @@ type BenchCommon struct {
// +optional
Tolerations []corev1.Toleration `json:"tolerations,omitempty" protobuf:"bytes,22,opt,name=tolerations"`

// If specified, the pod's cpu.
// +optional
// the resource requirements for the benchmark
ResourceLimits *ResourceList `json:"resourceLimits,omitempty"`
ResourceRequests *ResourceList `json:"resourceRequests,omitempty"`
}

type ResourceList struct {
Cpu string `json:"cpu,omitempty" protobuf:"bytes,23,opt,name=cpu"`

// If specified, the pod's memory.
// +optional
Memory string `json:"memory,omitempty" protobuf:"bytes,24,opt,name=memory"`
}

Expand Down
35 changes: 35 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

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

18 changes: 14 additions & 4 deletions config/crd/bases/benchmark.apecloud.io_fios.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ spec:
default: 4k
pattern: ^[0-9]+[kKmMgG]?$
type: string
cpu:
type: string
direct:
default: true
type: boolean
Expand All @@ -46,15 +44,27 @@ spec:
ioengine:
default: psync
type: string
memory:
type: string
numjobs:
default:
- 1
items:
type: integer
minItems: 1
type: array
resourceLimits:
properties:
cpu:
type: string
memory:
type: string
type: object
resourceRequests:
properties:
cpu:
type: string
memory:
type: string
type: object
runtime:
minimum: 0
type: integer
Expand Down
18 changes: 14 additions & 4 deletions config/crd/bases/benchmark.apecloud.io_pgbenches.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ spec:
connect:
default: false
type: boolean
cpu:
type: string
duration:
default: 60
minimum: 0
Expand All @@ -58,8 +56,20 @@ spec:
items:
type: string
type: array
memory:
type: string
resourceLimits:
properties:
cpu:
type: string
memory:
type: string
type: object
resourceRequests:
properties:
cpu:
type: string
memory:
type: string
type: object
scale:
default: 1
minimum: 1
Expand Down
18 changes: 14 additions & 4 deletions config/crd/bases/benchmark.apecloud.io_redisbenches.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ spec:
type: integer
minItems: 1
type: array
cpu:
type: string
dataSize:
default: 3
minimum: 1
Expand All @@ -57,8 +55,6 @@ spec:
type: array
keySpace:
type: integer
memory:
type: string
pipeline:
default: 1
minimum: 1
Expand All @@ -70,6 +66,20 @@ spec:
default: 100000
minimum: 1
type: integer
resourceLimits:
properties:
cpu:
type: string
memory:
type: string
type: object
resourceRequests:
properties:
cpu:
type: string
memory:
type: string
type: object
step:
default: all
enum:
Expand Down
18 changes: 14 additions & 4 deletions config/crd/bases/benchmark.apecloud.io_sysbenches.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,27 @@ spec:
type: object
spec:
properties:
cpu:
type: string
duration:
minimum: 1
type: integer
extraArgs:
items:
type: string
type: array
memory:
type: string
resourceLimits:
properties:
cpu:
type: string
memory:
type: string
type: object
resourceRequests:
properties:
cpu:
type: string
memory:
type: string
type: object
size:
type: integer
step:
Expand Down
18 changes: 14 additions & 4 deletions config/crd/bases/benchmark.apecloud.io_tpccs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ spec:
type: object
spec:
properties:
cpu:
type: string
delivery:
default: 4
maximum: 100
Expand All @@ -57,8 +55,6 @@ spec:
default: 0
minimum: 0
type: integer
memory:
type: string
newOrder:
default: 45
maximum: 100
Expand All @@ -74,6 +70,20 @@ spec:
maximum: 100
minimum: 0
type: integer
resourceLimits:
properties:
cpu:
type: string
memory:
type: string
type: object
resourceRequests:
properties:
cpu:
type: string
memory:
type: string
type: object
step:
default: all
enum:
Expand Down
18 changes: 14 additions & 4 deletions config/crd/bases/benchmark.apecloud.io_tpches.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,24 @@ spec:
type: object
spec:
properties:
cpu:
type: string
extraArgs:
items:
type: string
type: array
memory:
type: string
resourceLimits:
properties:
cpu:
type: string
memory:
type: string
type: object
resourceRequests:
properties:
cpu:
type: string
memory:
type: string
type: object
sizes:
default:
- 1
Expand Down
18 changes: 14 additions & 4 deletions config/crd/bases/benchmark.apecloud.io_ycsbs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ spec:
type: object
spec:
properties:
cpu:
type: string
extraArgs:
items:
type: string
Expand All @@ -49,8 +47,6 @@ spec:
maximum: 100
minimum: 0
type: integer
memory:
type: string
operationCount:
default: 10000
minimum: 1
Expand All @@ -69,6 +65,20 @@ spec:
default: 10000
minimum: 1
type: integer
resourceLimits:
properties:
cpu:
type: string
memory:
type: string
type: object
resourceRequests:
properties:
cpu:
type: string
memory:
type: string
type: object
scanProportion:
default: 0
maximum: 100
Expand Down
18 changes: 14 additions & 4 deletions deploy/helm/crds/benchmark.apecloud.io_fios.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ spec:
default: 4k
pattern: ^[0-9]+[kKmMgG]?$
type: string
cpu:
type: string
direct:
default: true
type: boolean
Expand All @@ -46,15 +44,27 @@ spec:
ioengine:
default: psync
type: string
memory:
type: string
numjobs:
default:
- 1
items:
type: integer
minItems: 1
type: array
resourceLimits:
properties:
cpu:
type: string
memory:
type: string
type: object
resourceRequests:
properties:
cpu:
type: string
memory:
type: string
type: object
runtime:
minimum: 0
type: integer
Expand Down
Loading

0 comments on commit ba8654f

Please sign in to comment.