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

Enable cpu specification in jobConfig #582

Merged
merged 1 commit into from
Oct 25, 2023
Merged
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
11 changes: 11 additions & 0 deletions api/v1beta1/job_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,17 @@ type JobConfig struct {
// +optional
Threads int `json:"threads,omitempty"`

// CPU is the amount of CPU requested for the Pod.
// +kubebuilder:default=4
// +nullable
// +optional
CPU *resource.Quantity `json:"cpu,omitempty"`

// MaxCPU is the amount of maximum CPU for the Pod.
// +nullable
// +optional
MaxCPU *resource.Quantity `json:"maxCpu,omitempty"`

// Memory is the amount of memory requested for the Pod.
// +kubebuilder:default="4Gi"
// +nullable
Expand Down
4 changes: 4 additions & 0 deletions api/v1beta1/zz_generated.conversion.go

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

10 changes: 10 additions & 0 deletions api/v1beta1/zz_generated.deepcopy.go

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

3 changes: 3 additions & 0 deletions api/v1beta2/backuppolicy_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ var _ = Describe("BackupPolicy Webhook", func() {
Expect(err).NotTo(HaveOccurred())

Expect(r.Spec.JobConfig.Threads).To(Equal(4))
Expect(r.Spec.JobConfig.CPU).NotTo(BeNil())
Expect(r.Spec.JobConfig.CPU.Value()).To(Equal(int64(4)))
Expect(r.Spec.JobConfig.MaxCPU).To(BeNil())
Expect(r.Spec.JobConfig.Memory).NotTo(BeNil())
Expect(r.Spec.JobConfig.Memory.Value()).To(Equal(int64(4) << 30))
Expect(r.Spec.JobConfig.MaxMemory).To(BeNil())
Expand Down
11 changes: 11 additions & 0 deletions api/v1beta2/job_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,17 @@ type JobConfig struct {
// +optional
Threads int `json:"threads,omitempty"`

// CPU is the amount of CPU requested for the Pod.
// +kubebuilder:default=4
// +nullable
// +optional
CPU *resource.Quantity `json:"cpu,omitempty"`

// MaxCPU is the amount of maximum CPU for the Pod.
// +nullable
// +optional
MaxCPU *resource.Quantity `json:"maxCpu,omitempty"`

// Memory is the amount of memory requested for the Pod.
// +kubebuilder:default="4Gi"
// +nullable
Expand Down
10 changes: 10 additions & 0 deletions api/v1beta2/zz_generated.deepcopy.go

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

68 changes: 68 additions & 0 deletions charts/moco/templates/generated/crds/moco_crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,15 @@ spec:
required:
- bucketName
type: object
cpu:
anyOf:
- type: integer
- type: string
default: 4
description: CPU is the amount of CPU requested for the Pod.
nullable: true
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
env:
description: List of environment variables to set in the contai
items:
Expand Down Expand Up @@ -516,6 +525,14 @@ spec:
type: object
type: object
type: array
maxCpu:
anyOf:
- type: integer
- type: string
description: MaxCPU is the amount of maximum CPU for the Pod.
nullable: true
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
maxMemory:
anyOf:
- type: integer
Expand Down Expand Up @@ -2447,6 +2464,15 @@ spec:
required:
- bucketName
type: object
cpu:
anyOf:
- type: integer
- type: string
default: 4
description: CPU is the amount of CPU requested for the Pod.
nullable: true
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
env:
description: List of environment variables to set in the contai
items:
Expand Down Expand Up @@ -2529,6 +2555,14 @@ spec:
type: object
type: object
type: array
maxCpu:
anyOf:
- type: integer
- type: string
description: MaxCPU is the amount of maximum CPU for the Pod.
nullable: true
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
maxMemory:
anyOf:
- type: integer
Expand Down Expand Up @@ -7699,6 +7733,15 @@ spec:
required:
- bucketName
type: object
cpu:
anyOf:
- type: integer
- type: string
default: 4
description: CPU is the amount of CPU requested for the Pod.
nullable: true
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
env:
description: List of environment variables to set in the contai
items:
Expand Down Expand Up @@ -7781,6 +7824,14 @@ spec:
type: object
type: object
type: array
maxCpu:
anyOf:
- type: integer
- type: string
description: MaxCPU is the amount of maximum CPU for the Pod.
nullable: true
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
maxMemory:
anyOf:
- type: integer
Expand Down Expand Up @@ -13566,6 +13617,15 @@ spec:
required:
- bucketName
type: object
cpu:
anyOf:
- type: integer
- type: string
default: 4
description: CPU is the amount of CPU requested for the Pod.
nullable: true
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
env:
description: List of environment variables to set in the contai
items:
Expand Down Expand Up @@ -13648,6 +13708,14 @@ spec:
type: object
type: object
type: array
maxCpu:
anyOf:
- type: integer
- type: string
description: MaxCPU is the amount of maximum CPU for the Pod.
nullable: true
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
maxMemory:
anyOf:
- type: integer
Expand Down
34 changes: 34 additions & 0 deletions config/crd/bases/moco.cybozu.com_backuppolicies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,15 @@ spec:
required:
- bucketName
type: object
cpu:
anyOf:
- type: integer
- type: string
default: 4
description: CPU is the amount of CPU requested for the Pod.
nullable: true
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
env:
description: List of environment variables to set in the contai
items:
Expand Down Expand Up @@ -564,6 +573,14 @@ spec:
type: object
type: object
type: array
maxCpu:
anyOf:
- type: integer
- type: string
description: MaxCPU is the amount of maximum CPU for the Pod.
nullable: true
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
maxMemory:
anyOf:
- type: integer
Expand Down Expand Up @@ -2644,6 +2661,15 @@ spec:
required:
- bucketName
type: object
cpu:
anyOf:
- type: integer
- type: string
default: 4
description: CPU is the amount of CPU requested for the Pod.
nullable: true
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
env:
description: List of environment variables to set in the contai
items:
Expand Down Expand Up @@ -2734,6 +2760,14 @@ spec:
type: object
type: object
type: array
maxCpu:
anyOf:
- type: integer
- type: string
description: MaxCPU is the amount of maximum CPU for the Pod.
nullable: true
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
maxMemory:
anyOf:
- type: integer
Expand Down
34 changes: 34 additions & 0 deletions config/crd/bases/moco.cybozu.com_mysqlclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4011,6 +4011,15 @@ spec:
required:
- bucketName
type: object
cpu:
anyOf:
- type: integer
- type: string
default: 4
description: CPU is the amount of CPU requested for the Pod.
nullable: true
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
env:
description: List of environment variables to set in the contai
items:
Expand Down Expand Up @@ -4102,6 +4111,14 @@ spec:
type: object
type: object
type: array
maxCpu:
anyOf:
- type: integer
- type: string
description: MaxCPU is the amount of maximum CPU for the Pod.
nullable: true
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
maxMemory:
anyOf:
- type: integer
Expand Down Expand Up @@ -10425,6 +10442,15 @@ spec:
required:
- bucketName
type: object
cpu:
anyOf:
- type: integer
- type: string
default: 4
description: CPU is the amount of CPU requested for the Pod.
nullable: true
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
env:
description: List of environment variables to set in the contai
items:
Expand Down Expand Up @@ -10516,6 +10542,14 @@ spec:
type: object
type: object
type: array
maxCpu:
anyOf:
- type: integer
- type: string
description: MaxCPU is the amount of maximum CPU for the Pod.
nullable: true
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
maxMemory:
anyOf:
- type: integer
Expand Down
Loading