Skip to content

feat(preheat) : add project preheat policy command#871

Open
Sypher845 wants to merge 15 commits into
goharbor:mainfrom
Sypher845:feat/project-preheat-policy
Open

feat(preheat) : add project preheat policy command#871
Sypher845 wants to merge 15 commits into
goharbor:mainfrom
Sypher845:feat/project-preheat-policy

Conversation

@Sypher845
Copy link
Copy Markdown
Contributor

@Sypher845 Sypher845 commented May 5, 2026

Note : This is the first PR for the issue #836

Description

Adds the harbor project preheat policy command group to manage P2P preheat policies under a project. Harbor supports P2P (Peer-to-Peer) preheat distribution using engines like Dragonfly or Kraken. Users can create preheat policies under a project to preload container images into a P2P network before they are needed. The preheat command allows users to manage preheat policies, monitor executions, and inspect tasks from the terminal.

Commands

  • harbor project preheat policy list — List preheat policies
Kooha-2026-05-10-23-18-01
  • harbor project preheat policy view — View preheat policy details
Kooha-2026-05-10-23-19-34
  • harbor project preheat policy delete — Delete a preheat policy
Kooha-2026-05-10-23-20-50
  • harbor project preheat policy start — Trigger a preheat policy manually
Kooha-2026-05-10-23-29-22
  • harbor project preheat policy create — Create a new preheat policy

Config used for testing:

{
  "name": "kraken-start-test",
  "description": "Kraken local start command test policy",
  "enabled": true,
  "provider_name": "kraken kraken-local-test-http://172.18.0.12:5678",
  "filters": [
    {
      "type": "repository",
      "value": "**"
    },
    {
      "type": "tag",
      "value": "**"
    }
  ],
  "trigger": {
    "type": "manual"
  }
}
Kooha-2026-05-10-23-35-56
  • harbor project preheat policy update — Update an existing preheat policy
Kooha-2026-05-10-23-36-50

Type of Change

  • Bug fix
  • New feature
  • Refactor
  • Documentation update
  • Chore / maintenance

@codecov
Copy link
Copy Markdown

codecov Bot commented May 5, 2026

Codecov Report

❌ Patch coverage is 0% with 862 lines in your changes missing coverage. Please review.
✅ Project coverage is 8.03%. Comparing base (60ad0bd) to head (9bd5e8b).
⚠️ Report is 162 commits behind head on main.

Files with missing lines Patch % Lines
pkg/config/preheat/policies.go 0.00% 129 Missing ⚠️
pkg/views/preheat/policy/create/view.go 0.00% 118 Missing ⚠️
cmd/harbor/root/project/preheat/policy/update.go 0.00% 106 Missing ⚠️
cmd/harbor/root/project/preheat/policy/create.go 0.00% 99 Missing ⚠️
pkg/api/preheat_handler.go 0.00% 92 Missing ⚠️
cmd/harbor/root/project/preheat/policy/view.go 0.00% 51 Missing ⚠️
cmd/harbor/root/project/preheat/policy/list.go 0.00% 47 Missing ⚠️
cmd/harbor/root/project/preheat/policy/delete.go 0.00% 45 Missing ⚠️
cmd/harbor/root/project/preheat/policy/start.go 0.00% 45 Missing ⚠️
pkg/views/preheat/policy/view/view.go 0.00% 32 Missing ⚠️
... and 6 more
Additional details and impacted files
@@            Coverage Diff            @@
##             main    #871      +/-   ##
=========================================
- Coverage   10.99%   8.03%   -2.96%     
=========================================
  Files         173     302     +129     
  Lines        8671   15305    +6634     
=========================================
+ Hits          953    1230     +277     
- Misses       7612   13958    +6346     
- Partials      106     117      +11     

☔ View full report in Codecov by Sentry.
📢 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.

@Sypher845 Sypher845 force-pushed the feat/project-preheat-policy branch 2 times, most recently from 0557d6a to 8d83314 Compare May 10, 2026 15:51
@Sypher845 Sypher845 marked this pull request as ready for review May 10, 2026 18:08
@Sypher845 Sypher845 force-pushed the feat/project-preheat-policy branch from ac81d05 to df4a6d0 Compare May 12, 2026 15:36
@qcserestipy qcserestipy self-requested a review May 17, 2026 12:07
Copy link
Copy Markdown
Collaborator

@qcserestipy qcserestipy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution! I have left a few comments. Especially in the create command there a few inconsistencies when it comes to the config file flag. Please take a look at them.

Comment thread cmd/harbor/root/project/preheat.go Outdated
Comment thread cmd/harbor/root/project/preheat/policy.go Outdated
Comment thread cmd/harbor/root/project/preheat/policy/create.go Outdated
Comment thread cmd/harbor/root/project/preheat/policy/create.go Outdated
Comment thread cmd/harbor/root/project/preheat/policy/create.go Outdated
Comment thread cmd/harbor/root/project/preheat/policy/create.go Outdated
Comment thread cmd/harbor/root/project/preheat/policy/update.go
Comment thread pkg/config/preheat/policies.go
@qcserestipy qcserestipy added the Changes Requesed feedback that must be addressed before merging. label May 18, 2026
Sypher845 added 14 commits May 18, 2026 15:13
Signed-off-by: Sypher845 <suyashpatil845@gmail.com>
Signed-off-by: Sypher845 <suyashpatil845@gmail.com>
Signed-off-by: Sypher845 <suyashpatil845@gmail.com>
Signed-off-by: Sypher845 <suyashpatil845@gmail.com>
Signed-off-by: Sypher845 <suyashpatil845@gmail.com>
Signed-off-by: Sypher845 <suyashpatil845@gmail.com>
Signed-off-by: Sypher845 <suyashpatil845@gmail.com>
Signed-off-by: Sypher845 <suyashpatil845@gmail.com>
Signed-off-by: Sypher845 <suyashpatil845@gmail.com>
Signed-off-by: Sypher845 <suyashpatil845@gmail.com>
Signed-off-by: Sypher845 <suyashpatil845@gmail.com>
Signed-off-by: Sypher845 <suyashpatil845@gmail.com>
Signed-off-by: Sypher845 <suyashpatil845@gmail.com>
Signed-off-by: Sypher845 <suyashpatil845@gmail.com>
@Sypher845 Sypher845 force-pushed the feat/project-preheat-policy branch from 9bd5e8b to 1101e66 Compare May 18, 2026 19:50
Signed-off-by: Sypher845 <suyashpatil845@gmail.com>
@Sypher845 Sypher845 force-pushed the feat/project-preheat-policy branch from 1101e66 to 316d121 Compare May 18, 2026 20:00
@Sypher845
Copy link
Copy Markdown
Contributor Author

@qcserestipy made the changes . PTAL, the CI is failing because of demo.goharbor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Changes Requesed feedback that must be addressed before merging.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants