A custom Kubernetes controller for automating OS provisioning in cloud environments, with integrated support for the Naver Cloud Platform (NCP) through the Aviator service SDK. The Aviator-service repository contains the core SDK implementation for cloud infrastructure automation.
This Kubernetes controller automates the provisioning and management of virtual machines through custom resources. It integrates with NCP APIs to handle VM lifecycle operations including creation, updates, deletion, and status monitoring.
-
Custom Resource Definitions (CRDs)
- Group:
vm.cloudclub.io
- Version:
v1
- Resources:
Provision
: Manages VM provisioning lifecyclePlan
: Handles VM planning and configuration
- Group:
-
Integrated NCP Operations
- Server instance creation and management
- Network interface configuration
- Block storage management
- Access control group handling
- Status monitoring and updates
-
Controller Core
- Custom Resource Definitions
- Reconciliation Logic
- Status Management
-
Aviator Service SDK Integration
- ServerService: Handles VM operations
- KeyService: Manages authentication
- Error handling and status checking
- NCP API integration
type ServerInterface interface {
List(url string, request *types.ListServerRequest) (*types.ListServerResponse, error)
Create(url string, request *types.CreateServerRequest, params []int) (*types.CreateServerResponse, error)
Update(url string, request *types.UpdateServerRequest) (*types.UpdateServerResponse, error)
Start(url string, request *types.StartServerRequest) (*types.StartServerResponse, error)
Stop(url string, request *types.StopServerRequest) (*types.StopServerResponse, error)
Delete(url string, request *types.DeleteServerRequest) (*types.DeleteServerResponse, error)
}
apiVersion: vm.cloudclub.io/v1
kind: Provision
spec:
regionCode: KR
server:
imageProductCode: UBUNTU20
productCode: SPSVRSTAND000056
vpcNo: "vpc-123"
subnetNo: "subnet-456"
phase: Create
- Go 1.16+
- Kubernetes cluster (1.19+)
- Docker or compatible container runtime
- NCP Account and API Credentials
- Aviator Service SDK
- Clone the repositories:
# Main controller
git clone https://github.com/your-org/vm-controller
# Aviator Service SDK
git clone https://github.com/cloud-club/Aviator-service
- Configure NCP credentials:
export NCP_ACCESS_KEY="your-access-key"
export NCP_SECRET_KEY="your-secret-key"
# Build the controller
make build
# Run tests
make test
# Run linter
make lint
The project uses GitHub Actions for CI/CD with the following stages:
-
Build & Test
- Code compilation
- Unit tests
- Integration tests
- Code coverage reporting
-
Quality Gates
- Linting
- Security scanning
- Dependency checking
-
Deployment
- Container image building
- Image scanning
- Registry push
- Kubernetes deployment
# Example workflow stages
name: CI/CD Pipeline
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build
run: make build
- name: Test
run: make test
# Install CRDs
make install
# Deploy controller
make deploy IMG=<your-registry>/controller:tag
apiVersion: vm.cloudclub.io/v1
kind: Provision
metadata:
name: example-vm
spec:
phase: Create
server:
imageProductCode: "UBUNTU20"
productCode: "SPSVRSTAND000056"
vpcNo: "vpc-123"
subnetNo: "subnet-456"
kubectl get provisions
kubectl describe provision example-vm
- Fork both repositories (controller and Aviator-service)
- Create feature branches
- Run tests and linting
- Submit Pull Requests to both repos if needed
- Ensure CI pipeline passes