From 671369067ee6dc09a227d898c5410f7b7e021640 Mon Sep 17 00:00:00 2001 From: RidRisR <79858083+RidRisR@users.noreply.github.com> Date: Wed, 4 Dec 2024 07:34:33 +0100 Subject: [PATCH] lint --- docs/api-references/docs.md | 45 +++++-------------- manifests/crd.yaml | 40 +++++++++++++++-- .../crd/v1/pingcap.com_compactbackups.yaml | 40 +++++++++++++++-- .../pingcap/v1alpha1/openapi_generated.go | 18 +++----- .../pingcap/v1alpha1/zz_generated.deepcopy.go | 5 +++ .../compact_backup_controller.go | 4 +- 6 files changed, 96 insertions(+), 56 deletions(-) diff --git a/docs/api-references/docs.md b/docs/api-references/docs.md index 57abb8805a9..0755f48c1a7 100644 --- a/docs/api-references/docs.md +++ b/docs/api-references/docs.md @@ -3447,6 +3447,7 @@ string

(Appears on: BackupSpec, +CompactSpec, RestoreSpec)

@@ -5544,17 +5545,6 @@ bool -version
- -string - - - -

Version specifies the tool image version used in compact Backup.

- - - - brImage
string @@ -5569,15 +5559,15 @@ For BR image, if it does not contain tag, Pod will use image ‘BrImage:${Ti -tikvImage
+br
-string + +BRConfig + -(Optional) -

TiKVImage specifies the tikv image used in compact Backup. -For examples spec.tikvImage: pingcap/tikv:v4.0.8

+

BRConfig is the configs for BR

@@ -5730,7 +5720,7 @@ CompactStatus CompactBackup)

-

BackupSpec contains the backup specification for a tidb cluster.

+

CompactSpec contains the backup specification for a tidb cluster.

@@ -5910,17 +5900,6 @@ bool - - - - diff --git a/manifests/crd.yaml b/manifests/crd.yaml index 23946573609..23ebbaa0f63 100644 --- a/manifests/crd.yaml +++ b/manifests/crd.yaml @@ -8208,6 +8208,42 @@ spec: default: 30m type: string type: object + br: + properties: + checkRequirements: + type: boolean + checksum: + type: boolean + cluster: + type: string + clusterNamespace: + type: string + concurrency: + format: int32 + type: integer + db: + type: string + logLevel: + type: string + onLine: + type: boolean + options: + items: + type: string + type: array + rateLimit: + type: integer + sendCredToTikv: + type: boolean + statusAddr: + type: string + table: + type: string + timeAgo: + type: string + required: + - cluster + type: object brImage: type: string concurrency: @@ -9199,8 +9235,6 @@ spec: type: string tikvGCLifeTime: type: string - tikvImage: - type: string tolerations: items: properties: @@ -9219,8 +9253,6 @@ spec: type: array useKMS: type: boolean - version: - type: string volumeBackupInitJobMaxActiveSeconds: default: 600 type: integer diff --git a/manifests/crd/v1/pingcap.com_compactbackups.yaml b/manifests/crd/v1/pingcap.com_compactbackups.yaml index e3b434ae2df..19ee6b2a4a2 100644 --- a/manifests/crd/v1/pingcap.com_compactbackups.yaml +++ b/manifests/crd/v1/pingcap.com_compactbackups.yaml @@ -1158,6 +1158,42 @@ spec: default: 30m type: string type: object + br: + properties: + checkRequirements: + type: boolean + checksum: + type: boolean + cluster: + type: string + clusterNamespace: + type: string + concurrency: + format: int32 + type: integer + db: + type: string + logLevel: + type: string + onLine: + type: boolean + options: + items: + type: string + type: array + rateLimit: + type: integer + sendCredToTikv: + type: boolean + statusAddr: + type: string + table: + type: string + timeAgo: + type: string + required: + - cluster + type: object brImage: type: string concurrency: @@ -2149,8 +2185,6 @@ spec: type: string tikvGCLifeTime: type: string - tikvImage: - type: string tolerations: items: properties: @@ -2169,8 +2203,6 @@ spec: type: array useKMS: type: boolean - version: - type: string volumeBackupInitJobMaxActiveSeconds: default: 600 type: integer diff --git a/pkg/apis/pingcap/v1alpha1/openapi_generated.go b/pkg/apis/pingcap/v1alpha1/openapi_generated.go index 9c2de35e064..cc705cd3a50 100644 --- a/pkg/apis/pingcap/v1alpha1/openapi_generated.go +++ b/pkg/apis/pingcap/v1alpha1/openapi_generated.go @@ -1706,7 +1706,7 @@ func schema_pkg_apis_pingcap_v1alpha1_CompactSpec(ref common.ReferenceCallback) return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "BackupSpec contains the backup specification for a tidb cluster.", + Description: "CompactSpec contains the backup specification for a tidb cluster.", Type: []string{"object"}, Properties: map[string]spec.Schema{ "resources": { @@ -1817,13 +1817,6 @@ func schema_pkg_apis_pingcap_v1alpha1_CompactSpec(ref common.ReferenceCallback) }, }, }, - "version": { - SchemaProps: spec.SchemaProps{ - Description: "Version specifies the tool image version used in compact `Backup`.", - Type: []string{"string"}, - Format: "", - }, - }, "brImage": { SchemaProps: spec.SchemaProps{ Description: "BrImage specifies the br image used in compact `Backup`. For examples `spec.brImage: pingcap/br:v4.0.8` For BR image, if it does not contain tag, Pod will use image 'BrImage:${TiKV_Version}'.", @@ -1831,11 +1824,10 @@ func schema_pkg_apis_pingcap_v1alpha1_CompactSpec(ref common.ReferenceCallback) Format: "", }, }, - "tikvImage": { + "br": { SchemaProps: spec.SchemaProps{ - Description: "TiKVImage specifies the tikv image used in compact `Backup`. For examples `spec.tikvImage: pingcap/tikv:v4.0.8`", - Type: []string{"string"}, - Format: "", + Description: "BRConfig is the configs for BR", + Ref: ref("github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.BRConfig"), }, }, "imagePullSecrets": { @@ -1931,7 +1923,7 @@ func schema_pkg_apis_pingcap_v1alpha1_CompactSpec(ref common.ReferenceCallback) }, }, Dependencies: []string{ - "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.AzblobStorageProvider", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.BackoffRetryPolicy", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.GcsStorageProvider", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.LocalStorageProvider", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.S3StorageProvider", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TiDBAccessConfig", "k8s.io/api/core/v1.Affinity", "k8s.io/api/core/v1.EnvVar", "k8s.io/api/core/v1.LocalObjectReference", "k8s.io/api/core/v1.PodSecurityContext", "k8s.io/api/core/v1.ResourceRequirements", "k8s.io/api/core/v1.Toleration", "k8s.io/api/core/v1.Volume", "k8s.io/api/core/v1.VolumeMount"}, + "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.AzblobStorageProvider", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.BRConfig", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.BackoffRetryPolicy", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.GcsStorageProvider", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.LocalStorageProvider", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.S3StorageProvider", "github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1.TiDBAccessConfig", "k8s.io/api/core/v1.Affinity", "k8s.io/api/core/v1.EnvVar", "k8s.io/api/core/v1.LocalObjectReference", "k8s.io/api/core/v1.PodSecurityContext", "k8s.io/api/core/v1.ResourceRequirements", "k8s.io/api/core/v1.Toleration", "k8s.io/api/core/v1.Volume", "k8s.io/api/core/v1.VolumeMount"}, } } diff --git a/pkg/apis/pingcap/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/pingcap/v1alpha1/zz_generated.deepcopy.go index 51b722ada76..fbb1d8acf16 100644 --- a/pkg/apis/pingcap/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/pingcap/v1alpha1/zz_generated.deepcopy.go @@ -960,6 +960,11 @@ func (in *CompactSpec) DeepCopyInto(out *CompactSpec) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + if in.BR != nil { + in, out := &in.BR, &out.BR + *out = new(BRConfig) + (*in).DeepCopyInto(*out) + } if in.ImagePullSecrets != nil { in, out := &in.ImagePullSecrets, &out.ImagePullSecrets *out = make([]v1.LocalObjectReference, len(*in)) diff --git a/pkg/controller/compactbackup/compact_backup_controller.go b/pkg/controller/compactbackup/compact_backup_controller.go index 0c6964a2fdb..a78cad4f5ab 100644 --- a/pkg/controller/compactbackup/compact_backup_controller.go +++ b/pkg/controller/compactbackup/compact_backup_controller.go @@ -395,8 +395,8 @@ func (c *Controller) makeBackupJob(backup *v1alpha1.CompactBackup) (*batchv1.Job }, Containers: []corev1.Container{ { - Name: "backup-manager", - Image: c.deps.CLIConfig.TiDBBackupManagerImage, + Name: "backup-manager", + Image: c.deps.CLIConfig.TiDBBackupManagerImage, Args: args, Env: envVars, VolumeMounts: volumeMounts,
-version
- -string - -
-

Version specifies the tool image version used in compact Backup.

-
brImage
string @@ -5935,15 +5914,15 @@ For BR image, if it does not contain tag, Pod will use image ‘BrImage:${Ti
-tikvImage
+br
-string + +BRConfig +
-(Optional) -

TiKVImage specifies the tikv image used in compact Backup. -For examples spec.tikvImage: pingcap/tikv:v4.0.8

+

BRConfig is the configs for BR