Skip to content

Commit

Permalink
support new br options
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielZhangQD committed Dec 19, 2019
1 parent d9f91c4 commit aba2252
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 30 deletions.
12 changes: 0 additions & 12 deletions cmd/backup-manager/app/util/remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

Expand Down
12 changes: 6 additions & 6 deletions cmd/backup-manager/app/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
32 changes: 26 additions & 6 deletions manifests/crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
27 changes: 24 additions & 3 deletions pkg/apis/pingcap/v1alpha1/openapi_generated.go

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

12 changes: 9 additions & 3 deletions pkg/apis/pingcap/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
10 changes: 10 additions & 0 deletions pkg/apis/pingcap/v1alpha1/zz_generated.deepcopy.go

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

0 comments on commit aba2252

Please sign in to comment.