Skip to content

Commit

Permalink
Enable cpu specification in jobConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
shunki-fujita committed Oct 18, 2023
1 parent 8b8123d commit 3ab8b12
Show file tree
Hide file tree
Showing 7 changed files with 108 additions and 0 deletions.
10 changes: 10 additions & 0 deletions api/v1beta2/job_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@ type JobConfig struct {
// +optional
Threads int `json:"threads,omitempty"`

// CPU is the amount of CPU requested for the Pod.
// +kubebuilder:default="4"
// +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
32 changes: 32 additions & 0 deletions charts/moco/templates/generated/crds/moco_crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2447,6 +2447,14 @@ spec:
required:
- bucketName
type: object
cpu:
anyOf:
- type: integer
- type: string
default: "4"
description: CPU is the amount of CPU requested for the Pod.
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 +2537,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 +13582,14 @@ spec:
required:
- bucketName
type: object
cpu:
anyOf:
- type: integer
- type: string
default: "4"
description: CPU is the amount of CPU requested for the Pod.
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 +13672,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
16 changes: 16 additions & 0 deletions config/crd/bases/moco.cybozu.com_backuppolicies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2644,6 +2644,14 @@ spec:
required:
- bucketName
type: object
cpu:
anyOf:
- type: integer
- type: string
default: "4"
description: CPU is the amount of CPU requested for the Pod.
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 +2742,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
16 changes: 16 additions & 0 deletions config/crd/bases/moco.cybozu.com_mysqlclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10425,6 +10425,14 @@ spec:
required:
- bucketName
type: object
cpu:
anyOf:
- type: integer
- type: string
default: "4"
description: CPU is the amount of CPU requested for the Pod.
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 +10524,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
Original file line number Diff line number Diff line change
Expand Up @@ -2643,6 +2643,14 @@ spec:
required:
- bucketName
type: object
cpu:
anyOf:
- type: integer
- type: string
default: "4"
description: CPU is the amount of CPU requested for the Pod.
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 @@ -2733,6 +2741,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
Original file line number Diff line number Diff line change
Expand Up @@ -10435,6 +10435,14 @@ spec:
required:
- bucketName
type: object
cpu:
anyOf:
- type: integer
- type: string
default: "4"
description: CPU is the amount of CPU requested for the Pod.
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 @@ -10526,6 +10534,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
2 changes: 2 additions & 0 deletions docs/crd_mysqlcluster_v1beta2.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,8 @@ JobConfig is a set of parameters for backup and restore job Pods.
| bucketConfig | Specifies how to access an object storage bucket. | [BucketConfig](#bucketconfig) | true |
| workVolume | WorkVolume is the volume source for the working directory. Since the backup or restore task can use a lot of bytes in the working directory, You should always give a volume with enough capacity.\n\nThe recommended volume source is a generic ephemeral volume. https://kubernetes.io/docs/concepts/storage/ephemeral-volumes/#generic-ephemeral-volumes | [VolumeSourceApplyConfiguration](https://pkg.go.dev/k8s.io/client-go/applyconfigurations/core/v1#VolumeSourceApplyConfiguration) | true |
| threads | Threads is the number of threads used for backup or restoration. | int | false |
| cpu | Cpu is the amount of cpu requested for the Pod. | *[resource.Quantity](https://pkg.go.dev/k8s.io/apimachinery/pkg/api/resource#Quantity) | false |
| maxCpu | MaxCpu is the amount of maximum cpu requested for the Pod. | *[resource.Quantity](https://pkg.go.dev/k8s.io/apimachinery/pkg/api/resource#Quantity) | false |
| memory | Memory is the amount of memory requested for the Pod. | *[resource.Quantity](https://pkg.go.dev/k8s.io/apimachinery/pkg/api/resource#Quantity) | false |
| maxMemory | MaxMemory is the amount of maximum memory for the Pod. | *[resource.Quantity](https://pkg.go.dev/k8s.io/apimachinery/pkg/api/resource#Quantity) | false |
| envFrom | List of sources to populate environment variables in the container. The keys defined within a source must be a C_IDENTIFIER. All invalid keys will be reported as an event when the container is starting. When a key exists in multiple sources, the value associated with the last source will take precedence. Values defined by an Env with a duplicate key will take precedence.\n\nYou can configure S3 bucket access parameters through environment variables. See https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/config#EnvConfig | [][EnvFromSourceApplyConfiguration](https://pkg.go.dev/k8s.io/client-go/applyconfigurations/core/v1#EnvFromSourceApplyConfiguration) | false |
Expand Down

0 comments on commit 3ab8b12

Please sign in to comment.