Skip to content
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

br: add some log to record the CR we are processing (#5711) #5713

Merged

Conversation

ti-chi-bot
Copy link
Member

This is an automated cherry-pick of #5711

What problem does this PR solve?

Add some log to record the CR we are processing, so that even the CR is deleted in K8s, we can still get this information from our log.

What is changed and how does it work?

Backup with .spec.from

I0823 04:07:07.095130      15 backup.go:77] start to process backup default/bk-after-restart
I0823 04:07:07.096848      15 manager.go:103] start to process backup: {"kind":"Backup","apiVersion":"pingcap.com/v1alpha1","metadata":{"name":"bk-after-restart","namespace":"default","uid":"b0c40f67-71c9-48dd-9f6d-00cd16185fbb","resourceVersion":"6697723","generation":2,"creationTimestamp":"2024-08-23T04:07:05Z","annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{\"apiVersion\":\"pingcap.com/v1alpha1\",\"kind\":\"Backup\",\"metadata\":{\"annotations\":{},\"name\":\"bk-after-restart\",\"namespace\":\"default\"},\"spec\":{\"backupType\":\"full\",\"br\":{\"cluster\":\"basic\"},\"from\":{\"host\":\"basic-tidb.default.svc\",\"port\":4000,\"secretName\":\"tidb-secret\",\"user\":\"root\"},\"s3\":{\"bucket\":\"transfer\",\"endpoint\":\"https://s3.zhangxc.com\",\"prefix\":\"bk-after-restart\",\"provider\":\"aws\",\"region\":\"us-west-1\",\"secretName\":\"s3-secret\",\"storageClass\":\"STANDARD\"}}}\n"},"managedFields":[{"manager":"kubectl-client-side-apply","operation":"Update","apiVersion":"pingcap.com/v1alpha1","time":"2024-08-23T04:07:05Z","fieldsType":"FieldsV1","fieldsV1":{"f:metadata":{"f:annotations":{".":{},"f:kubectl.kubernetes.io/last-applied-configuration":{}}},"f:spec":{".":{},"f:backupMode":{},"f:backupType":{},"f:br":{".":{},"f:cluster":{}},"f:from":{".":{},"f:host":{},"f:port":{},"f:secretName":{},"f:user":{}},"f:s3":{".":{},"f:bucket":{},"f:endpoint":{},"f:prefix":{},"f:provider":{},"f:region":{},"f:secretName":{},"f:storageClass":{}}}}},{"manager":"tidb-controller-manager","operation":"Update","apiVersion":"pingcap.com/v1alpha1","time":"2024-08-23T04:07:05Z","fieldsType":"FieldsV1","fieldsV1":{"f:spec":{"f:backoffRetryPolicy":{".":{},"f:maxRetryTimes":{},"f:minRetryDuration":{},"f:retryTimeout":{}},"f:resources":{}},"f:status":{".":{},"f:conditions":{},"f:phase":{},"f:timeCompleted":{},"f:timeStarted":{}}}}]},"spec":{"resources":{},"from":{"host":"basic-tidb.default.svc","port":4000,"user":"root","secretName":"tidb-secret"},"backupType":"full","backupMode":"snapshot","s3":{"provider":"aws","region":"us-west-1","bucket":"transfer","endpoint":"https://s3.zhangxc.com","storageClass":"STANDARD","secretName":"s3-secret","prefix":"bk-after-restart"},"br":{"cluster":"basic"},"backoffRetryPolicy":{"minRetryDuration":"300s","maxRetryTimes":2,"retryTimeout":"30m"}},"status":{"timeStarted":null,"timeCompleted":null,"phase":"Scheduled","conditions":[{"type":"Scheduled","status":"True","lastTransitionTime":"2024-08-23T04:07:05Z"}]}}
I0823 04:07:07.096876      15 manager.go:133] start to connect to tidb server (basic-tidb.default.svc:4000) as the .spec.from field is specified

Backup without .spec.from

I0823 06:19:30.613517      15 backup.go:77] start to process backup default/bk-after-restart
I0823 06:19:30.616603      15 manager.go:103] start to process backup: {"kind":"Backup","apiVersion":"pingcap.com/v1alpha1","metadata":{"name":"bk-after-restart","namespace":"default","uid":"73c051f9-22fd-416f-bfa6-df255d44207f","resourceVersion":"6718147","generation":2,"creationTimestamp":"2024-08-23T06:19:28Z","annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{\"apiVersion\":\"pingcap.com/v1alpha1\",\"kind\":\"Backup\",\"metadata\":{\"annotations\":{},\"name\":\"bk-after-restart\",\"namespace\":\"default\"},\"spec\":{\"backupType\":\"full\",\"br\":{\"cluster\":\"basic\"},\"s3\":{\"bucket\":\"transfer\",\"endpoint\":\"https://s3.zhangxc.com\",\"prefix\":\"bk-after-restart\",\"provider\":\"aws\",\"region\":\"us-west-1\",\"secretName\":\"s3-secret\",\"storageClass\":\"STANDARD\"}}}\n"},"managedFields":[{"manager":"kubectl-client-side-apply","operation":"Update","apiVersion":"pingcap.com/v1alpha1","time":"2024-08-23T06:19:28Z","fieldsType":"FieldsV1","fieldsV1":{"f:metadata":{"f:annotations":{".":{},"f:kubectl.kubernetes.io/last-applied-configuration":{}}},"f:spec":{".":{},"f:backupMode":{},"f:backupType":{},"f:br":{".":{},"f:cluster":{}},"f:s3":{".":{},"f:bucket":{},"f:endpoint":{},"f:prefix":{},"f:provider":{},"f:region":{},"f:secretName":{},"f:storageClass":{}}}}},{"manager":"tidb-controller-manager","operation":"Update","apiVersion":"pingcap.com/v1alpha1","time":"2024-08-23T06:19:28Z","fieldsType":"FieldsV1","fieldsV1":{"f:spec":{"f:backoffRetryPolicy":{".":{},"f:maxRetryTimes":{},"f:minRetryDuration":{},"f:retryTimeout":{}},"f:resources":{}},"f:status":{".":{},"f:conditions":{},"f:phase":{},"f:timeCompleted":{},"f:timeStarted":{}}}}]},"spec":{"resources":{},"backupType":"full","backupMode":"snapshot","s3":{"provider":"aws","region":"us-west-1","bucket":"transfer","endpoint":"https://s3.zhangxc.com","storageClass":"STANDARD","secretName":"s3-secret","prefix":"bk-after-restart"},"br":{"cluster":"basic"},"backoffRetryPolicy":{"minRetryDuration":"300s","maxRetryTimes":2,"retryTimeout":"30m"}},"status":{"timeStarted":null,"timeCompleted":null,"phase":"Scheduled","conditions":[{"type":"Scheduled","status":"True","lastTransitionTime":"2024-08-23T06:19:28Z"}]}}

Restore with .spec.to

I0823 06:40:21.039956      15 restore.go:79] start to process restore default/restore
I0823 06:40:21.042993      15 manager.go:105] start to process restore: {"kind":"Restore","apiVersion":"pingcap.com/v1alpha1","metadata":{"name":"restore","namespace":"default","uid":"f1e6d309-995c-40c4-8253-d1159669c2c7","resourceVersion":"6721380","generation":2,"creationTimestamp":"2024-08-23T06:40:17Z","annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{\"apiVersion\":\"pingcap.com/v1alpha1\",\"kind\":\"Restore\",\"metadata\":{\"annotations\":{},\"name\":\"restore\",\"namespace\":\"default\"},\"spec\":{\"br\":{\"cluster\":\"basic\"},\"s3\":{\"bucket\":\"transfer\",\"endpoint\":\"https://s3.zhangxc.com\",\"prefix\":\"bk-after-restart\",\"provider\":\"aws\",\"region\":\"us-west-1\",\"secretName\":\"s3-secret\",\"storageClass\":\"STANDARD\"},\"storageSize\":\"1Gi\",\"to\":{\"host\":\"basic-tidb.default.svc\",\"port\":4000,\"secretName\":\"tidb-secret\",\"user\":\"root\"}}}\n"},"managedFields":[{"manager":"kubectl-client-side-apply","operation":"Update","apiVersion":"pingcap.com/v1alpha1","time":"2024-08-23T06:40:17Z","fieldsType":"FieldsV1","fieldsV1":{"f:metadata":{"f:annotations":{".":{},"f:kubectl.kubernetes.io/last-applied-configuration":{}}},"f:spec":{".":{},"f:br":{".":{},"f:cluster":{}},"f:restoreMode":{},"f:s3":{".":{},"f:bucket":{},"f:endpoint":{},"f:prefix":{},"f:provider":{},"f:region":{},"f:secretName":{},"f:storageClass":{}},"f:storageSize":{},"f:to":{".":{},"f:host":{},"f:port":{},"f:secretName":{},"f:user":{}}}}},{"manager":"tidb-controller-manager","operation":"Update","apiVersion":"pingcap.com/v1alpha1","time":"2024-08-23T06:40:17Z","fieldsType":"FieldsV1","fieldsV1":{"f:spec":{"f:pitrFullBackupStorageProvider":{},"f:resources":{}},"f:status":{".":{},"f:conditions":{},"f:phase":{},"f:timeCompleted":{},"f:timeStarted":{}}}}]},"spec":{"resources":{},"to":{"host":"basic-tidb.default.svc","port":4000,"user":"root","secretName":"tidb-secret"},"restoreMode":"snapshot","s3":{"provider":"aws","region":"us-west-1","bucket":"transfer","endpoint":"https://s3.zhangxc.com","storageClass":"STANDARD","secretName":"s3-secret","prefix":"bk-after-restart"},"pitrFullBackupStorageProvider":{},"storageSize":"1Gi","br":{"cluster":"basic"}},"status":{"timeStarted":null,"timeCompleted":null,"phase":"Scheduled","conditions":[{"type":"Scheduled","status":"True","lastTransitionTime":"2024-08-23T06:40:17Z"}]}}
I0823 06:40:21.043205      15 manager.go:115] start to connect to tidb server (basic-tidb.default.svc:4000) as the .spec.to field is specified

Restore without .spec.to

I0823 06:47:20.101781      15 restore.go:79] start to process restore default/restore
I0823 06:47:20.104161      15 manager.go:105] start to process restore: {"kind":"Restore","apiVersion":"pingcap.com/v1alpha1","metadata":{"name":"restore","namespace":"default","uid":"1b9c07c0-5349-4baa-9da2-70321b49f5a9","resourceVersion":"6722487","generation":2,"creationTimestamp":"2024-08-23T06:47:18Z","annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{\"apiVersion\":\"pingcap.com/v1alpha1\",\"kind\":\"Restore\",\"metadata\":{\"annotations\":{},\"name\":\"restore\",\"namespace\":\"default\"},\"spec\":{\"br\":{\"cluster\":\"basic\"},\"s3\":{\"bucket\":\"transfer\",\"endpoint\":\"https://s3.zhangxc.com\",\"prefix\":\"bk-after-restart\",\"provider\":\"aws\",\"region\":\"us-west-1\",\"secretName\":\"s3-secret\",\"storageClass\":\"STANDARD\"},\"storageSize\":\"1Gi\"}}\n"},"managedFields":[{"manager":"kubectl-client-side-apply","operation":"Update","apiVersion":"pingcap.com/v1alpha1","time":"2024-08-23T06:47:18Z","fieldsType":"FieldsV1","fieldsV1":{"f:metadata":{"f:annotations":{".":{},"f:kubectl.kubernetes.io/last-applied-configuration":{}}},"f:spec":{".":{},"f:br":{".":{},"f:cluster":{}},"f:restoreMode":{},"f:s3":{".":{},"f:bucket":{},"f:endpoint":{},"f:prefix":{},"f:provider":{},"f:region":{},"f:secretName":{},"f:storageClass":{}},"f:storageSize":{}}}},{"manager":"tidb-controller-manager","operation":"Update","apiVersion":"pingcap.com/v1alpha1","time":"2024-08-23T06:47:18Z","fieldsType":"FieldsV1","fieldsV1":{"f:spec":{"f:pitrFullBackupStorageProvider":{},"f:resources":{}},"f:status":{".":{},"f:conditions":{},"f:phase":{},"f:timeCompleted":{},"f:timeStarted":{}}}}]},"spec":{"resources":{},"restoreMode":"snapshot","s3":{"provider":"aws","region":"us-west-1","bucket":"transfer","endpoint":"https://s3.zhangxc.com","storageClass":"STANDARD","secretName":"s3-secret","prefix":"bk-after-restart"},"pitrFullBackupStorageProvider":{},"storageSize":"1Gi","br":{"cluster":"basic"}},"status":{"timeStarted":null,"timeCompleted":null,"phase":"Scheduled","conditions":[{"type":"Scheduled","status":"True","lastTransitionTime":"2024-08-23T06:47:18Z"}]}}

Code changes

  • Has Go code change
  • Has CI related scripts change

Tests

  • Unit test
  • E2E test
  • Manual test
  • No code

Side effects

  • Breaking backward compatibility
  • Other side effects:

Related changes

  • Need to cherry-pick to the release branch
  • Need to update the documentation

Release Notes

Please refer to Release Notes Language Style Guide before writing the release note.


Copy link
Contributor

ti-chi-bot bot commented Aug 23, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from csuzhangxc, ensuring that each of them provides their approval before proceeding. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@csuzhangxc csuzhangxc merged commit 18af0b1 into pingcap:release-1.5 Aug 23, 2024
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants