- Add comprehensive database migrations (001-024) for schema evolution - Enhance API schema with expanded type definitions and resolvers - Add new middleware: audit logging, rate limiting, MFA enforcement, security, tenant auth - Implement new services: AI optimization, billing, blockchain, compliance, marketplace - Add adapter layer for cloud integrations (Cloudflare, Kubernetes, Proxmox, storage) - Update Crossplane provider with enhanced VM management capabilities - Add comprehensive test suite for API endpoints and services - Update frontend components with improved GraphQL subscriptions and real-time updates - Enhance security configurations and headers (CSP, CORS, etc.) - Update documentation and configuration files - Add new CI/CD workflows and validation scripts - Implement design system improvements and UI enhancements
173 lines
3.8 KiB
Markdown
173 lines
3.8 KiB
Markdown
# Crossplane Provider for Proxmox
|
|
|
|
A custom Crossplane provider that enables provisioning and management of Proxmox VE resources through Kubernetes.
|
|
|
|
## Features
|
|
|
|
- **Virtual Machine Management**: Create, update, delete VMs
|
|
- **Storage Management**: Manage storage pools and volumes
|
|
- **Network Management**: Configure network bridges and interfaces
|
|
- **Multi-Site Support**: Manage multiple Proxmox clusters
|
|
- **Status Reporting**: Real-time VM status and IP addresses
|
|
- **Reconciliation**: Automatic drift detection and correction
|
|
- **Retry Logic**: Automatic retry for transient failures
|
|
- **Error Handling**: Comprehensive error handling and reporting
|
|
|
|
## Architecture
|
|
|
|
```
|
|
crossplane-provider-proxmox/
|
|
├── apis/ # CRD API definitions
|
|
│ └── v1alpha1/ # API version
|
|
├── pkg/ # Provider implementation
|
|
│ ├── controller/ # Crossplane controllers
|
|
│ ├── proxmox/ # Proxmox API client
|
|
│ └── managed/ # Managed resource types
|
|
├── config/ # Deployment manifests
|
|
│ └── crd/ # CRD definitions
|
|
└── examples/ # Usage examples
|
|
```
|
|
|
|
## Installation
|
|
|
|
### Prerequisites
|
|
|
|
- Kubernetes cluster with Crossplane installed
|
|
- Proxmox VE cluster with API access
|
|
- Go 1.21+ for building
|
|
|
|
### Build and Install
|
|
|
|
```bash
|
|
# Build the provider
|
|
make build
|
|
|
|
# Install CRDs
|
|
kubectl apply -f config/crd/bases/
|
|
|
|
# Deploy the provider
|
|
kubectl apply -f config/provider.yaml
|
|
|
|
# Create ProviderConfig
|
|
kubectl apply -f examples/provider-config.yaml
|
|
```
|
|
|
|
## Configuration
|
|
|
|
### Module Path
|
|
|
|
**IMPORTANT**: Before building, update the module path in `go.mod`:
|
|
|
|
```go
|
|
module github.com/sankofa/crossplane-provider-proxmox
|
|
```
|
|
|
|
### Provider Configuration
|
|
|
|
```yaml
|
|
apiVersion: proxmox.sankofa.nexus/v1alpha1
|
|
kind: ProviderConfig
|
|
metadata:
|
|
name: proxmox-provider-config
|
|
spec:
|
|
credentials:
|
|
source: Secret
|
|
secretRef:
|
|
name: proxmox-credentials
|
|
namespace: crossplane-system
|
|
key: credentials.json
|
|
sites:
|
|
- name: us-sfvalley
|
|
endpoint: https://ml110-01.sankofa.nexus:8006
|
|
node: ML110-01
|
|
- name: eu-west-1
|
|
endpoint: https://r630-01.sankofa.nexus:8006
|
|
node: R630-01
|
|
```
|
|
|
|
### Create a Virtual Machine
|
|
|
|
```yaml
|
|
apiVersion: proxmox.sankofa.nexus/v1alpha1
|
|
kind: ProxmoxVM
|
|
metadata:
|
|
name: web-server-01
|
|
spec:
|
|
forProvider:
|
|
node: pve1
|
|
name: web-server-01
|
|
cpu: 4
|
|
memory: 8Gi
|
|
disk: 100Gi
|
|
storage: local-lvm
|
|
network: vmbr0
|
|
image: ubuntu-22.04-cloud
|
|
site: us-sfvalley
|
|
providerConfigRef:
|
|
name: proxmox-provider-config
|
|
```
|
|
|
|
## API Reference
|
|
|
|
### ProxmoxVM
|
|
|
|
Manages a Proxmox virtual machine.
|
|
|
|
**Spec:**
|
|
- `node`: Proxmox node to deploy on
|
|
- `name`: VM name
|
|
- `cpu`: Number of CPU cores
|
|
- `memory`: Memory size (e.g., "8Gi")
|
|
- `disk`: Disk size (e.g., "100Gi")
|
|
- `storage`: Storage pool name
|
|
- `network`: Network bridge
|
|
- `image`: OS template/image
|
|
- `site`: Site identifier
|
|
|
|
**Status:**
|
|
- `vmId`: Proxmox VM ID
|
|
- `state`: VM state (running, stopped, etc.)
|
|
- `ipAddress`: VM IP address
|
|
- `conditions`: Resource conditions
|
|
|
|
## Error Handling and Retry Logic
|
|
|
|
The provider includes automatic retry logic for transient failures:
|
|
|
|
- **Network Errors**: Automatically retried with exponential backoff
|
|
- **Temporary Errors**: 502/503 errors are retried
|
|
- **Max Retries**: Configurable (default: 3)
|
|
- **Backoff**: Exponential with jitter, max 30 seconds
|
|
|
|
## Development
|
|
|
|
### Building
|
|
|
|
```bash
|
|
go mod download
|
|
go build -o bin/provider ./cmd/provider
|
|
```
|
|
|
|
### Testing
|
|
|
|
```bash
|
|
go test ./...
|
|
go test -v -race -coverprofile=coverage.out ./...
|
|
```
|
|
|
|
### Running Locally
|
|
|
|
```bash
|
|
# Set up local development environment
|
|
export PROXMOX_ENDPOINT=https://pve1.local:8006
|
|
export PROXMOX_USERNAME=root@pam
|
|
export PROXMOX_PASSWORD=your-password
|
|
|
|
# Run the provider
|
|
./bin/provider
|
|
```
|
|
|
|
## License
|
|
|
|
Apache 2.0
|