Metadata-Version: 2.1
Name: ogm-platform
Version: 1.0.14
Summary: Kubernetes Platform for GenAI Applications
Author-email: OGM-Dev Team <dev@ogmplatform.com>
License: MIT
Project-URL: Homepage, https://ogmplatform.com
Project-URL: Documentation, https://docs.ogmplatform.com
Project-URL: Repository, https://github.com/ogmworldwide/ogm-platform
Project-URL: Issues, https://github.com/ogmworldwide/ogm-platform/issues
Keywords: k3s,kubernetes,genai,ai,development,devops,helm,docker
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: System :: Systems Administration
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE.md
Requires-Dist: click<9.0.0,>=8.0.0
Requires-Dist: pydantic<2.0.0,>=1.10.0
Requires-Dist: rich<14.0.0,>=13.0.0
Requires-Dist: PyYAML<7.0,>=6.0
Requires-Dist: kubernetes<29.0.0,>=28.0.0
Requires-Dist: docker<7.0.0,>=6.1.0
Requires-Dist: GitPython<4.0.0,>=3.1.40
Requires-Dist: requests<3.0.0,>=2.31.0
Requires-Dist: httpx<1.0.0,>=0.25.0
Provides-Extra: dev
Requires-Dist: pytest<8.0.0,>=7.4.0; extra == "dev"
Requires-Dist: pytest-cov<5.0.0,>=4.1.0; extra == "dev"
Requires-Dist: pytest-mock<4.0.0,>=3.12.0; extra == "dev"
Requires-Dist: black<24.0.0,>=23.0.0; extra == "dev"
Requires-Dist: flake8<7.0.0,>=6.1.0; extra == "dev"
Requires-Dist: mypy<2.0.0,>=1.7.0; extra == "dev"
Requires-Dist: isort<6.0.0,>=5.12.0; extra == "dev"
Provides-Extra: docs
Requires-Dist: mkdocs<2.0.0,>=1.5.0; extra == "docs"
Requires-Dist: mkdocs-material<10.0.0,>=9.4.0; extra == "docs"
Requires-Dist: mkdocstrings[python]<1.0.0,>=0.24.0; extra == "docs"

# OGM Platform

**Kubernetes Platform for GenAI Applications**

[![PyPI version](https://badge.fury.io/py/ogm-platform.svg)](https://pypi.org/project/ogm-platform/)
[![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

## Overview

OGM Platform is a comprehensive command-line tool that simplifies Kubernetes development for Generative AI applications. It provides one-command setup for complete development environments with K3s or full Kubernetes clusters.

The platform is designed to bridge the gap between local development and production deployment, offering developers a unified workflow for building, testing, and deploying GenAI applications on Kubernetes.

## Key Features

- 🚀 **One-Command Setup**: Initialize complete Kubernetes clusters (K3s or Full K8s)
- 🔄 **Multi-Environment Support**: Seamless deployment across local, dev, stage, and production
- 📦 **Helm Integration**: Automated Helm chart deployment and management
- 🔐 **Authentication Management**: Secure credential storage and Kubernetes context handling
- 📊 **Monitoring & Diagnostics**: Built-in health checks and troubleshooting tools
- 🔄 **GitOps Workflow**: Automated repository synchronization
- 🛡️ **Production Ready**: Enterprise-grade security and reliability
- 🏗️ **Modular Architecture**: Extensible design for custom components

## Installation

### From PyPI (Recommended)

```bash
pip install ogm-platform
```

### From Source

```bash
git clone https://github.com/ogmworldwide/ogm-platform.git
cd ogm-platform
pip install -e .
```

### Development Installation

```bash
git clone https://github.com/ogmworldwide/ogm-platform.git
cd ogm-platform
pip install -e ".[dev]"
```

## Quick Start

After installation, initialize your development environment:

```bash
# Initialize a development environment
ogm init

# Deploy applications
ogm deploy

# Check cluster status
ogm status

# Clean up environment
ogm destroy
```

## Architecture

### Core Components

The OGM Platform consists of several key modules:

```
ogm/
├── cli.py          # Command-line interface and command routing
├── config.py       # Configuration management and validation
├── auth.py         # Authentication and credential management
├── k3s.py          # K3s cluster operations and management
├── helm.py         # Helm chart deployment and management
├── git_ops.py      # Git operations with authentication
├── state.py        # State persistence and cluster tracking
├── diagnostic.py   # Health checks and troubleshooting
├── insight.py      # Analytics and monitoring
├── readiness.py    # Deployment readiness checks
├── sync.py         # Synchronization operations
└── utils.py        # Utility functions and helpers
```

### Design Principles

- **Modular Design**: Each module has a single responsibility
- **Dependency Injection**: Clean separation of concerns
- **Configuration-Driven**: Behavior controlled by configuration files
- **Error Handling**: Comprehensive error handling and logging
- **Security First**: Secure credential management and access controls

### Data Flow

```
User Input → CLI Parser → Command Handler → Manager → Kubernetes API
                                      ↓
Configuration ← State Manager ← File System
                                      ↓
Credentials ← Auth Manager ← Secure Storage
```

## Commands

### Core Commands

| Command | Description | Example |
|---------|-------------|---------|
| `ogm init` | Initialize Kubernetes cluster and environment | `ogm init` |
| `ogm deploy` | Deploy applications to cluster | `ogm deploy myapp` |
| `ogm destroy` | Remove applications or entire environment | `ogm destroy myapp` |
| `ogm status` | Check cluster and application status | `ogm status` |
| `ogm logs` | View application logs | `ogm logs myapp` |

### Configuration Commands

| Command | Description | Example |
|---------|-------------|---------|
| `ogm config` | Manage configuration settings | `ogm config set environment dev` |
| `ogm auth` | Manage authentication credentials | `ogm auth set git` |

### Development Commands

| Command | Description | Example |
|---------|-------------|---------|
| `ogm dev` | Development workflow commands | `ogm dev shell` |
| `ogm test` | Run tests and validation | `ogm test unit` |
| `ogm build` | Build and package applications | `ogm build myapp` |

### Advanced Commands

| Command | Description | Example |
|---------|-------------|---------|
| `ogm diagnostic` | Run diagnostic checks | `ogm diagnostic full` |
| `ogm insight` | View analytics and metrics | `ogm insight usage` |
| `ogm sync` | Synchronize repositories and configs | `ogm sync repos` |

## Configuration

### Configuration Files

The platform uses a hierarchical configuration system:

1. **Global Config**: `~/.ogm/config.yaml` - User-specific settings
2. **Project Config**: `.ogmconfig` - Project-specific settings
3. **Environment Variables**: Runtime overrides

### Example Configuration

```yaml
# .ogmconfig
version: "1.0.0"
repos_dir: ~/ogm-repos

k3s:
  version: v1.28.5+k3s1
  kubeconfig_path: ~/.kube/config
  data_dir: /var/lib/rancher/k3s

kubernetes:
  version: v1.28.5
  cluster_name: ogm-cluster
  network_plugin: calico

environments:
  dev:
    cluster_type: k3s
    nodes: 1
  prod:
    cluster_type: kubernetes
    nodes: 3
```

### Environment Variables

| Variable | Description | Default |
|----------|-------------|---------|
| `OGM_ENVIRONMENT` | Target environment | `dev` |
| `OGM_CONFIG_DIR` | Configuration directory | `~/.ogm` |
| `OGM_LOG_LEVEL` | Logging verbosity | `INFO` |
| `KUBECONFIG` | Kubernetes config path | `~/.kube/config` |

## Usage Examples

### Basic Development Workflow

```bash
# 1. Initialize development environment
ogm init

# 2. Set up authentication
ogm auth set git --username yourusername --token yourtoken

# 3. Clone and deploy an application
ogm deploy my-genai-app

# 4. Check status
ogm status

# 5. View logs
ogm logs my-genai-app

# 6. Clean up when done
ogm destroy my-genai-app
```

### Multi-Environment Deployment

```bash
# Deploy to different environments
OGM_ENVIRONMENT=staging ogm deploy myapp
OGM_ENVIRONMENT=production ogm deploy myapp

# Check status across environments
ogm status --environment staging
ogm status --environment production
```

### Custom Configuration

```bash
# Create custom configuration
ogm config set k3s.version v1.29.0+k3s1
ogm config set kubernetes.nodes 5

# View current configuration
ogm config list
```

## Development

### Setting Up Development Environment

```bash
# Clone the repository
git clone https://github.com/ogmworldwide/ogm-platform.git
cd ogm-platform

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install in development mode
pip install -e ".[dev]"

# Run tests
pytest

# Run linting
black ogm/
flake8 ogm/
mypy ogm/
```

### Running Tests

```bash
# Run all tests
pytest

# Run specific test file
pytest tests/test_cli.py

# Run with coverage
pytest --cov=ogm --cov-report=html

# Run integration tests
pytest tests/integration/
```

### Code Quality

The project uses several tools to maintain code quality:

- **Black**: Code formatting
- **Flake8**: Linting and style checking
- **MyPy**: Static type checking
- **Pytest**: Unit and integration testing
- **Coverage**: Test coverage reporting

### Contributing

1. Fork the repository
2. Create a feature branch: `git checkout -b feature/your-feature`
3. Make your changes and add tests
4. Run the test suite: `pytest`
5. Check code quality: `black ogm/ && flake8 ogm/ && mypy ogm/`
6. Commit your changes: `git commit -am 'Add your feature'`
7. Push to the branch: `git push origin feature/your-feature`
8. Create a Pull Request

### Code Structure

```
ogm/
├── cli.py              # Main CLI entry point
├── config.py           # Configuration management
├── managers/           # Business logic managers
│   ├── auth_manager.py
│   ├── k3s_manager.py
│   ├── helm_manager.py
│   └── git_manager.py
├── models/             # Data models and schemas
│   ├── config.py
│   ├── cluster.py
│   └── deployment.py
├── utils/              # Utility functions
│   ├── logging.py
│   ├── validation.py
│   └── helpers.py
└── commands/           # CLI command implementations
    ├── init.py
    ├── deploy.py
    ├── destroy.py
    └── status.py
```

## API Reference

### Core Classes

#### CLI Class
```python
from ogm.cli import main

# Run the CLI
main()
```

#### Configuration Manager
```python
from ogm.config import ConfigManager

config = ConfigManager()
settings = config.load()
```

#### Authentication Manager
```python
from ogm.auth import AuthManager

auth = AuthManager()
auth.set_credentials('git', username='user', token='token')
```

### Managers

The platform uses a manager pattern for different concerns:

- **ConfigManager**: Handles configuration loading and validation
- **AuthManager**: Manages authentication credentials
- **K3sManager**: Handles K3s cluster operations
- **HelmManager**: Manages Helm chart deployments
- **GitManager**: Handles Git operations
- **StateManager**: Manages cluster state persistence

## Troubleshooting

### Common Issues

#### Cluster Initialization Fails
```bash
# Check system requirements
ogm diagnostic system

# Check network connectivity
ogm diagnostic network

# View detailed logs
ogm logs --level DEBUG
```

#### Authentication Issues
```bash
# Reset credentials
ogm auth clear

# Reconfigure authentication
ogm auth set git

# Test authentication
ogm auth test
```

#### Deployment Failures
```bash
# Check cluster status
ogm status

# View deployment logs
ogm logs deployment-name

# Run diagnostics
ogm diagnostic cluster
```

### Debug Mode

Enable debug logging for detailed troubleshooting:

```bash
export OGM_LOG_LEVEL=DEBUG
ogm command --verbose
```

### Getting Help

```bash
# View help for any command
ogm --help
ogm command --help

# View diagnostic information
ogm diagnostic --full

# Check version and system info
ogm version
```

## Security

### Credential Management

The platform securely stores credentials using:

- Encrypted local storage
- Environment variable support
- Integration with system keyrings
- Temporary credential caching

### Best Practices

- Never commit credentials to version control
- Use environment-specific credentials
- Regularly rotate authentication tokens
- Enable audit logging for production deployments

## Performance

### Optimization Tips

- Use K3s for development environments
- Configure appropriate resource limits
- Enable caching for repeated operations
- Use incremental deployments when possible

### Monitoring

```bash
# View performance metrics
ogm insight performance

# Monitor resource usage
ogm insight resources

# Check cluster health
ogm diagnostic health
```

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## Support

For support and questions:
- 📧 Email: dev@ogmplatform.com
- 📖 Documentation: https://docs.ogmplatform.com
- 🐛 Issues: https://github.com/ogmworldwide/ogm-platform/issues
- 💬 Discussions: https://github.com/ogmworldwide/ogm-platform/discussions

## Changelog

See [CHANGELOG.md](CHANGELOG.md) for version history and updates.

## Roadmap

### Upcoming Features

- Enhanced multi-cluster support
- Improved CI/CD integration
- Advanced monitoring and alerting
- Plugin system for custom components
- Cloud provider integrations

### Contributing to the Roadmap

We welcome feature requests and contributions. Please see our [Contributing Guide](CONTRIBUTING.md) for details on how to get involved.</content>
<parameter name="filePath">/home/mksaraf/projects/ogm-platform-package/README.ogm-platform.md
