Skip to main content

Kubernetes Platform for GenAI Applications

Project description

OGM Platform

Kubernetes Platform for GenAI Applications

PyPI version Python 3.8+ License: 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)

pip install ogm-platform

From Source

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

Development Installation

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

Quick Start

After installation, initialize your development environment:

# 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

# .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

# 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

# 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

# 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

# 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

# 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

from ogm.cli import main

# Run the CLI
main()

Configuration Manager

from ogm.config import ConfigManager

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

Authentication Manager

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

# Check system requirements
ogm diagnostic system

# Check network connectivity
ogm diagnostic network

# View detailed logs
ogm logs --level DEBUG

Authentication Issues

# Reset credentials
ogm auth clear

# Reconfigure authentication
ogm auth set git

# Test authentication
ogm auth test

Deployment Failures

# 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:

export OGM_LOG_LEVEL=DEBUG
ogm command --verbose

Getting Help

# 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

# 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 file for details.

Support

For support and questions:

Changelog

See 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 for details on how to get involved. /home/mksaraf/projects/ogm-platform-package/README.ogm-platform.md

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ogm_platform-1.0.14.tar.gz (69.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ogm_platform-1.0.14-py3-none-any.whl (71.0 kB view details)

Uploaded Python 3

File details

Details for the file ogm_platform-1.0.14.tar.gz.

File metadata

  • Download URL: ogm_platform-1.0.14.tar.gz
  • Upload date:
  • Size: 69.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for ogm_platform-1.0.14.tar.gz
Algorithm Hash digest
SHA256 229a042d0cb12b42cd70a85618aa841921b1168086cc1ab0b3834c823b4d3300
MD5 7355c08b67b4f4767ddac3fd06728c1b
BLAKE2b-256 3a7cf675c3debed72313a27c393a350144173c4b8f1a703b3b90e2a963ba1e1e

See more details on using hashes here.

File details

Details for the file ogm_platform-1.0.14-py3-none-any.whl.

File metadata

  • Download URL: ogm_platform-1.0.14-py3-none-any.whl
  • Upload date:
  • Size: 71.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for ogm_platform-1.0.14-py3-none-any.whl
Algorithm Hash digest
SHA256 f3190f69bacd5794b9f84d14f37c4c9d7e054d6375eb2546abc4331ef7e6c9ee
MD5 cb94677e3f00b3dcd358633ec96f11a0
BLAKE2b-256 040061afcc350b07c078f4485550d03b9cb31b1ec2e7b7435f2bf78e29e1831b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page