Development Setup¶
Set up your local development environment for Minecraft Operator.
Prerequisites¶
| Tool | Version | Purpose |
|---|---|---|
| Go | 1.25+ | Language runtime |
| Podman or Docker | Latest | Container builds |
| Helm | 3.14+ | Chart testing |
| kubectl | 1.27+ | Cluster access |
| Kind | Latest | Local Kubernetes (optional) |
Install Go¶
Install Tools¶
# Helm
brew install helm # or follow helm.sh/docs/intro/install
# kubectl
brew install kubectl # or kubernetes.io/docs/tasks/tools
# Kind (for local cluster)
brew install kind # or kind.sigs.k8s.io/docs/user/quick-start
Clone Repository¶
Generate Code¶
After modifying CRD types in api/v1alpha1/, regenerate code:
# Generate CRDs and DeepCopy methods
make manifests generate
# Format code
make fmt
# Run vet
make vet
Run Tests¶
Test Coverage¶
Run Linter¶
# Check for issues
make lint
# Auto-fix where possible
make lint-fix
# Verify config
make lint-config
All Errors Required
ALL linting errors must be fixed before commit. No exceptions for "cosmetic" issues.
Run Locally¶
Run the operator against your current kubeconfig cluster:
# Default: JSON logs, Info level
make run
# Development: Text logs, Debug level
make run ARGS="--log-level=debug --log-format=text"
The operator will reconcile resources in your cluster.
Build Container¶
# Build with Podman
make container-build IMG=ghcr.io/lexfrei/minecraft-operator:dev
# Push to registry
make container-push IMG=ghcr.io/lexfrei/minecraft-operator:dev
Local Cluster (Kind)¶
Create a local Kubernetes cluster:
# Create cluster
kind create cluster --name minecraft-dev
# Install CRDs
kubectl apply --filename charts/minecraft-operator-crds/crds/
# Run operator locally
make run
Helm Development¶
Lint Charts¶
Template Charts¶
# See generated manifests
helm template minecraft-operator charts/minecraft-operator \
--namespace minecraft-operator-system
# With custom values
helm template minecraft-operator charts/minecraft-operator \
--set replicaCount=2
Install Charts¶
# Install CRDs
helm install minecraft-operator-crds charts/minecraft-operator-crds \
--create-namespace --namespace minecraft-operator-system
# Install operator (local image)
helm install minecraft-operator charts/minecraft-operator \
--namespace minecraft-operator-system \
--set image.repository=ghcr.io/lexfrei/minecraft-operator \
--set image.tag=dev
IDE Setup¶
VS Code¶
Recommended extensions:
- Go (golang.go)
- YAML (redhat.vscode-yaml)
- Kubernetes (ms-kubernetes-tools.vscode-kubernetes-tools)
GoLand¶
Enable:
- Go Modules integration
- gofmt on save
- golangci-lint integration
Environment Variables¶
| Variable | Description | Default |
|---|---|---|
KUBECONFIG | Kubernetes config path | ~/.kube/config |
ENABLE_WEBHOOKS | Enable admission webhooks | false |
LOG_LEVEL | Logging level | info |
LOG_FORMAT | Log format (json/text) | json |
Makefile Targets¶
| Target | Description |
|---|---|
make manifests | Generate CRDs to charts/minecraft-operator-crds/crds/ |
make generate | Generate DeepCopy methods |
make fmt | Run go fmt |
make vet | Run go vet |
make test | Run unit tests |
make test-e2e | Run E2E tests (Kind cluster) |
make lint | Run golangci-lint |
make lint-fix | Auto-fix lint issues |
make build | Build binary to bin/manager |
make run | Run operator locally |
make container-build | Build container image |
make container-push | Push container image |
Troubleshooting¶
envtest Not Working¶
golangci-lint Outdated¶
Kind Cluster Issues¶
# Delete and recreate
kind delete cluster --name minecraft-dev
kind create cluster --name minecraft-dev
See Also¶
- Contributing — Contribution workflow
- CLAUDE.md — Full development standards