Skip to content

Conversation

@Krigsexe
Copy link

@Krigsexe Krigsexe commented Dec 1, 2025

This commit introduces a complete hybrid architecture allowing Dokploy to manage deployments on both Docker Swarm (existing) and Kubernetes clusters.

Key features:

  • Orchestrator Abstraction Layer (IOrchestratorAdapter interface)
  • SwarmAdapter: wraps existing Docker Swarm functionality
  • KubernetesAdapter: full K8s support with @kubernetes/client-node
  • OrchestratorFactory: auto-detection and factory pattern
  • HPA (Horizontal Pod Autoscaler) support
  • Network Policies support
  • Traefik IngressRoute CRD support for K8s
  • Custom Resource management (CRDs)
  • Resource requests/limits configuration
  • Pod Disruption Budget support
  • Kubernetes probes (liveness, readiness, startup)

Database changes:

  • Extended server table with K8s configuration fields
  • Extended application table with K8s-specific settings
  • New k8s_custom_resource table for CRD storage
  • New k8s_metrics table for HPA custom metrics
  • New k8s_network_policy_rule table
  • New k8s_event_log table

API changes:

  • New kubernetesRouter with full K8s management endpoints
  • HPA, scaling, network policy, metrics endpoints
  • Cluster detection and health check endpoints

This maintains full backward compatibility with existing Swarm deployments.

What is this PR about?

Please describe in a short paragraph what this PR is about.

Checklist

Before submitting this PR, please make sure that:

Issues related (if applicable)

closes #123

Screenshots (if applicable)

This commit introduces a complete hybrid architecture allowing Dokploy to manage
deployments on both Docker Swarm (existing) and Kubernetes clusters.

Key features:
- Orchestrator Abstraction Layer (IOrchestratorAdapter interface)
- SwarmAdapter: wraps existing Docker Swarm functionality
- KubernetesAdapter: full K8s support with @kubernetes/client-node
- OrchestratorFactory: auto-detection and factory pattern
- HPA (Horizontal Pod Autoscaler) support
- Network Policies support
- Traefik IngressRoute CRD support for K8s
- Custom Resource management (CRDs)
- Resource requests/limits configuration
- Pod Disruption Budget support
- Kubernetes probes (liveness, readiness, startup)

Database changes:
- Extended server table with K8s configuration fields
- Extended application table with K8s-specific settings
- New k8s_custom_resource table for CRD storage
- New k8s_metrics table for HPA custom metrics
- New k8s_network_policy_rule table
- New k8s_event_log table

API changes:
- New kubernetesRouter with full K8s management endpoints
- HPA, scaling, network policy, metrics endpoints
- Cluster detection and health check endpoints

This maintains full backward compatibility with existing Swarm deployments.
@Krigsexe Krigsexe requested a review from Siumauricio as a code owner December 1, 2025 11:10
claude and others added 3 commits December 1, 2025 13:32
- Add tests for IOrchestratorAdapter type guards
- Add tests for SwarmAdapter (mocked Docker client)
- Add tests for KubernetesAdapter (interface compliance)
- Add tests for OrchestratorFactory (auto-detection, caching)
- Add tests for Traefik Kubernetes CRD utilities
- Add tests for orchestrator types and configurations
- Fix TypeScript syntax error in kubernetes.adapter.ts

Total: 140 unit tests covering:
- Type guard validation (supportsHPA, supportsNetworkPolicies, etc.)
- Interface compliance for both adapters
- Factory pattern with caching and auto-detection
- Traefik IngressRoute, Middleware, and TLSOption builders
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants