-
Notifications
You must be signed in to change notification settings - Fork 502
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
opt(operator-v2): Resolve BR todos #6086
Merged
+850
−453
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
1c1fd30
Resolve TODOs for BR on operator v2
ideascf 29e0456
fix BR job command
ideascf 3eae177
opt how to pass pd address to br job
ideascf b56fa9c
fix task sequence
ideascf d8bd582
remove backup.spec.from related code
ideascf 614ecc9
remove commented code
ideascf dcb6c14
Remove field backup.spec.tikvGCLifeTime
ideascf 4f5916f
fix BR status update panic
ideascf 80dc81d
optimize CRD definition of Backup
ideascf 73e178e
Remove EBS volume restore related constant values and funcs
ideascf 8289db8
Remove store.spec.tikvGCLifeTime
ideascf cbad455
Refine API definition
ideascf a08473e
Address lint
ideascf 9b0d9a1
Add missing test files
ideascf 2b29aa1
Merge branch 'feature/v2' into resolve-br-todo
ti-chi-bot[bot] ea3036f
Address lint
ideascf File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -126,3 +126,6 @@ issues: | |
|
||
run: | ||
timeout: 15m | ||
skip-files: | ||
- ".*/br/.*/_test.go" | ||
- ".*/br/.*/testutils/.*" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
// Copyright 2024 PingCAP, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package v1alpha1 | ||
|
||
import ( | ||
"testing" | ||
|
||
. "github.com/onsi/gomega" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/apimachinery/pkg/types" | ||
|
||
metav1alpha1 "github.com/pingcap/tidb-operator/api/v2/meta/v1alpha1" | ||
) | ||
|
||
func TestGetBackupOwnerRef(t *testing.T) { | ||
g := NewGomegaWithT(t) | ||
|
||
b := newBackup() | ||
b.UID = types.UID("demo-uid") | ||
ref := GetBackupOwnerRef(b) | ||
g.Expect(ref.APIVersion).To(Equal(BackupControllerKind.GroupVersion().String())) | ||
g.Expect(ref.Kind).To(Equal(BackupControllerKind.Kind)) | ||
g.Expect(ref.Name).To(Equal(b.GetName())) | ||
g.Expect(ref.UID).To(Equal(types.UID("demo-uid"))) | ||
g.Expect(*ref.Controller).To(BeTrue()) | ||
g.Expect(*ref.BlockOwnerDeletion).To(BeTrue()) | ||
} | ||
|
||
func TestGetRestoreOwnerRef(t *testing.T) { | ||
g := NewGomegaWithT(t) | ||
|
||
r := newRestore() | ||
r.UID = types.UID("demo-uid") | ||
ref := GetRestoreOwnerRef(r) | ||
g.Expect(ref.APIVersion).To(Equal(RestoreControllerKind.GroupVersion().String())) | ||
g.Expect(ref.Kind).To(Equal(RestoreControllerKind.Kind)) | ||
g.Expect(ref.Name).To(Equal(r.GetName())) | ||
g.Expect(ref.UID).To(Equal(types.UID("demo-uid"))) | ||
g.Expect(*ref.Controller).To(BeTrue()) | ||
g.Expect(*ref.BlockOwnerDeletion).To(BeTrue()) | ||
} | ||
|
||
func TestGetBackupScheduleOwnerRef(t *testing.T) { | ||
g := NewGomegaWithT(t) | ||
|
||
b := newBackupSchedule() | ||
b.UID = types.UID("demo-uid") | ||
ref := GetBackupScheduleOwnerRef(b) | ||
g.Expect(ref.APIVersion).To(Equal(backupScheduleControllerKind.GroupVersion().String())) | ||
g.Expect(ref.Kind).To(Equal(backupScheduleControllerKind.Kind)) | ||
g.Expect(ref.Name).To(Equal(b.GetName())) | ||
g.Expect(ref.UID).To(Equal(types.UID("demo-uid"))) | ||
g.Expect(*ref.Controller).To(BeTrue()) | ||
g.Expect(*ref.BlockOwnerDeletion).To(BeTrue()) | ||
} | ||
|
||
func newBackup() *Backup { | ||
backup := &Backup{ | ||
ObjectMeta: metav1.ObjectMeta{ | ||
Name: "demo-backup", | ||
Namespace: metav1.NamespaceDefault, | ||
Labels: map[string]string{ | ||
metav1alpha1.NameLabelKey: metav1alpha1.BackupJobLabelVal, | ||
}, | ||
}, | ||
Spec: BackupSpec{}, | ||
} | ||
return backup | ||
} | ||
|
||
func newRestore() *Restore { | ||
restore := &Restore{ | ||
ObjectMeta: metav1.ObjectMeta{ | ||
Name: "demo-backup", | ||
Namespace: metav1.NamespaceDefault, | ||
Labels: map[string]string{ | ||
metav1alpha1.NameLabelKey: metav1alpha1.RestoreJobLabelVal, | ||
}, | ||
}, | ||
Spec: RestoreSpec{}, | ||
} | ||
return restore | ||
} | ||
|
||
func newBackupSchedule() *BackupSchedule { | ||
backup := &BackupSchedule{ | ||
ObjectMeta: metav1.ObjectMeta{ | ||
Name: "demo-backup", | ||
Namespace: metav1.NamespaceDefault, | ||
Labels: map[string]string{ | ||
metav1alpha1.NameLabelKey: metav1alpha1.BackupScheduleJobLabelVal, | ||
}, | ||
}, | ||
Spec: BackupScheduleSpec{ | ||
BackupTemplate: BackupSpec{}, | ||
}, | ||
} | ||
return backup | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -76,11 +76,6 @@ const ( | |
RestoreScheduled RestoreConditionType = "Scheduled" | ||
// RestoreRunning means the Restore is currently being executed. | ||
RestoreRunning RestoreConditionType = "Running" | ||
// RestoreDataComplete means the Restore has successfully executed part-2 and the | ||
// data in restore volumes has been deal with consistency based on min_resolved_ts | ||
RestoreDataComplete RestoreConditionType = "DataComplete" | ||
// RestoreTiKVComplete means in volume restore, all TiKV instances are started and up | ||
RestoreTiKVComplete RestoreConditionType = "TikvComplete" | ||
// RestoreComplete means the Restore has successfully executed and the | ||
// backup data has been loaded into tidb cluster. | ||
RestoreComplete RestoreConditionType = "Complete" | ||
|
@@ -131,28 +126,27 @@ type RestoreSpec struct { | |
// Mode is the restore mode. such as snapshot or pitr. | ||
// +kubebuilder:default=snapshot | ||
Mode RestoreMode `json:"restoreMode,omitempty"` | ||
// StorageProvider configures where and how backups should be stored. | ||
StorageProvider `json:",inline"` | ||
// BR is the configs for BR. | ||
BR *BRConfig `json:"br,omitempty"` | ||
|
||
// PitrRestoredTs is the pitr restored ts. | ||
PitrRestoredTs string `json:"pitrRestoredTs,omitempty"` | ||
// LogRestoreStartTs is the start timestamp which log restore from. | ||
// +optional | ||
LogRestoreStartTs string `json:"logRestoreStartTs,omitempty"` | ||
// TikvGCLifeTime is to specify the safe gc life time for restore. | ||
// The time limit during which data is retained for each GC, in the format of Go Duration. | ||
// When a GC happens, the current time minus this value is the safe point. | ||
TikvGCLifeTime *string `json:"tikvGCLifeTime,omitempty"` | ||
Comment on lines
-139
to
-142
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. ditto |
||
// StorageProvider configures where and how backups should be stored. | ||
StorageProvider `json:",inline"` | ||
// PitrFullBackupStorageProvider configures where and how pitr dependent full backup should be stored. | ||
// +optional | ||
PitrFullBackupStorageProvider StorageProvider `json:"pitrFullBackupStorageProvider,omitempty"` | ||
|
||
// The storageClassName of the persistent volume for Restore data storage. | ||
// Defaults to Kubernetes default storage class. | ||
// +optional | ||
StorageClassName *string `json:"storageClassName,omitempty"` | ||
// StorageSize is the request storage size for backup job | ||
StorageSize string `json:"storageSize,omitempty"` | ||
// BR is the configs for BR. | ||
BR *BRConfig `json:"br,omitempty"` | ||
|
||
// Base tolerations of restore Pods, components may add more tolerations upon this respectively | ||
// +optional | ||
Tolerations []corev1.Toleration `json:"tolerations,omitempty"` | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -90,7 +90,6 @@ const ( | |
DirPathClusterTLSPD = "/var/lib/pd-tls" | ||
DirPathClusterTLSTiKV = "/var/lib/tikv-tls" | ||
DirPathClusterTLSTiDB = "/var/lib/tidb-tls" | ||
DirPathTiDBClientTLS = "/var/lib/tidb-client-tls" // FIXME(ideascf): do we need this? | ||
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. We don't need do tidb SQL client TLS |
||
DirPathClusterTLSTiFlash = "/var/lib/tiflash-tls" | ||
DirPathClusterClientTLS = "/var/lib/cluster-client-tls" | ||
DirPathClusterTLSTiCDC = "/var/lib/ticdc-tls" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
TikvGCLifeTime is only used when using dumpling mode as pseudo backup and only is required for tikv < v4.0.8.