Comprehensive guides and references for the OpenFrame platform
OpenFrame CLI is built with a clean, layered architecture that separates concerns and provides extensibility. This guide provides a comprehensive overview of the system design, component relationships, and key architectural decisions.
OpenFrame CLI follows a layered architecture pattern with clear separation between the CLI interface, business logic, and external integrations:
graph TB
subgraph "User Interface Layer"
CLI[CLI Commands]
UI[Interactive UI]
Wizard[Setup Wizards]
end
subgraph "Application Layer"
Bootstrap[Bootstrap Orchestrator]
ClusterMgr[Cluster Manager]
ChartMgr[Chart Manager]
DevTools[Development Tools]
end
subgraph "Provider Layer"
K3DProvider[K3D Provider]
HelmProvider[Helm Provider]
ArgoCDProvider[ArgoCD Provider]
TelepresenceProvider[Telepresence Provider]
KubectlProvider[kubectl Provider]
GitProvider[Git Provider]
end
subgraph "Infrastructure Layer"
Executor[Command Executor]
Config[Configuration]
Logger[Logging]
ErrorHandler[Error Handling]
FileSystem[File Operations]
end
subgraph "External Systems"
Docker[Docker Engine]
K8s[Kubernetes API]
Git[Git Repositories]
Registry[Container Registry]
ArgoCD[ArgoCD Server]
end
CLI --> Bootstrap
CLI --> ClusterMgr
CLI --> ChartMgr
CLI --> DevTools
Bootstrap --> ClusterMgr
Bootstrap --> ChartMgr
ClusterMgr --> K3DProvider
ChartMgr --> HelmProvider
ChartMgr --> ArgoCDProvider
DevTools --> TelepresenceProvider
DevTools --> KubectlProvider
K3DProvider --> Executor
HelmProvider --> Executor
ArgoCDProvider --> Executor
TelepresenceProvider --> Executor
KubectlProvider --> Executor
GitProvider --> Executor
K3DProvider --> Docker
HelmProvider --> K8s
ArgoCDProvider --> ArgoCD
TelepresenceProvider --> K8s
KubectlProvider --> K8s
GitProvider --> Git
cmd/)The command layer implements the CLI interface using the Cobra framework:
| Component | Purpose | Key Features |
|---|---|---|
| Root Command | Entry point and version management | Interactive help, global flags, subcommand routing |
| Bootstrap Command | Complete environment setup | Orchestrates cluster + chart installation |
| Cluster Commands | Kubernetes cluster lifecycle | Create, delete, list, status operations |
| Chart Commands | Application deployment | Helm charts, ArgoCD applications |
| Dev Commands | Development workflows | Service intercepts, scaffolding |
internal/)The service layer contains the core business logic:
internal/bootstrap/)sequenceDiagram
participant User
participant Bootstrap
participant Cluster
participant Chart
participant ArgoCD
User->>Bootstrap: openframe bootstrap
Bootstrap->>Bootstrap: Check prerequisites
Bootstrap->>Cluster: Create K3D cluster
Cluster-->>Bootstrap: Cluster ready
Bootstrap->>Chart: Install ArgoCD
Chart-->>Bootstrap: ArgoCD installed
Bootstrap->>ArgoCD: Deploy app-of-apps
ArgoCD-->>Bootstrap: Applications synced
Bootstrap-->>User: Environment ready
internal/cluster/)internal/chart/)internal/dev/)The provider layer abstracts external tool integrations:
internal/cluster/providers/k3d/)type Manager interface {
CreateCluster(config ClusterConfig) (*rest.Config, error)
DeleteCluster(name string) error
ListClusters() ([]ClusterInfo, error)
GetClusterStatus(name string) (*ClusterStatus, error)
}
Key responsibilities:
internal/chart/providers/helm/)type Manager interface {
InstallChart(release string, chart string, values map[string]interface{}) error
UpgradeChart(release string, chart string, values map[string]interface{}) error
UninstallChart(release string) error
ListReleases() ([]Release, error)
}
Key responsibilities:
internal/chart/providers/argocd/)type Manager interface {
CreateApplication(app ApplicationSpec) error
SyncApplication(name string) error
DeleteApplication(name string) error
WaitForSync(name string, timeout time.Duration) error
}
Key responsibilities:
internal/shared/)Common utilities and cross-cutting concerns:
internal/shared/executor/)internal/shared/config/)internal/shared/ui/)The bootstrap process follows a carefully orchestrated sequence:
flowchart TD
A[Start Bootstrap] --> B[Check Prerequisites]
B --> C{Prerequisites OK?}
C -->|No| D[Install Missing Tools]
C -->|Yes| E[Validate Configuration]
D --> E
E --> F[Create K3D Cluster]
F --> G[Wait for Cluster Ready]
G --> H[Install ArgoCD]
H --> I[Configure Git Repositories]
I --> J[Deploy App-of-Apps]
J --> K[Wait for Application Sync]
K --> L{All Apps Healthy?}
L -->|No| M[Troubleshoot & Retry]
L -->|Yes| N[Bootstrap Complete]
M --> K
Services interact through well-defined interfaces:
classDiagram
class BootstrapService {
+Execute(config BootstrapConfig) error
-validatePrerequisites() error
-createCluster() error
-installCharts() error
}
class ClusterService {
+Create(name string) error
+Delete(name string) error
+Status(name string) ClusterStatus
+List() []ClusterInfo
}
class ChartService {
+Install(chart ChartSpec) error
+List() []ChartInfo
+Sync(name string) error
+WaitForReady(name string) error
}
BootstrapService --> ClusterService
BootstrapService --> ChartService
ChartService --> ArgocdProvider
ClusterService --> K3dProvider
Decision: Implement strict layering with dependency injection Rationale:
Decision: Abstract external tools behind provider interfaces Rationale:
Decision: Centralize external command execution Rationale:
Decision: Provide both interactive and non-interactive modes Rationale:
Decision: Default to GitOps workflows with ArgoCD Rationale:
graph TD
A[Error Occurs] --> B{Error Type?}
B -->|Validation Error| C[Show Usage Help]
B -->|External Tool Error| D[Parse Tool Output]
B -->|Network Error| E[Suggest Connectivity Check]
B -->|Resource Error| F[Check Resource Availability]
C --> G[Exit with Code 1]
D --> H{Recoverable?}
E --> H
F --> H
H -->|Yes| I[Retry with Backoff]
H -->|No| J[Show Error + Solutions]
I --> K{Max Retries?}
K -->|No| A
K -->|Yes| J
J --> G
| Category | Examples | Handling Strategy |
|---|---|---|
| User Input | Invalid flags, missing config | Show usage help, suggest corrections |
| Prerequisites | Missing tools, permissions | Guide installation, check prerequisites |
| Network | Connection timeouts, DNS issues | Retry with backoff, check connectivity |
| Resource | Insufficient memory, disk space | Check resources, suggest alternatives |
| External Tools | kubectl errors, helm failures | Parse tool output, provide context |
# ~/.openframe/config.yaml
openframe:
log_level: "info"
config_dir: "~/.openframe"
cluster:
provider: "k3d"
default_name: "openframe-local"
nodes: 1
bootstrap:
mode: "oss-tenant"
timeout: "15m"
interactive: true
chart:
timeout: "10m"
wait_for_ready: true
dev:
intercept_timeout: "5m"
scaffold_template_dir: "~/.openframe/templates"
graph TB
subgraph "Unit Tests"
A[Service Logic Tests]
B[Provider Tests with Mocks]
C[Utility Function Tests]
end
subgraph "Integration Tests"
D[End-to-End Command Tests]
E[Provider Integration Tests]
F[External Tool Integration]
end
subgraph "Acceptance Tests"
G[Complete Bootstrap Workflow]
H[Multi-Cluster Scenarios]
I[Development Workflow Tests]
end
A --> D
B --> E
C --> F
D --> G
E --> H
F --> I
graph LR
subgraph "Trusted Zone"
A[OpenFrame CLI]
B[Local Kubernetes]
C[Local Docker]
end
subgraph "Semi-Trusted Zone"
D[Container Images]
E[Helm Charts]
F[Git Repositories]
end
subgraph "Untrusted Zone"
G[Public Internet]
H[External APIs]
I[User Input]
end
A --> B
A --> C
B --> D
A --> E
A --> F
E --> G
F --> G
A --> H
I --> A
cmd/ subdirectoryinternal/ packageinternal/*/providers/ directoryFuture extensibility through plugins:
graph TB
A[OpenFrame Core] --> B[Plugin Manager]
B --> C[Command Plugins]
B --> D[Provider Plugins]
B --> E[UI Plugins]
C --> F[Custom Commands]
D --> G[New Tool Integrations]
E --> H[Custom Interfaces]
type VersionInfo struct {
Version string // Semantic version
Commit string // Git commit hash
Date string // Build timestamp
Go string // Go version used
}
To deepen your understanding of OpenFrame CLI architecture: