Uploaded image for project: 'Project Quay'
  1. Project Quay
  2. PROJQUAY-9945

Implement Image Expiry/Autoprune Worker for quay-distribution

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Unresolved
    • Icon: Normal Normal
    • None
    • None
    • None
    • Product / Portfolio Work
    • False
    • Hide

      None

      Show
      None
    • False
    • Not Selected

      Implement full autoprune policy support for the quay-distribution Go rewrite, matching the functionality in the Python Quay codebase

      Scope

      • Namespace-level and repository-level autoprune policies
      • NUMBER_OF_TAGS policy method (keep N most recent tags)
      • CREATION_DATE policy method (remove tags older than X)
      • Tag pattern regex matching
      • Background goroutine worker (30s interval)
      • Prometheus metrics for
        monitoring

      Out of Scope

      • Garbage collection / blob cleanup (separate task)
      • API endpoints for policy management (uses existing Quay DB)

      Technical Details

      • New package: internal/autoprune/
      • Follow existing
        worker pattern from pkg/auth/jwk/manager.go
      • Reads existing Quay tables: namespaceautoprunepolicy, repositoryautoprunepolicy
      • Expires tags by setting lifetime_end_ms

      Configuration

      FEATURE_AUTOPRUNE: true
      AUTOPRUNE_WORKER_INTERVAL: "30s"
      AUTOPRUNE_BATCH_SIZE: 100
      LABELED_EXPIRATION_MINIMUM: "1h"
      LABELED_EXPIRATION_MAXIMUM: "104w"

      Acceptance Criteria

      • [ ] Manager starts/stops cleanly with server lifecycle
      • [] Processes namespaces in batches (configurable size)
      • [ ] Applies NUMBER_OF_TAGS policies correctly
      • [ ] Applies CREATION_DATE policies correctly
      • [ ] Respects tag pattern filters
      • [ ] Skips immutable tags
      • [ ]Prometheus metrics exposed
      • [ ] Unit tests for policy engine
      • [ ] Integration tests with database
      • [ ] Documentation updated

      Implementation Phases

      Phase 1: Foundation

      1. Create internal/autoprune/ directory
      2. Implement models.go - policy types, tag metadata
      3. Implement config.go - config types with defaults
      4. Add config fields to pkg/config/quay_config.go

      Phase 2: Core Worker

      1. Implement autoprune.go - Manager with Start/Stop
      2. Implement worker.go - background loop
      3. Implement metrics.go - Prometheus metrics

      Phase 3: Policy Engine

      1. Implement queries.go - database queries
      2. Implement policy_engine.go - policy evaluation
      3. Add tag pattern regex matching

      Phase 4: Integration

      1. Add to pkg/server/server.go - initialize manager
      2. Wire shutdown in cmd/quay-distribution/main.go

      Phase 5: Testing

      1. Unit tests for policy engine
      2. Unit tests for worker lifecycle
      3. Integration tests with database

      🤖 This task description was generated with Claude Code

              rhn-support-bpratt Brady Pratt
              rhn-support-bpratt Brady Pratt
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated: