-
Notifications
You must be signed in to change notification settings - Fork 500
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix br log issue and include both 3.1 and 4.0 br in the tidb-backup-manager image #2213
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,19 +2,15 @@ FROM pingcap/tidb-enterprise-tools:latest | |
ARG VERSION=v1.51.0 | ||
ARG SHUSH_VERSION=v1.4.0 | ||
ARG TOOLKIT_VERSION=v3.0.12 | ||
ARG TOOLKIT_V31=v3.1.0-rc | ||
ARG TOOLKIT_V40=v4.0.0-rc | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But they are actually the toolkit version, BR binaries are included in the toolkit packages. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TOOLKIT has alot of tools I think TOOLKIT is all right. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, we extract I can't understand the differences between these similar arguments.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If with |
||
RUN apk update && apk add ca-certificates | ||
|
||
RUN wget -nv https://github.com/ncw/rclone/releases/download/${VERSION}/rclone-${VERSION}-linux-amd64.zip \ | ||
&& unzip rclone-${VERSION}-linux-amd64.zip \ | ||
&& mv rclone-${VERSION}-linux-amd64/rclone /usr/local/bin \ | ||
&& chmod 755 /usr/local/bin/rclone \ | ||
&& rm -rf rclone-${VERSION}-linux-amd64.zip rclone-${VERSION}-linux-amd64 | ||
|
||
RUN wget -nv http://download.pingcap.org/br-latest-linux-amd64.tar.gz \ | ||
&& tar -xzf br-latest-linux-amd64.tar.gz \ | ||
&& mv bin/br /usr/local/bin \ | ||
&& chmod 755 /usr/local/bin/br \ | ||
&& rm -rf br-latest-linux-amd64.tar.gz | ||
&& unzip rclone-${VERSION}-linux-amd64.zip \ | ||
&& mv rclone-${VERSION}-linux-amd64/rclone /usr/local/bin \ | ||
&& chmod 755 /usr/local/bin/rclone \ | ||
&& rm -rf rclone-${VERSION}-linux-amd64.zip rclone-${VERSION}-linux-amd64 | ||
|
||
RUN wget -nv https://github.com/realestate-com-au/shush/releases/download/${SHUSH_VERSION}/shush_linux_amd64 \ | ||
&& mv shush_linux_amd64 /usr/local/bin/shush \ | ||
|
@@ -29,6 +25,22 @@ RUN \ | |
&& rm -rf tidb-toolkit-${TOOLKIT_VERSION}-linux-amd64.tar.gz \ | ||
&& rm -rf tidb-toolkit-${TOOLKIT_VERSION}-linux-amd64 | ||
|
||
RUN \ | ||
wget -nv https://download.pingcap.org/tidb-toolkit-${TOOLKIT_V31}-linux-amd64.tar.gz \ | ||
&& tar -xzf tidb-toolkit-${TOOLKIT_V31}-linux-amd64.tar.gz \ | ||
&& mv tidb-toolkit-${TOOLKIT_V31}-linux-amd64/bin/br /usr/local/bin/br31 \ | ||
&& chmod 755 /usr/local/bin/br31 \ | ||
&& rm -rf tidb-toolkit-${TOOLKIT_V31}-linux-amd64.tar.gz \ | ||
&& rm -rf tidb-toolkit-${TOOLKIT_V31}-linux-amd64 | ||
|
||
RUN \ | ||
wget -nv https://download.pingcap.org/tidb-toolkit-${TOOLKIT_V40}-linux-amd64.tar.gz \ | ||
&& tar -xzf tidb-toolkit-${TOOLKIT_V40}-linux-amd64.tar.gz \ | ||
&& mv tidb-toolkit-${TOOLKIT_V40}-linux-amd64/bin/br /usr/local/bin/br40 \ | ||
&& chmod 755 /usr/local/bin/br40 \ | ||
&& rm -rf tidb-toolkit-${TOOLKIT_V40}-linux-amd64.tar.gz \ | ||
&& rm -rf tidb-toolkit-${TOOLKIT_V40}-linux-amd64 | ||
|
||
COPY bin/tidb-backup-manager /tidb-backup-manager | ||
COPY entrypoint.sh /entrypoint.sh | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ package backup | |
|
||
import ( | ||
"fmt" | ||
"strings" | ||
|
||
"github.com/pingcap/tidb-operator/pkg/apis/pingcap/v1alpha1" | ||
"github.com/pingcap/tidb-operator/pkg/backup" | ||
|
@@ -269,6 +270,13 @@ func (bm *backupManager) makeBackupJob(backup *v1alpha1.Backup) (*batchv1.Job, s | |
return nil, fmt.Sprintf("failed to fetch tidbcluster %s/%s", backupNamespace, backup.Spec.BR.Cluster), err | ||
} | ||
|
||
var tikvVersion string | ||
tikvImage := tc.TiKVImage() | ||
imageVersion := strings.Split(tikvImage, ":") | ||
if len(imageVersion) == 2 { | ||
tikvVersion = imageVersion[1] | ||
} | ||
|
||
envVars, reason, err := backuputil.GenerateTidbPasswordEnv(ns, name, backup.Spec.From.SecretName, backup.Spec.UseKMS, bm.kubeCli) | ||
if err != nil { | ||
return nil, reason, err | ||
|
@@ -280,12 +288,19 @@ func (bm *backupManager) makeBackupJob(backup *v1alpha1.Backup) (*batchv1.Job, s | |
} | ||
|
||
envVars = append(envVars, storageEnv...) | ||
envVars = append(envVars, corev1.EnvVar{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. New version BR needs to set this env to print logs to stdout. |
||
Name: "BR_LOG_TO_TERM", | ||
Value: string(1), | ||
}) | ||
|
||
args := []string{ | ||
"backup", | ||
fmt.Sprintf("--namespace=%s", ns), | ||
fmt.Sprintf("--backupName=%s", name), | ||
} | ||
if tikvVersion != "" { | ||
args = append(args, fmt.Sprintf("--tikvVersion=%s", tikvVersion)) | ||
} | ||
|
||
backupLabel := label.NewBackup().Instance(backup.GetInstanceName()).BackupJob().Backup(name) | ||
volumeMounts := []corev1.VolumeMount{} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if
BR_LOG_TO_TERM
should be always set, set it here.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is a way, I think the current setting is OK because we can see the env from the job clearly, if set it here, we cannot know it without going through the code or getting into the Pod.