Skip to content

rackerlabs/openCenter-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

596 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

openCenter CLI

openCenter is a command-line tool that transforms a single declarative YAML configuration into a production-ready Kubernetes cluster with GitOps management.

It standardizes cluster deployment across OpenStack, VMware, Baremetal, and Kind, providing configuration validation, secrets management, and automated GitOps repository generation.

What openCenter Does

  • Configuration-First Workflow: Single YAML file defines your entire cluster (infrastructure, Kubernetes, services, secrets)
  • Multi-Provider Support: Deploy to OpenStack, VMware, Baremetal, or Kind with the same configuration structure
  • Built-in Validation: Schema validation, business rules, and provider-specific checks catch errors before deployment
  • GitOps Native: Generates complete FluxCD-ready repository with Kustomize overlays for cluster-specific customization
  • Secrets Management: SOPS Age encryption for safe version control of sensitive data
  • Platform Services: 20+ pre-configured services (monitoring, logging, ingress, auth, storage, backup)

Quick Start

# Install tools
mise install

# Build CLI
mise run build

# Initialize cluster
./bin/opencenter cluster init my-cluster --org my-org

# Edit configuration
$EDITOR ~/.config/opencenter/clusters/my-org/.my-cluster-config.yaml

# Validate
./bin/opencenter cluster validate my-cluster

# Generate GitOps repository
./bin/opencenter cluster generate my-cluster

# Deploy
./bin/opencenter cluster deploy my-cluster

Time to first cluster: 10 minutes configuration + 30-50 minutes deployment

See Getting Started Tutorial for complete walkthrough.

Key Capabilities

  • Cluster Lifecycle: Initialize, configure, validate, generate, deploy, destroy
  • Configuration Management: Schema-driven with defaults, validation, and override capabilities
  • Secrets Operations: Generate keys, encrypt/decrypt, rotate, check expiration, sync, validate drift
  • GitOps Repository: Automated generation with infrastructure (Terraform/Kubespray) and applications (FluxCD/Kustomize)
  • Provider Abstraction: Unified interface across OpenStack, VMware, Baremetal, and Kind
  • Service Management: Enable/disable platform services, customize configurations, view options
  • Operational Tools: Drift detection, backup/restore, audit logging, cluster doctor, import

Configuration Example

opencenter:
  cluster:
    cluster_name: production
    organization: acme-corp
  
  infrastructure:
    provider: openstack
    cloud:
      openstack:
        auth_url: https://identity.api.rackspacecloud.com/v3
        region: sjc3
        application_credential_id: ${OPENSTACK_APP_CRED_ID}
        application_credential_secret: ${OPENSTACK_APP_CRED_SECRET}
  
  kubernetes:
    version: 1.33.5
    control_plane_count: 3
    worker_count: 2
    cni: calico
  
  services:
    keycloak:
      enabled: true
    kube-prometheus-stack:
      enabled: true
    loki:
      enabled: true
    velero:
      enabled: true

secrets:
  sops:
    age_keys:
      - age1ql3z7hjy54pw3hyww5ayyfg7zqgvc7w3j2elw8zmrj2kg5sfn9aqmcac8p

See Configuration Schema Reference for complete structure.

CLI Commands Quick Reference

# Cluster Lifecycle
opencenter cluster init <name> --org <org>     # Initialize new cluster
opencenter cluster configure <name> --guided   # Guided provider configuration
opencenter cluster validate <name>             # Validate configuration
opencenter cluster generate <name>             # Generate GitOps repository
opencenter cluster deploy <name>               # Deploy cluster
opencenter cluster destroy <name>              # Destroy cluster

# Cluster Management
opencenter cluster list                        # List all clusters
opencenter cluster use <name>                  # Set active cluster
opencenter cluster active                      # Show active cluster
opencenter cluster status <name>               # Show cluster status
opencenter cluster describe <name>             # Detailed cluster description
opencenter cluster doctor <name>               # Check tools and readiness

# Configuration
opencenter cluster set <name> <path=value>     # Update configuration value
opencenter cluster edit <name>                 # Edit in $EDITOR
opencenter cluster normalize <name>            # Add missing defaults
opencenter cluster export <name>               # Export effective config

# Service Management
opencenter cluster service enable <svc>        # Enable a platform service
opencenter cluster service disable <svc>       # Disable a platform service
opencenter cluster service status              # Show all service states
opencenter cluster service options <svc>       # Show service config options

# Secrets Management
opencenter secrets keys generate               # Generate Age key pair
opencenter secrets keys rotate --type sops     # Rotate encryption keys
opencenter secrets keys check                  # Check key expiration
opencenter secrets keys backup                 # Backup Age keys
opencenter secrets sync <name>                 # Sync secrets to manifests
opencenter secrets validate <name>             # Validate secrets for drift
opencenter secrets encrypt                     # Encrypt secrets in YAML
opencenter secrets decrypt                     # Decrypt secrets in YAML
opencenter secrets status                      # Show encryption status
opencenter secrets login                       # Refresh Keystone token
opencenter secrets list                        # List secrets
opencenter secrets get <name>                  # Download and decrypt
opencenter secrets set <name>                  # Create or update

# Operations
opencenter cluster drift detect <name>         # Detect infrastructure drift
opencenter cluster drift reconcile <name>      # Reconcile drift
opencenter cluster backup create <name>        # Create backup
opencenter cluster backup restore <id>         # Restore from backup
opencenter cluster lock <name>                 # Lock cluster
opencenter cluster import scan                 # Scan repo for import
opencenter cluster migrate-layout --org <org>  # Migrate to secure layout

# CLI Settings
opencenter settings view                       # Display current settings
opencenter settings set <key> <value>          # Set a value (dot notation)
opencenter settings get <key>                  # Get a value
opencenter settings path                       # Show settings file path
opencenter settings edit                       # Edit settings in editor
opencenter settings ide                        # Generate schema + editor setup
opencenter settings explain                    # Explain config effects

# Plugins
opencenter plugins list                        # List external plugins

# Utilities
opencenter version                             # Show version information
opencenter shell-init                          # Output shell integration script
opencenter --help                              # Show help

See CLI Commands Reference for complete documentation with all flags.

Documentation

Comprehensive documentation organized by the DiΓ‘taxis framework:

πŸ“š Tutorials (Learning-Oriented)

πŸ”§ How-To Guides (Task-Oriented)

πŸ“– Reference (Information-Oriented)

πŸ’‘ Explanation (Understanding-Oriented)

πŸ—ΊοΈ Codemaps (Architecture Maps)

Start here: Documentation Home | Navigation Guide

Development Workflow

Prerequisites

  • Mise - Tool version manager
  • Git - Version control
  • Go, kubectl, kind, helm (managed by Mise)

Build and Test

# Install tools
mise install

# Build binary
mise run build

# Run unit tests
mise run test

# Run BDD tests
mise run godog

# Run property-based tests
mise run test-properties

# Lint code
mise run lint

# Format code
mise run fmt

Development Tasks

# Build for multiple platforms
mise run build-all

# Create release
mise run release v1.0.0

# Generate JSON schema
mise run schema

# Validate templates
mise run validate-templates

# Run a Kind cluster with openCenter-managed CNI
opencenter cluster init dev-cluster --type kind --kind-disable-default-cni
opencenter cluster validate dev-cluster
opencenter cluster generate dev-cluster
opencenter cluster deploy dev-cluster

# Setup local Gitea for testing
mise run gitea-up

See Mise Tasks Reference for complete list.

Tagged releases are published by GitHub Actions. Use mise run release for local preflight builds, then push a v* tag to create the signed release artifacts.

Project Structure

openCenter-cli/
β”œβ”€β”€ cmd/                    # CLI commands (Cobra)
β”‚   β”œβ”€β”€ root.go            # Root command and global flags
β”‚   β”œβ”€β”€ cluster*.go        # Cluster lifecycle commands
β”‚   β”œβ”€β”€ secrets*.go        # Secrets management commands
β”‚   β”œβ”€β”€ config*.go         # Settings commands (Cobra Use: "settings")
β”‚   └── plugins.go         # Plugin management
β”œβ”€β”€ internal/              # Internal packages
β”‚   β”œβ”€β”€ config/           # Configuration management (loader, builder, types, v2)
β”‚   β”œβ”€β”€ cluster/          # Cluster lifecycle services (init, validate, setup, bootstrap)
β”‚   β”œβ”€β”€ gitops/           # GitOps repository generation (pipeline, templates, rendering)
β”‚   β”œβ”€β”€ secrets/          # Multi-cluster secrets management (rotation, registry, hooks)
β”‚   β”œβ”€β”€ sops/             # SOPS encryption (Age keys, file encrypt/decrypt)
β”‚   β”œβ”€β”€ cloud/            # Provider adapters (OpenStack, VMware, Kind)
β”‚   β”œβ”€β”€ security/         # Audit logging, input validation, command sanitization
β”‚   β”œβ”€β”€ di/               # Dependency injection container
β”‚   β”œβ”€β”€ services/         # Platform service plugin registry
β”‚   β”œβ”€β”€ operations/       # Drift detection, backup, disaster recovery
β”‚   β”œβ”€β”€ resilience/       # Retry, circuit breaker, distributed locks
β”‚   β”œβ”€β”€ provision/        # Embedded provisioning templates
β”‚   β”œβ”€β”€ template/         # Template engine with caching and sandboxing
β”‚   β”œβ”€β”€ plugins/          # External CLI plugin discovery
β”‚   β”œβ”€β”€ importer/         # Live cluster import/scan
β”‚   β”œβ”€β”€ credentials/      # Cloud credential extraction
β”‚   β”œβ”€β”€ barbican/         # OpenStack Key Manager client
β”‚   β”œβ”€β”€ localdev/         # Local dev environment (Kind, Gitea, Flux)
β”‚   β”œβ”€β”€ observability/    # Structured logging, credential masking
β”‚   β”œβ”€β”€ ansible/          # Kubespray inventory generation
β”‚   β”œβ”€β”€ tofu/             # OpenTofu/Terraform execution
β”‚   β”œβ”€β”€ ui/               # Prompts, error formatting, guided flows
β”‚   β”œβ”€β”€ core/             # Shared: path resolution, validation engine
β”‚   └── util/             # Files, errors, crypto, security, metrics
β”œβ”€β”€ docs/                  # Documentation (DiΓ‘taxis)
β”‚   β”œβ”€β”€ CODEMAPS/         # Architecture maps (generated from code)
β”‚   β”œβ”€β”€ tutorials/        # Learning-oriented guides
β”‚   β”œβ”€β”€ how-to/           # Task-oriented guides
β”‚   β”œβ”€β”€ reference/        # Information-oriented specs
β”‚   β”œβ”€β”€ explanation/      # Understanding-oriented concepts
β”‚   └── dev/              # Developer documentation
β”œβ”€β”€ tests/                 # BDD tests (Godog)
β”‚   └── features/         # Gherkin feature files
β”œβ”€β”€ schema/                # JSON schema definitions
β”œβ”€β”€ hack/                  # Development scripts and local Gitea setup
β”œβ”€β”€ .mise.toml            # Mise configuration and tasks
β”œβ”€β”€ go.mod                # Go module definition
└── main.go               # CLI entrypoint

See Code Structure and Codemaps for detailed explanation.

Configuration File Locations

  • Cluster configurations: ~/.config/opencenter/clusters/<org>/.<cluster>-config.yaml
  • CLI settings: ~/.config/opencenter/config.yaml
  • Active cluster: ~/.config/opencenter/active
  • SOPS Age keys: ~/.config/opencenter/clusters/<org>/secrets/age/
  • SSH keys: ~/.config/opencenter/clusters/<org>/secrets/ssh/

Override CLI configuration storage with OPENCENTER_CONFIG_DIR and cluster storage with OPENCENTER_CLUSTERS_DIR.

See File Locations Reference for complete paths.

Environment Variables

Variable Description Default
OPENCENTER_CONFIG_DIR Configuration directory ~/.config/opencenter
OPENCENTER_CLUSTERS_DIR Cluster storage directory ${OPENCENTER_CONFIG_DIR}/clusters
OPENCENTER_PLUGINS_DIR Plugins directory ${OPENCENTER_CONFIG_DIR}/plugins
OPENCENTER_LOG_LEVEL Log level (debug, info, warn, error) warn
SOPS_AGE_KEY_FILE Path to Age key file
SOPS_AGE_RECIPIENTS Age public keys for encryption
KUBECONFIG Kubernetes config file ~/.kube/config

See Environment Variables Reference for complete list.

Contributing

We welcome contributions! Please see our Contributing Guide to get started.

Quick Contribution Workflow

  1. Fork and clone the repository
  2. Create a feature branch
  3. Make your changes
  4. Run tests: mise run test && mise run godog
  5. Submit a pull request

Extension Points

  • Custom Providers: Add new infrastructure providers in internal/cloud/<provider>/
  • Custom Services: Add platform services in internal/config/services/<service>.go
  • Custom Validators: Add validation rules in internal/core/validation/
  • Plugins: Create external plugins as opencenter-<plugin> executables

See Developer Documentation for detailed guides.

License

This project is licensed under the Apache 2.0 License. See LICENSE for details.

Support

Related Projects

openCenter CLI is part of the openCenter ecosystem:

About

openCenter

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors