Skip to content

fix(dataprotection): reject invalid restore target port#10616

Draft
weicao wants to merge 2 commits into
mainfrom
bugfix/dp-restore-target-port
Draft

fix(dataprotection): reject invalid restore target port#10616
weicao wants to merge 2 commits into
mainfrom
bugfix/dp-restore-target-port

Conversation

@weicao

@weicao weicao commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Fixes #10615

Related backup-side fix: #10612

What this PR does

  • stops restore post-ready Jobs from silently falling back to the first pod port when an explicit named target port is missing
  • propagates the lookup error before a Job is built
  • preserves the legal default first-port behavior when no target ContainerPort is specified
  • preserves explicit connection credential PortKey precedence

Tests

  • focused restore target-port regression test
  • full pkg/dataprotection/restore package with envtest 1.26.1
  • full package with race detector
  • go vet ./pkg/dataprotection/restore
  • git diff --check

@apecloud-bot

Copy link
Copy Markdown
Collaborator

Auto Cherry-pick Instructions

Usage:
  - /nopick: Not auto cherry-pick when PR merged.
  - /pick: release-x.x [release-x.x]: Auto cherry-pick to the specified branch when PR merged.

Example:
  - /nopick
  - /pick release-1.1

CLA Recheck Instructions

Usage:
  - /recheck-cla: Trigger a re-check of CLA status for this pull request.
Example:
  - /recheck-cla

@github-actions github-actions Bot added the size/M Denotes a PR that changes 30-99 lines. label Jul 11, 2026
@codecov

codecov Bot commented Jul 11, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 61.53846% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 63.78%. Comparing base (5a57a85) to head (86ad07d).

Files with missing lines Patch % Lines
pkg/dataprotection/restore/manager.go 53.84% 4 Missing and 2 partials ⚠️
pkg/dataprotection/restore/builder.go 69.23% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10616      +/-   ##
==========================================
+ Coverage   63.75%   63.78%   +0.02%     
==========================================
  Files         520      520              
  Lines       62957    62965       +8     
==========================================
+ Hits        40138    40160      +22     
+ Misses      19201    19195       -6     
+ Partials     3618     3610       -8     
Flag Coverage Δ
unittests 63.78% <61.53%> (+0.02%) ⬆️

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

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@weicao weicao added the nopick Not auto cherry-pick when PR merged label Jul 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

nopick Not auto cherry-pick when PR merged size/M Denotes a PR that changes 30-99 lines.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DataProtection restore silently falls back to the first pod port

2 participants