From aba2252cd09f6077913839cba2563c1f6d0aeb87 Mon Sep 17 00:00:00 2001 From: DanielZhangQD Date: Thu, 19 Dec 2019 20:22:54 +0800 Subject: [PATCH] support new br options --- cmd/backup-manager/app/util/remote.go | 12 ------- cmd/backup-manager/app/util/util.go | 12 +++---- manifests/crd.yaml | 32 +++++++++++++++---- .../pingcap/v1alpha1/openapi_generated.go | 27 ++++++++++++++-- pkg/apis/pingcap/v1alpha1/types.go | 12 +++++-- .../pingcap/v1alpha1/zz_generated.deepcopy.go | 10 ++++++ 6 files changed, 75 insertions(+), 30 deletions(-) diff --git a/cmd/backup-manager/app/util/remote.go b/cmd/backup-manager/app/util/remote.go index 71e75f6857b..ecdd13c98d8 100644 --- a/cmd/backup-manager/app/util/remote.go +++ b/cmd/backup-manager/app/util/remote.go @@ -28,18 +28,6 @@ import ( ) const ( - accessKey = "access_key" - secretAccessKey = "secret_access_key" - regionKey = "region" - insecureKey = "insecure" - providerKey = "provider" - prefixKey = "prefix" - endpointKey = "endpoint" - awsKey = "aws" - aliKey = "alibaba" - accessKeyEnv = "AWS_ACCESS_KEY_ID" - secretAccessKeyEnv = "AWS_SECRET_ACCESS_KEY" - maxRetries = 3 // number of retries to make of operations ) diff --git a/cmd/backup-manager/app/util/util.go b/cmd/backup-manager/app/util/util.go index aef71adc4ef..55fe0d537af 100644 --- a/cmd/backup-manager/app/util/util.go +++ b/cmd/backup-manager/app/util/util.go @@ -128,15 +128,15 @@ func ConstructBRGlobalOptions(backup *v1alpha1.Backup) ([]string, string, error) if config.Key != "" { args = append(args, fmt.Sprintf("--key=%s", config.Key)) } - // Do not set log-file, backup-manager needs to get backup - // position from the output of BR with info log-level - // if config.LogFile != "" { - // args = append(args, fmt.Sprintf("--log-file=%s", config.LogFile)) - // } - args = append(args, "--log-level=info") + if config.LogLevel != "" { + args = append(args, fmt.Sprintf("--log-level=%s", config.LogLevel)) + } if config.StatusAddr != "" { args = append(args, fmt.Sprintf("--status-addr=%s", config.StatusAddr)) } + if config.SendCredToTikv != nil { + args = append(args, fmt.Sprintf("--send-credentials-to-tikv=%t", *config.SendCredToTikv)) + } s, path, err := getRemoteStorage(backup) if err != nil { return nil, "", err diff --git a/manifests/crd.yaml b/manifests/crd.yaml index 8c1ed0bf6f7..c07a714415e 100644 --- a/manifests/crd.yaml +++ b/manifests/crd.yaml @@ -2390,19 +2390,29 @@ spec: key: description: Key is the private key path for TLS connection type: string + logLevel: + description: LogLevel is the log level + type: string + onLine: + description: OnLine specifies whether online during restore + type: boolean pd: description: PDAddress is the PD address of the tidb cluster type: string - ratelimit: + rateLimit: description: RateLimit is the rate limit of the backup task, MB/s per node format: int32 type: integer - status-addr: + sendCredToTikv: + description: SendCredToTikv specifies whether to send credentials + to TiKV + type: boolean + statusAddr: description: StatusAddr is the HTTP listening address for the status report service. Set to empty string to disable type: string - timeago: + timeAgo: description: TimeAgo is the history version of the backup task, e.g. 1m, 1h type: string @@ -2760,19 +2770,29 @@ spec: key: description: Key is the private key path for TLS connection type: string + logLevel: + description: LogLevel is the log level + type: string + onLine: + description: OnLine specifies whether online during restore + type: boolean pd: description: PDAddress is the PD address of the tidb cluster type: string - ratelimit: + rateLimit: description: RateLimit is the rate limit of the backup task, MB/s per node format: int32 type: integer - status-addr: + sendCredToTikv: + description: SendCredToTikv specifies whether to send credentials + to TiKV + type: boolean + statusAddr: description: StatusAddr is the HTTP listening address for the status report service. Set to empty string to disable type: string - timeago: + timeAgo: description: TimeAgo is the history version of the backup task, e.g. 1m, 1h type: string diff --git a/pkg/apis/pingcap/v1alpha1/openapi_generated.go b/pkg/apis/pingcap/v1alpha1/openapi_generated.go index 6864b9314bb..7a66c5913a8 100644 --- a/pkg/apis/pingcap/v1alpha1/openapi_generated.go +++ b/pkg/apis/pingcap/v1alpha1/openapi_generated.go @@ -385,7 +385,14 @@ func schema_pkg_apis_pingcap_v1alpha1_BRConfig(ref common.ReferenceCallback) com Format: "", }, }, - "status-addr": { + "logLevel": { + SchemaProps: spec.SchemaProps{ + Description: "LogLevel is the log level", + Type: []string{"string"}, + Format: "", + }, + }, + "statusAddr": { SchemaProps: spec.SchemaProps{ Description: "StatusAddr is the HTTP listening address for the status report service. Set to empty string to disable", Type: []string{"string"}, @@ -399,14 +406,14 @@ func schema_pkg_apis_pingcap_v1alpha1_BRConfig(ref common.ReferenceCallback) com Format: "int64", }, }, - "ratelimit": { + "rateLimit": { SchemaProps: spec.SchemaProps{ Description: "RateLimit is the rate limit of the backup task, MB/s per node", Type: []string{"integer"}, Format: "int32", }, }, - "timeago": { + "timeAgo": { SchemaProps: spec.SchemaProps{ Description: "TimeAgo is the history version of the backup task, e.g. 1m, 1h", Type: []string{"string"}, @@ -420,6 +427,20 @@ func schema_pkg_apis_pingcap_v1alpha1_BRConfig(ref common.ReferenceCallback) com Format: "", }, }, + "sendCredToTikv": { + SchemaProps: spec.SchemaProps{ + Description: "SendCredToTikv specifies whether to send credentials to TiKV", + Type: []string{"boolean"}, + Format: "", + }, + }, + "onLine": { + SchemaProps: spec.SchemaProps{ + Description: "OnLine specifies whether online during restore", + Type: []string{"boolean"}, + Format: "", + }, + }, }, Required: []string{"pd"}, }, diff --git a/pkg/apis/pingcap/v1alpha1/types.go b/pkg/apis/pingcap/v1alpha1/types.go index 6b9bfdcaf7d..88b79f0799d 100644 --- a/pkg/apis/pingcap/v1alpha1/types.go +++ b/pkg/apis/pingcap/v1alpha1/types.go @@ -632,16 +632,22 @@ type BRConfig struct { Cert string `json:"cert,omitempty"` // Key is the private key path for TLS connection Key string `json:"key,omitempty"` + // LogLevel is the log level + LogLevel string `json:"logLevel,omitempty"` // StatusAddr is the HTTP listening address for the status report service. Set to empty string to disable - StatusAddr string `json:"status-addr,omitempty"` + StatusAddr string `json:"statusAddr,omitempty"` // Concurrency is the size of thread pool on each node that execute the backup task Concurrency *uint32 `json:"concurrency,omitempty"` // RateLimit is the rate limit of the backup task, MB/s per node - RateLimit *uint `json:"ratelimit,omitempty"` + RateLimit *uint `json:"rateLimit,omitempty"` // TimeAgo is the history version of the backup task, e.g. 1m, 1h - TimeAgo string `json:"timeago,omitempty"` + TimeAgo string `json:"timeAgo,omitempty"` // Checksum specifies whether to run checksum after backup Checksum *bool `json:"checksum,omitempty"` + // SendCredToTikv specifies whether to send credentials to TiKV + SendCredToTikv *bool `json:"sendCredToTikv,omitempty"` + // OnLine specifies whether online during restore + OnLine *bool `json:"onLine,omitempty"` } // BackupConditionType represents a valid condition of a Backup. diff --git a/pkg/apis/pingcap/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/pingcap/v1alpha1/zz_generated.deepcopy.go index 9c41fbee6c9..088d312ad00 100644 --- a/pkg/apis/pingcap/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/pingcap/v1alpha1/zz_generated.deepcopy.go @@ -42,6 +42,16 @@ func (in *BRConfig) DeepCopyInto(out *BRConfig) { *out = new(bool) **out = **in } + if in.SendCredToTikv != nil { + in, out := &in.SendCredToTikv, &out.SendCredToTikv + *out = new(bool) + **out = **in + } + if in.OnLine != nil { + in, out := &in.OnLine, &out.OnLine + *out = new(bool) + **out = **in + } return }