Skip to content

kevinfinalboss/privateer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

127 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ΄β€β˜ οΈ Privateer

Privateer Logo

Go License Release

Automate migration of Docker images from public to private registries

Privateer is a powerful CLI tool that scans Kubernetes clusters and GitHub repositories to identify public Docker images and automatically migrates them to private registries, ensuring enhanced security and control over your infrastructure.

🎯 Mission

As security and compliance concerns grow, organizations need to migrate their Docker images from public registries (DockerHub, ECR Public, etc.) to private registries. Privateer automates this complex process with enterprise-grade reliability.

✨ Features

πŸ” Intelligent Scanner

  • βœ… Kubernetes cluster scanning (Deployments, StatefulSets, DaemonSets, Jobs, CronJobs)
  • βœ… Automatic public/private image detection with smart algorithms
  • βœ… Init containers and multi-container pods support
  • βœ… Custom registry classification rules
  • βœ… Namespace filtering and context switching

πŸš€ Migration Engine

  • βœ… Automated Pull/Tag/Push workflow to private registries
  • βœ… Multiple registry support with priority-based selection
  • βœ… Concurrent processing (configurable 1-10 threads)
  • βœ… Dry-run mode for safe testing and validation
  • βœ… Health checks and authentication validation
  • βœ… Duplicate detection and anti-collision system

🎯 Registry Support

  • βœ… Docker Registry (registry:2) - Production ready
  • βœ… Harbor (self-hosted) - Production ready
  • βœ… AWS ECR (Elastic Container Registry) - Production ready
  • 🚧 GitHub Container Registry - Coming in v0.3.0
  • 🚧 Azure Container Registry - Coming in v0.3.0
  • 🚧 Google Container Registry - Coming in v0.3.0

πŸ”§ Advanced Configuration

  • βœ… Priority-based registry selection (0-100 scale)
  • βœ… Multiple registries mode vs single registry mode
  • βœ… AWS ECR authentication (3 methods: credentials, profiles, IAM)
  • βœ… SSL/TLS support with insecure mode option
  • βœ… Custom detection rules for public/private classification

πŸ“Š Professional Reporting

  • βœ… HTML reports with visual charts and statistics
  • βœ… Discord webhook integration for real-time notifications
  • βœ… Detailed migration logs with structured JSON output
  • βœ… Success/failure metrics and performance analytics

πŸš€ Installation

Quick Installation (Recommended)

Linux/macOS:

curl -sSL https://raw.githubusercontent.com/kevinfinalboss/privateer/main/scripts/install.sh | bash

Windows (PowerShell):

irm https://raw.githubusercontent.com/kevinfinalboss/privateer/main/scripts/install.ps1 | iex

Alternative Methods

Go Install:

go install github.com/kevinfinalboss/privateer/cmd/privateer@latest

Manual Download: Download binaries from GitHub Releases

πŸ“‹ Quick Start

1. Initialize Configuration

privateer init

2. Configure Registries

Edit ~/.privateer/config.yaml:

registries:
  # Docker Registry with highest priority
  - name: "docker-local"
    type: "docker"
    enabled: true
    priority: 10  # Highest priority (0-100)
    url: "registry.company.com"
    username: "admin"
    password: "secure-password"
    insecure: false
    
  # AWS ECR with medium priority
  - name: "ecr-prod"
    type: "ecr"
    enabled: true
    priority: 5
    region: "us-east-1"
    account_id: "123456789012"
    # Uses default AWS credentials

settings:
  multiple_registries: false  # true = all enabled registries
                              # false = highest priority only
  concurrency: 3
  
webhooks:
  discord:
    enabled: true
    url: "https://discord.com/api/webhooks/..."

3. Scan Cluster

# Basic scan
privateer scan cluster

# Dry-run simulation
privateer scan cluster --dry-run

# Different language
privateer scan cluster --language=en-US

4. Migrate Images

# Simulate migration (generates HTML report)
privateer migrate cluster --dry-run

# Execute migration (generates HTML report + Discord notifications)
privateer migrate cluster

βš™οΈ Advanced Configuration

Registry Priority System

registries:
  - name: "primary-registry"
    priority: 10  # Highest priority
    enabled: true
    
  - name: "backup-registry"  
    priority: 5   # Medium priority
    enabled: true
    
  - name: "archive-registry"
    priority: 1   # Lowest priority
    enabled: false  # Disabled

Behavior:

  • multiple_registries: false β†’ Only highest priority registry receives images
  • multiple_registries: true β†’ All enabled registries receive images

AWS ECR Authentication Methods

Method 1: Direct Credentials

- name: "ecr-direct"
  type: "ecr"
  region: "us-east-1"
  access_key: "AKIAIOSFODNN7EXAMPLE"
  secret_key: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"

Method 2: AWS Profiles

- name: "ecr-profiles"
  type: "ecr"
  region: "us-east-1"
  account_id: "123456789012"  # Required for profile filtering
  profiles:
    - "production"
    - "default"

Method 3: Default Credentials (Recommended)

- name: "ecr-default"
  type: "ecr"
  region: "us-east-1"
  # Uses IAM roles, environment variables, or ~/.aws/credentials

πŸ“Š HTML Reports

Privateer automatically generates professional HTML reports for every migration:

Report Locations

~/.privateer/reports/
β”œβ”€β”€ privateer-dryrun-2025-01-24_15-30-45.html   # Simulation reports
β”œβ”€β”€ privateer-report-2025-01-24_16-45-12.html   # Production reports
└── privateer-dryrun-2025-01-24_17-20-33.html   # Historical reports

Report Contents

  • πŸ“ˆ Executive dashboard with key metrics and success rates
  • 🎯 Registry-specific statistics with priority information
  • πŸ“‹ Detailed migration list with source/target mappings
  • βš™οΈ Configuration summary showing enabled registries
  • πŸ΄β€β˜ οΈ Professional design optimized for sharing and archival

πŸ—οΈ Architecture

privateer/
β”œβ”€β”€ cmd/privateer/          # Application entry point
β”œβ”€β”€ internal/
β”‚   β”œβ”€β”€ cli/               # CLI commands (Cobra)
β”‚   β”œβ”€β”€ config/            # Configuration management
β”‚   β”œβ”€β”€ kubernetes/        # K8s client and scanner
β”‚   β”œβ”€β”€ logger/            # Structured logging with i18n
β”‚   β”œβ”€β”€ registry/          # Registry implementations
β”‚   β”œβ”€β”€ migration/         # Migration engine
β”‚   β”œβ”€β”€ reporter/          # HTML report generation
β”‚   └── webhook/           # Discord notifications
β”œβ”€β”€ pkg/types/             # Shared type definitions
β”œβ”€β”€ locales/               # Translation files
└── scripts/               # Installation and build scripts

🎯 Use Cases

Enterprise Migration Scenario

# Configuration for enterprise with multiple registries
registries:
  - name: "production-ecr"
    type: "ecr"
    enabled: true
    priority: 10
    region: "us-east-1"
    
  - name: "backup-harbor"
    type: "harbor"
    enabled: true
    priority: 5
    url: "harbor.company.com"
    project: "backup"

# Execute with notifications
privateer migrate cluster

Result:

  • Single mode: Only production-ecr receives images (priority 10 > 5)
  • Multiple mode: Both registries receive identical copies
  • Reports: HTML report saved to ~/.privateer/reports/
  • Notifications: Discord alerts with migration status

Compliance and Audit

# Generate compliance report
privateer migrate cluster --dry-run --log-level debug

# View detailed HTML report
open ~/.privateer/reports/privateer-dryrun-*.html

πŸ“ˆ Roadmap

βœ… v0.2.0 - Current (Registry Expansion)

  • AWS ECR integration with 3 authentication methods
  • Priority-based registry selection system
  • Multiple registries support with intelligent routing
  • HTML reporting with visual charts and statistics
  • Discord webhook integration for real-time notifications
  • Advanced duplicate detection and anti-collision system

🚧 v0.3.0 - GitOps Integration (Q2 2025)

  • GitHub Container Registry support
  • Azure Container Registry integration
  • GitHub repository scanning for Dockerfiles
  • Automated Pull Request generation with updated images
  • ArgoCD/Flux integration for GitOps workflows

🎯 v0.4.0 - Enterprise Features (Q3 2025)

  • Web dashboard with real-time monitoring
  • Prometheus metrics and alerting
  • RBAC and multi-tenancy support
  • Compliance reporting and audit trails
  • Advanced scheduling and batch processing

πŸ’» Development

Prerequisites

  • Go 1.24+
  • Kubernetes cluster (for testing)
  • Docker (for local registry testing)

Local Development

# Clone repository
git clone https://github.com/kevinfinalboss/privateer.git
cd privateer

# Install dependencies
go mod download

# Development build
make dev

# Run tests
make test

# Local execution
make run ARGS="scan cluster --dry-run"

Build System

# Multi-platform release
make release

# Clean build artifacts
make clean

# Code quality checks
make lint

🀝 Contributing

We welcome contributions from the community!

How to Contribute

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Adding New Registries

  1. Implement the Registry interface in internal/registry/
  2. Add support in NewEngine() in manager.go
  3. Update configuration examples and documentation
  4. Add comprehensive tests

Storage Requirements

~/.privateer/
β”œβ”€β”€ config.yaml          # <1KB - Configuration
└── reports/              # ~100KB per report
    └── *.html           # Self-contained HTML files

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™‹β€β™‚οΈ Support & Community

πŸŽ‰ Acknowledgments


Privateer Logo

⭐ Star on GitHub β€’ πŸ“– Documentation β€’ πŸ”„ Changelog

Built with ❀️ for the DevOps and Platform Engineering community

About

Privateer is a powerful CLI tool that scans Kubernetes clusters and GitHub repositories to identify public Docker images and automatically migrates them to private registries, ensuring enhanced security and control over your infrastructure.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors