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

feat: support filtering backup target pods by the alternative label selector #7831

Merged
merged 11 commits into from
Aug 6, 2024

Conversation

gnolong
Copy link
Contributor

@gnolong gnolong commented Jul 18, 2024

fix #7072
Add fallbackLabelSelector field to podSelector in backuppolicy, and add fallbackRole field used to build fallbackLabelSelector in backuppolicytemplate. If backup controller fails to filter available target pods, it will use fallbackLabelSelector to filter target pods. This behavior only takes effect when strategy is set to Any in the podSelector, Any means backup controller only selects one available pod as the target.

For example, in a primary-secondary cluster, we have scheduled tasks to back up the secondary pod. In the past, If all secondary pods are unavailable, the backups would continuously fail. Now, with the fallbackLabelSelector used to filter backup target pod, if all secondary pods are unavailable, we can use it to select the primary pod for backups, to guarantee the continuity of scheduled backup tasks with a high probability.

@gnolong gnolong linked an issue Jul 18, 2024 that may be closed by this pull request
@github-actions github-actions bot added the size/XXL Denotes a PR that changes 1000+ lines. label Jul 18, 2024
Copy link

codecov bot commented Jul 19, 2024

Codecov Report

Attention: Patch coverage is 48.00000% with 39 lines in your changes missing coverage. Please review.

Project coverage is 64.84%. Comparing base (7149aaa) to head (ffd9d21).
Report is 53 commits behind head on main.

Files Patch % Lines
controllers/dataprotection/utils.go 65.11% 10 Missing and 5 partials ⚠️
...trollers/apps/transformer_cluster_backup_policy.go 35.00% 10 Missing and 3 partials ⚠️
pkg/dataprotection/utils/utils.go 0.00% 11 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7831      +/-   ##
==========================================
- Coverage   64.90%   64.84%   -0.07%     
==========================================
  Files         345      345              
  Lines       42941    42967      +26     
==========================================
- Hits        27873    27864       -9     
- Misses      12632    12656      +24     
- Partials     2436     2447      +11     
Flag Coverage Δ
unittests 64.84% <48.00%> (-0.07%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@gnolong gnolong marked this pull request as ready for review July 19, 2024 06:31
@ldming ldming changed the title fix: support pod selection for role feat: support pod selection for role Jul 22, 2024
@ldming
Copy link
Collaborator

ldming commented Jul 22, 2024

Modify the PR title to describe the implemented functionality.

@gnolong gnolong changed the title feat: support pod selection for role feat: support filtering backup target pods by the alternative label selector Jul 22, 2024
@gnolong
Copy link
Contributor Author

gnolong commented Jul 22, 2024

Modify the PR title to describe the implemented functionality.

done

@gnolong gnolong requested review from weicao and wangyelei August 1, 2024 12:33
@gnolong gnolong requested a review from wangyelei August 2, 2024 07:34
@apecloud-bot apecloud-bot added the approved PR Approved Test label Aug 2, 2024
@wangyelei wangyelei merged commit ab818e5 into main Aug 6, 2024
55 checks passed
@wangyelei wangyelei deleted the support/pod-selection-strategy-for-role branch August 6, 2024 03:16
@github-actions github-actions bot added this to the 0.9.2 milestone Aug 6, 2024
@wangyelei
Copy link
Contributor

/cherry-pick release-0.9

Copy link

github-actions bot commented Aug 6, 2024

🤖 says: cherry pick action finished successfully 🎉!
See: https://github.com/apecloud/kubeblocks/actions/runs/10260853758

github-actions bot pushed a commit that referenced this pull request Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved PR Approved Test size/XXL Denotes a PR that changes 1000+ lines.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Improvement] support pod selection strategy for role.
5 participants