opencenter-cli

command module
v0.0.0-...-2170ac4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 26, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

README ΒΆ

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 for the full 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 the 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 the full command tree.

Documentation

The published documentation is built from the AsciiDoc tree under docs/modules/ROOT/pages/, organised by lifecycle category. Each page records its DiΓ‘taxis type (task, reference, or concept) in its :page-type: attribute. Build the site locally with Antora β€” see docs/README.md.

πŸš€ Getting Started
πŸ”§ Operations (How-To)
πŸ“– Reference
🌐 Providers
πŸ’‘ Concepts (Explanation)
πŸ› οΈ Contributing
πŸ—ΊοΈ Codemaps (architecture maps, not part of the published site)

Start here: Documentation Home Β· Glossary Β· Docs README

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 the 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 (CLI settings, v2 loader, defaults, flags)
β”‚   β”œβ”€β”€ 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 site (Antora source)
β”‚   β”œβ”€β”€ README.md          # Layout, build, and editing rules
β”‚   β”œβ”€β”€ antora.yml         # Antora component descriptor
β”‚   β”œβ”€β”€ local-playbook.yml # Local Antora build playbook
β”‚   β”œβ”€β”€ modules/ROOT/      # Canonical AsciiDoc tree (published)
β”‚   β”‚   β”œβ”€β”€ nav.adoc       # Site navigation
β”‚   β”‚   └── pages/         # Pages organised by lifecycle category
β”‚   β”‚       β”œβ”€β”€ getting-started/  # Tutorials (page-type: task)
β”‚   β”‚       β”œβ”€β”€ operations/       # How-to guides (page-type: task)
β”‚   β”‚       β”œβ”€β”€ reference/        # Reference (page-type: reference)
β”‚   β”‚       β”‚   └── opencenter/   # Auto-generated Cobra command pages
β”‚   β”‚       β”œβ”€β”€ concepts/         # Explanations (page-type: concept)
β”‚   β”‚       β”œβ”€β”€ providers/        # Per-provider guides
β”‚   β”‚       β”œβ”€β”€ contributing/     # Contributor docs
β”‚   β”‚       └── release/          # Release notes
β”‚   └── CODEMAPS/          # Architecture maps (not part of the published site)
β”œβ”€β”€ 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 the 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 the 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 the complete list.

Contributing

We welcome contributions. See the 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 the contributing pages for detailed guides.

License

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

Support

openCenter CLI is part of the openCenter ecosystem:

Documentation ΒΆ

The Go Gopher

There is no documentation for this package.

Directories ΒΆ

Path Synopsis
cmd
internal
cloud
Package cloud provides cloud provider abstractions for infrastructure drift detection.
Package cloud provides cloud provider abstractions for infrastructure drift detection.
cloud/openstack
Package openstack provides OpenStack-specific functionality.
Package openstack provides OpenStack-specific functionality.
cloud/vmware
Package vmware provides VMware vSphere-specific infrastructure drift detection.
Package vmware provides VMware vSphere-specific infrastructure drift detection.
cluster
Package cluster provides domain services for cluster lifecycle management.
Package cluster provides domain services for cluster lifecycle management.
config
Package config provides functionality for managing cluster configurations.
Package config provides functionality for managing cluster configurations.
core/paths
Package paths provides centralized path resolution for opencenter-cli clusters.
Package paths provides centralized path resolution for opencenter-cli clusters.
core/validation
Package validation provides a unified validation engine for all validation operations.
Package validation provides a unified validation engine for all validation operations.
core/validation/validators
Package validators provides built-in validators for common validation tasks.
Package validators provides built-in validators for common validation tasks.
di
Package di provides dependency injection container management for opencenter-cli.
Package di provides dependency injection container management for opencenter-cli.
gitops
Package gitops provides functionality for managing GitOps templates.
Package gitops provides functionality for managing GitOps templates.
logging
Package logging provides the global logging system for opencenter-cli.
Package logging provides the global logging system for opencenter-cli.
operations
Package operations provides operational components for cluster management, including drift detection, backup management, and disaster recovery.
Package operations provides operational components for cluster management, including drift detection, backup management, and disaster recovery.
provision
Package provision provides functionality for managing provisioning templates.
Package provision provides functionality for managing provisioning templates.
secrets
Package secrets provides multi-cluster secrets management for openCenter-cli.
Package secrets provides multi-cluster secrets management for openCenter-cli.
template
Package template provides a clean, extensible template engine abstraction for rendering Go templates with caching, validation, and error reporting.
Package template provides a clean, extensible template engine abstraction for rendering Go templates with caching, validation, and error reporting.
testing
Package testing provides unified test helper utilities for opencenter-cli.
Package testing provides unified test helper utilities for opencenter-cli.
ui
Package ui provides user interface utilities for the opencenter CLI.
Package ui provides user interface utilities for the opencenter CLI.
util
Package util provides utility functions for opencenter.
Package util provides utility functions for opencenter.
util/crypto
Package crypto provides cryptographic utilities for key generation, validation, and management.
Package crypto provides cryptographic utilities for key generation, validation, and management.
util/errors
Package errors provides structured error handling utilities with actionable suggestions.
Package errors provides structured error handling utilities with actionable suggestions.
util/files
Package files contains the legacy atomic write helper still used by key management code.
Package files contains the legacy atomic write helper still used by key management code.
util/fs
Package fs provides safe file system operations with consistent error handling.
Package fs provides safe file system operations with consistent error handling.
util/metrics
Package metrics provides performance tracking and metrics collection for opencenter operations.
Package metrics provides performance tracking and metrics collection for opencenter operations.
util/security
Package security provides security utilities for handling sensitive data, credential masking, secure temporary file operations, and audit logging.
Package security provides security utilities for handling sensitive data, credential masking, secure temporary file operations, and audit logging.
tests

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL