# Container Mom

> Containers like mom used to make

Container Mom is a Kubernetes operator that makes deploying and managing applications as easy as sharing your Git repository. It handles everything from source-to-image builds to certificate management, just like mom always took care of everything for you.

## Features

- **One-Click Deployments**: Share your Git repo, and mom handles the rest
- **Multi-Cluster Support**: Deploy across multiple clusters
- **Automatic TLS**: Built-in certificate management with Let's Encrypt
- **Custom Domains**: Use your domain or get a free *.container.mom subdomain
- **Resource Management**: Smart resource allocation and quota enforcement
- **Built-in Monitoring**: Health checks and automatic recovery
- **Billing Integration**: Usage-based billing with different service tiers
- **Web Portal**: Modern dashboard for managing deployments and billing

## Getting Started

### Prerequisites

- Kubernetes 1.21+
- cert-manager v1.13+
- Nginx Ingress Controller

### Installation

1. Install cert-manager:
```bash
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.13.3/cert-manager.yaml
```

2. Deploy Container Mom:
```bash
kubectl apply -k config/manager
```

## Usage

### Basic Deployment

Create a deployment:

```yaml
apiVersion: containermom.io/v1alpha1
kind: ContainerMomDeployment
metadata:
  name: my-app
spec:
  source:
    gitUrl: "https://github.com/user/repo"
    buildConfig:
      builderImage: "nodejs-16"
  clusters:
    - us-east-1
  domain:
    useWildcard: true
  resources:
    cpu: "1"
    memory: "1Gi"
```

### Customer Configuration

Set up a customer account:

```yaml
apiVersion: containermom.io/v1alpha1
kind: Customer
metadata:
  name: customer-123
spec:
  email: "user@example.com"
  billingTier: "pro"
```

## Configuration

### Pricing Model

Container Mom uses simple, transparent pricing:

- **Base Price**: $1/month per deployment
- **Resource Usage**: Charged based on actual consumption:
  - CPU: Per core/hour
  - Memory: Per GB/hour
  - Storage: Per GB/hour
  - Network: Per GB transferred
- **High Availability**: Multi-cluster deployments charged per additional cluster

Resource rates are defined per cluster and can be viewed in the billing dashboard.
All charges are calculated hourly and billed monthly.

### Domain Options

- **Wildcard Domain**: Automatic subdomain under container.mom
- **Custom Domains**: Bring your own domain with TLS
- **DNS Providers**: Support for Cloudflare, Route53

## Web Portal

### Dashboard

The web portal provides a modern interface for:
- Deployment management
- Resource monitoring
- Health status tracking
- Log viewing

### Billing Interface

The billing section includes:
- Real-time cost tracking
- Resource usage visualization
- Usage breakdown by service
- Billing history
- Cost optimization recommendations

Access the portal at: `https://portal.container.mom`

## Development

### Project Structure

```
.
├── cmd/
│   └── mom/              # Main application
├── pkg/
│   ├── apis/            # API definitions
│   ├── config/          # Configuration
│   ├── controller/      # Controllers
│   ├── domain/         # Domain management
│   ├── operator/       # Core operator
│   └── web/            # Web interface
└── config/             # Kubernetes resources
    ├── crds/
    ├── manager/
    └── rbac/
```

### Building

```bash
# Build the operator
go build -o bin/container-mom cmd/mom/main.go

# Run locally
./bin/container-mom --config config/manager/config.yaml
```

### Testing

```bash
go test ./...
```

## Status

- [x] Core operator framework
- [x] CRD definitions
- [x] Multi-cluster support
- [x] Domain management
- [x] TLS automation
- [x] Web portal
- [x] Billing interface
- [ ] Source-to-image pipeline
- [ ] Monitoring dashboard

## Contributing

1. Fork the repository
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request

## License

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