diff --git a/api/v1beta2/job_types.go b/api/v1beta2/job_types.go index d947a327c..fd56f2b76 100644 --- a/api/v1beta2/job_types.go +++ b/api/v1beta2/job_types.go @@ -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 diff --git a/charts/moco/templates/generated/crds/moco_crds.yaml b/charts/moco/templates/generated/crds/moco_crds.yaml index 72eb87c2e..309779eea 100644 --- a/charts/moco/templates/generated/crds/moco_crds.yaml +++ b/charts/moco/templates/generated/crds/moco_crds.yaml @@ -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: @@ -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 @@ -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: @@ -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 diff --git a/config/crd/bases/moco.cybozu.com_backuppolicies.yaml b/config/crd/bases/moco.cybozu.com_backuppolicies.yaml index b1e71e593..e8d96cd71 100644 --- a/config/crd/bases/moco.cybozu.com_backuppolicies.yaml +++ b/config/crd/bases/moco.cybozu.com_backuppolicies.yaml @@ -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: @@ -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 diff --git a/config/crd/bases/moco.cybozu.com_mysqlclusters.yaml b/config/crd/bases/moco.cybozu.com_mysqlclusters.yaml index ab0859112..a1b36cb83 100644 --- a/config/crd/bases/moco.cybozu.com_mysqlclusters.yaml +++ b/config/crd/bases/moco.cybozu.com_mysqlclusters.yaml @@ -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: @@ -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 diff --git a/config/crd/tests/apiextensions.k8s.io_v1_customresourcedefinition_backuppolicies.moco.cybozu.com.yaml b/config/crd/tests/apiextensions.k8s.io_v1_customresourcedefinition_backuppolicies.moco.cybozu.com.yaml index a861ea025..b3099b131 100644 --- a/config/crd/tests/apiextensions.k8s.io_v1_customresourcedefinition_backuppolicies.moco.cybozu.com.yaml +++ b/config/crd/tests/apiextensions.k8s.io_v1_customresourcedefinition_backuppolicies.moco.cybozu.com.yaml @@ -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: @@ -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 diff --git a/config/crd/tests/apiextensions.k8s.io_v1_customresourcedefinition_mysqlclusters.moco.cybozu.com.yaml b/config/crd/tests/apiextensions.k8s.io_v1_customresourcedefinition_mysqlclusters.moco.cybozu.com.yaml index c6d62c033..d302ed9d1 100644 --- a/config/crd/tests/apiextensions.k8s.io_v1_customresourcedefinition_mysqlclusters.moco.cybozu.com.yaml +++ b/config/crd/tests/apiextensions.k8s.io_v1_customresourcedefinition_mysqlclusters.moco.cybozu.com.yaml @@ -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: @@ -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 diff --git a/docs/crd_mysqlcluster_v1beta2.md b/docs/crd_mysqlcluster_v1beta2.md index e4cc184b0..fffa2fbb7 100644 --- a/docs/crd_mysqlcluster_v1beta2.md +++ b/docs/crd_mysqlcluster_v1beta2.md @@ -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 |