https://github.com/akmshasan/helmctl
π Enterprise-grade CLI tool for Helmfile operations and Kubernetes deployments. Features multi-cluster support, rollback system, template validation, and production safety controls. Built with Rust for performance and reliability.
https://github.com/akmshasan/helmctl
cli deployment devops enterprise gitops helm helmfile infrastructure-automation kubernetes rust
Last synced: 3 months ago
JSON representation
π Enterprise-grade CLI tool for Helmfile operations and Kubernetes deployments. Features multi-cluster support, rollback system, template validation, and production safety controls. Built with Rust for performance and reliability.
- Host: GitHub
- URL: https://github.com/akmshasan/helmctl
- Owner: akmshasan
- Created: 2025-05-31T18:09:41.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2025-05-31T18:45:24.000Z (4 months ago)
- Last Synced: 2025-06-01T06:47:39.879Z (4 months ago)
- Topics: cli, deployment, devops, enterprise, gitops, helm, helmfile, infrastructure-automation, kubernetes, rust
- Language: HTML
- Homepage: https://www.linkedin.com/in/akmshasan
- Size: 91.8 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Helmctl π
[](https://www.rust-lang.org/)
[](https://kubernetes.io/)
[](https://opensource.org/licenses/MIT)
[](https://github.com/akmshasan/helmctl/stargazers)> π Enterprise-grade CLI for Helmfile operations and Kubernetes deployments - Built with Rust
## β¨ Features
- π **Advanced Helmfile Linting** - Environment-specific validation with strict mode
- π **Safe Deployments** - Production confirmations, dry-run modes, and rollback capabilities
- βΈοΈ **Kubernetes Integration** - Direct manifest deployment with multi-cluster support
- π **Rollback System** - Individual release or full environment rollback functionality
- π **Status Monitoring** - Detailed release and pod status checking
- β **Template Validation** - YAML syntax checking and Helmfile template rendering
- βοΈ **Configuration Management** - Persistent settings with YAML configuration
- π **Multi-cluster Support** - Context switching with connectivity tests
- π **Comprehensive Logging** - Structured JSON logging with audit trails
- π‘οΈ **Safety First** - Production deployment confirmations and dry-run modes## π― Quick Start
### Prerequisites
Ensure you have the following tools installed:
- `helmfile` - [Install Helmfile](https://github.com/helmfile/helmfile#installation)
- `helm` - [Install Helm](https://helm.sh/docs/intro/install/)
- `kubectl` - [Install kubectl](https://kubernetes.io/docs/tasks/tools/)### Installation
#### Option 1: Build from Source
```bash
# Clone or extract the project
git clone https://github.com/akmshasan/helmctl
cd helmctl# Build the project
make build# Install system-wide (optional)
make install
```#### Option 2: Download Binary
```bash
# Download from releases (when available)
curl -L -o helmctl
chmod +x helmctl
sudo mv helmctl /usr/local/bin/
```### Initialize Configuration
```bash
helmctl config init
helmctl config show
```## π Commands Overview
### Core Operations
#### Lint Helmfiles
```bash
# Basic linting
helmctl lint -f helmfile.yaml -e development# Strict mode (fail on warnings)
helmctl lint -f helmfile.yaml -e production --strict# Template validation only
helmctl lint -f helmfile.yaml --template-only
```#### Deploy with Helmfile
```bash
# Dry-run deployment
helmctl deploy -f helmfile.yaml -e staging --dry-run# Production deployment with confirmation
helmctl deploy -f helmfile.yaml -e production --concurrency 3# Deploy with diff preview
helmctl deploy -f helmfile.yaml -e development --diff# Skip dependency updates
helmctl deploy -f helmfile.yaml -e development --skip-deps
```#### Direct Kubernetes Deployment
```bash
# Deploy manifest with dry-run
helmctl k8s-deploy -m app.yaml --dry-run# Deploy to specific namespace with wait
helmctl k8s-deploy -m app.yaml -n production --wait --timeout 600# Deploy with specific context
helmctl k8s-deploy -m app.yaml --context prod-cluster
```### Advanced Operations
#### Rollback Management
```bash
# Rollback specific release to specific revision
helmctl rollback -f helmfile.yaml -e production -r app-name --revision 2# Rollback all releases in environment
helmctl rollback -f helmfile.yaml -e staging# Rollback with context switching
helmctl rollback -f helmfile.yaml -e production --context prod-cluster
```#### Status Monitoring
```bash
# Check status of all releases
helmctl status -f helmfile.yaml -e development# Check specific release status
helmctl status -f helmfile.yaml -e staging -r redis-cache# Detailed status with Kubernetes info
helmctl status -f helmfile.yaml -e production --detailed
```#### Template Validation
```bash
# Validate YAML syntax only
helmctl validate -f helmfile.yaml --syntax-only# Full template validation with rendering
helmctl validate -f helmfile.yaml -e development# Validate with verbose output
helmctl validate -f helmfile.yaml -e staging --verbose
```### Configuration Management
#### Basic Configuration
```bash
# Show current configuration
helmctl config show# Initialize with defaults
helmctl config init# Set configuration values
helmctl config set default_environment staging
helmctl config set default_concurrency 3
helmctl config set preferred_context prod-cluster# Get configuration values
helmctl config get default_environment
```#### Available Configuration Options
- `default_environment` - Default environment for operations
- `default_concurrency` - Default concurrency level for deployments
- `default_timeout` - Default timeout for operations (seconds)
- `auto_update_repos` - Automatically update Helm repositories
- `preferred_context` - Default Kubernetes context
- `log_level` - Logging level (debug, info, warn, error)### Context Management
#### Kubernetes Context Operations
```bash
# List available contexts
helmctl context list# Switch to a context
helmctl context use staging-cluster# Show current context with details
helmctl context current
```## βοΈ Configuration
### Configuration File (`helmctl.yaml`)
Create a configuration file in your project directory:
```yaml
# Default settings
default_environment: development
default_concurrency: 2
default_timeout: 300
auto_update_repos: true
preferred_context: minikube
log_level: info# Custom repositories
repositories:
- name: bitnami
url: https://charts.bitnami.com/bitnami
- name: stable
url: https://charts.helm.sh/stable
- name: prometheus-community
url: https://prometheus-community.github.io/helm-charts
- name: grafana
url: https://grafana.github.io/helm-charts
```### Global vs Local Configuration
- **Global**: `~/.helmctl.yaml` - User-wide settings
- **Local**: `./helmctl.yaml` - Project-specific settings
- **Override**: Use `-c/--config` flag to specify custom config file## π‘οΈ Safety Features
### Production Safeguards
- **Interactive confirmations** before production deployments
- **Dry-run modes** for all destructive operations
- **Context verification** before operations
- **Strict linting** with configurable warning levels### Error Handling
- **Dependency checking** - Validates required tools are installed
- **File validation** - Checks for file existence before operations
- **Command validation** - Verifies external commands are available
- **Graceful failures** with descriptive error messages## π§ Development
### Build System (Makefile)
```bash
# Development workflow
make dev # Full development workflow
make quality # Run all quality checks
make test # Run tests
make lint # Lint code
make fmt # Format code# Building
make build # Build release version
make build-optimized # Build with maximum optimizations
make debug # Build debug version# Installation
make install # Install to system PATH
make uninstall # Remove from system# Documentation
make docs # Generate and open documentation# Utilities
make clean # Clean build artifacts
make audit # Security audit
make update # Update dependencies
make watch # Watch for changes and rebuild
```### Quality Assurance
The project includes comprehensive quality checks:
- **Clippy linting** with strict rules
- **Rustfmt formatting** enforcement
- **Unit and integration tests**
- **Security auditing** with cargo-audit
- **Documentation generation**### Project Structure
```
helmctl/
βββ Cargo.toml # Project configuration
βββ Makefile # Build system
βββ README.md # This file
βββ src/
β βββ main.rs # Entry point
β βββ cli.rs # CLI definitions
β βββ config.rs # Configuration management
β βββ utils.rs # Shared utilities
β βββ commands/ # Command implementations
β βββ mod.rs
β βββ lint.rs
β βββ deploy.rs
β βββ k8s.rs
β βββ rollback.rs
β βββ status.rs
β βββ validate.rs
β βββ config_cmd.rs
β βββ context.rs
βββ tests/ # Integration tests
βββ examples/ # Example configurations
βββ docs/ # Documentation
```## π― Use Cases
### CI/CD Integration
```bash
# In your CI/CD pipeline
helmctl lint -f helmfile.yaml -e staging --strict
helmctl deploy -f helmfile.yaml -e staging --dry-run
helmctl deploy -f helmfile.yaml -e staging
helmctl status -f helmfile.yaml -e staging --detailed
```### Development Workflow
```bash
# Local development
helmctl config set default_environment development
helmctl lint -f helmfile.yaml
helmctl deploy -f helmfile.yaml --dry-run
helmctl deploy -f helmfile.yaml
```### Production Deployment
```bash
# Production deployment with safety checks
helmctl context use production-cluster
helmctl lint -f helmfile.yaml -e production --strict
helmctl deploy -f helmfile.yaml -e production --diff
helmctl deploy -f helmfile.yaml -e production
helmctl status -f helmfile.yaml -e production --detailed
```### Troubleshooting
```bash
# Debugging failed deployments
helmctl status -f helmfile.yaml -e staging --detailed
helmctl validate -f helmfile.yaml -e staging --verbose
helmctl rollback -f helmfile.yaml -e staging
```## π Examples
### Basic Helmfile Structure
```yaml
# helmfile.yaml
repositories:
- name: bitnami
url: https://charts.bitnami.com/bitnamienvironments:
development:
values:
- environments/development.yaml
production:
values:
- environments/production.yamlreleases:
- name: nginx
chart: bitnami/nginx
version: "15.4.4"
values:
- values/nginx-{{ .Environment.Name }}.yaml
```### Environment Configuration
```yaml
# environments/development.yaml
nginx:
replicaCount: 1
service:
type: NodePort
resources:
requests:
memory: "64Mi"
cpu: "50m"
```## π Troubleshooting
### Common Issues
#### Command Not Found
```bash
# Ensure required tools are installed
which helmfile helm kubectl# Install missing tools
# Helmfile: https://github.com/helmfile/helmfile#installation
# Helm: https://helm.sh/docs/intro/install/
# kubectl: https://kubernetes.io/docs/tasks/tools/
```#### Repository Issues
```bash
# Update Helm repositories
helm repo update# Check repository list
helm repo list# Add missing repositories manually
helm repo add bitnami https://charts.bitnami.com/bitnami
```#### Context Issues
```bash
# List available contexts
kubectl config get-contexts# Set correct context
kubectl config use-context# Verify connection
kubectl cluster-info
```### Verbose Mode
Use `--verbose` flag with any command to get detailed output:
```bash
helmctl deploy -f helmfile.yaml -e development --verbose
```### Log Files
Enable logging to file for debugging:
```bash
helmctl --log-file ./logs/helmctl.log deploy -f helmfile.yaml
```## π€ Contributing
1. **Fork the repository**
2. **Create a feature branch**: `git checkout -b feature/amazing-feature`
3. **Make your changes** following the coding standards
4. **Run quality checks**: `make quality`
5. **Test your changes**: `make test`
6. **Commit your changes**: `git commit -m 'Add amazing feature'`
7. **Push to the branch**: `git push origin feature/amazing-feature`
8. **Open a Pull Request**### Development Guidelines
- Follow Rust best practices and idioms
- Maintain test coverage for new features
- Update documentation for user-facing changes
- Run `make quality` before submitting PRs
- Use meaningful commit messages## π License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
## π Acknowledgments
- **Helmfile team** for the excellent Helmfile tool
- **Helm community** for the Helm package manager
- **Kubernetes community** for the orchestration platform
- **Rust community** for the amazing programming language and ecosystem## π Support
- **Issues**: [GitHub Issues](https://github.com/akmshasan/helmctl/issues)
- **Discussions**: [GitHub Discussions](https://github.com/akmshasan/helmctl/discussions)
- **Documentation**: [Wiki](https://github.com/akmshasan/helmctl/wiki)---
**Made with β€οΈ and Rust π¦**