rdev/internal/port/deployer.go
jordan 34e72687e6 feat: Complete automation gaps for repeatable project deployments
- Initial K8s deployment auto-creation during project creation
- DNS record upsert support (create or update existing records)
- Ingress host management for domain aliases (AddIngressHost/RemoveIngressHost)
- Woodpecker deployer RBAC manifest for CI deploy steps
- Single-commit template seeding via Gitea bulk file API

Closes automation gaps exposed during www.threesix.ai launch:
- Projects now auto-create K8s Deployment/Service/Ingress on creation
- Domain aliases automatically update both DNS and K8s ingress
- CI deploy steps work without manual RBAC setup
- Template seeding triggers only one CI pipeline (not per-file)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 15:18:31 -07:00

43 lines
1.7 KiB
Go

// Package port defines interfaces (ports) for external dependencies.
package port
import (
"context"
"github.com/orchard9/rdev/internal/domain"
)
// Deployer manages application deployments to Kubernetes.
type Deployer interface {
// Deploy creates or updates a deployment for a project.
// This includes creating/updating Deployment, Service, and Ingress resources.
Deploy(ctx context.Context, spec domain.DeploySpec) error
// Undeploy removes all deployment resources for a project.
Undeploy(ctx context.Context, projectName string) error
// GetStatus returns the current deployment status for a project.
// Returns nil if no deployment exists.
GetStatus(ctx context.Context, projectName string) (*domain.DeployStatus, error)
// Restart triggers a rolling restart of the deployment.
// This is useful for picking up new images with the same tag.
Restart(ctx context.Context, projectName string) error
// Scale adjusts the replica count for a deployment.
Scale(ctx context.Context, projectName string, replicas int) error
// GetLogs returns recent logs from the deployment pods.
// tailLines specifies how many recent lines to return.
GetLogs(ctx context.Context, projectName string, tailLines int) (string, error)
// AddIngressHost adds a new host to an existing project's ingress.
// This is used when adding domain aliases to a project.
// The host is added to both the TLS configuration and the routing rules.
AddIngressHost(ctx context.Context, projectName, host string) error
// RemoveIngressHost removes a host from an existing project's ingress.
// This is used when removing domain aliases from a project.
RemoveIngressHost(ctx context.Context, projectName, host string) error
}