Skip to content

flacatus/spoticus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spoticus 🤖

A friendly Slack bot for managing Kubernetes clusters with a clean, well-structured codebase.

🏗️ Project Structure

spoticus/
├── cmd/spoticus/          # Application entry point
│   └── main.go           # Main application
├── internal/              # Internal packages
│   ├── app/              # Application management
│   │   ├── app.go        # Main app initialization
│   │   └── schema_registry.go  # Kubernetes schema registration
│   ├── k8s/              # Kubernetes client
│   │   └── client.go     # K8s client wrapper
│   ├── logger/           # Logging system
│   │   └── logger.go     # Centralized logging
│   └── slack/            # Slack integration
│       ├── bot.go        # Slack bot management
│       ├── commands/     # Command system
│       │   ├── interface.go  # Command interface
│       │   ├── registry.go   # Command registry
│       │   └── launch/       # Launch command
│       │       ├── command.go    # Main command logic
│       │       ├── cluster.go    # Cluster operations
│       │       ├── messages.go   # Slack messaging
│       │       ├── types.go      # Data types
│       │       └── utils.go      # Utilities
│       ├── events/       # Event handling
│       │   └── events.go # Event processing
│       └── handlers/     # Message handlers
│           └── handlers.go # Message routing
├── go.mod               # Go modules
├── go.sum               # Dependencies
├── Makefile             # Build automation
└── README.md           # This file

🚀 Features

  • Clean Architecture: Well-organized, modular code structure
  • Friendly Interface: User-friendly Slack commands and messages
  • Kubernetes Integration: Direct K8s cluster management
  • Structured Logging: Centralized logging with Zap
  • Error Handling: Robust error handling and user feedback
  • Type Safety: Strong typing throughout the codebase

🛠️ Commands

Launch Command

launch <cluster_type> <size>

Examples:

  • launch kubernetes large
  • launch openshift medium

Supported Sizes:

  • medium - 8 CPUs, 32 GB RAM
  • large - 16 CPUs, 64 GB RAM
  • xlarge - 32 CPUs, 128 GB RAM

🏃‍♂️ Quick Start

  1. Set Environment Variables:

    export SLACK_BOT_TOKEN="your-bot-token"
    export SLACK_APP_TOKEN="your-app-token"
    export DEBUG="true"  # Optional: enable debug logging
  2. Build and Run:

    make build
    ./bin/spoticus

🏗️ Architecture

Core Components

  • App Package: Centralized application management
  • K8s Client: Clean Kubernetes operations wrapper
  • Slack Bot: Modular bot with event handling
  • Command System: Extensible command registry
  • Logger: Structured logging with context

Design Principles

  • Separation of Concerns: Each package has a clear responsibility
  • Dependency Injection: Clean dependency management
  • Error Handling: Comprehensive error handling and user feedback
  • Logging: Structured logging with context and levels
  • Type Safety: Strong typing throughout

🔧 Development

Building

make build

Testing

make test

Running

make run

📝 Code Style

  • Clean Names: Friendly, descriptive function and variable names
  • Modular Design: Small, focused functions and packages
  • Clear Comments: Helpful comments for complex logic
  • Consistent Formatting: Go fmt compliance
  • Error Handling: Proper error propagation and user feedback

🤝 Contributing

  1. Follow the existing code structure
  2. Use friendly, descriptive names
  3. Add appropriate logging
  4. Handle errors gracefully
  5. Keep functions small and focused

📄 License

This project is licensed under the MIT License.

About

A lightweight Slack bot that provisions Kubernetes and OpenShift clusters on AWS using mapt as tool to optimize costs

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors