goharbor / harbor

An open source trusted cloud native registry project that stores, signs, and scans content.
https://goharbor.io
Apache License 2.0
24.14k stars 4.76k forks source link

Automating scheduled cleanup and GC in Harbor using GitOps #20809

Open taltrums opened 3 months ago

taltrums commented 3 months ago

How can we help you?

Problem Statement

We are looking for a way to automate Harbor cleanup tasks, such as garbage collection, using configuration files. Our goal is to ensure that these cleanup tasks are performed automatically and periodically without requiring manual intervention through the Harbor UI.

Requirements

  1. Automated Garbage Collection:

    • We want to schedule and run garbage collection automatically at regular intervals.
    • Ideally, the schedule and other relevant configurations should be specified in a configuration file, such as values.yaml, which can be used by Harbor during startup.
  2. Configuration as Code:

    • The configuration should be manageable through version control (e.g., Git), allowing us to track changes and automate deployments using CI/CD pipelines.
    • This approach should eliminate the need for manual configuration via the Harbor UI, ensuring consistency across environments.

Current Manual Process

Currently, we perform garbage collection manually through the Harbor UI. This process involves:

  1. Logging into the Harbor UI with administrator credentials.
  2. Navigating to the system settings and triggering garbage collection manually.

This manual process is not ideal for several reasons:

BiancaTofan commented 1 month ago

Hello, I totally agree. If you have multiple platforms to manage, you need to connect to each one individually to schedule such a cleanup task. Therefore, it can be defined in the values.yaml file as a parameter.

Vad1mo commented 1 month ago

IMO this should not be part of the core configuration but rater on the same level as the UI. We already have the capabilities to do that with TF, Pulumi providers. CLI is up next and Ideally some CRDs wouls be nice too.

cbluth commented 1 month ago

im running into this issue, i want to use the api as shown in swagger, but garbage collection has csrf tokens... its a bit of a pain to work around

wy65701436 commented 1 month ago

You should handle it externally using any method you prefer—automation scripts, operators, Terraform, etc.—but not within the application itself.

cbluth commented 1 month ago

can you add some reasoning why? (i feel a bit left in the dark, its just a rest endpoint)