Skip to content

Commit 7bd49ec

Browse files
committed
add claude.md
1 parent a4544bd commit 7bd49ec

1 file changed

Lines changed: 88 additions & 0 deletions

File tree

CLAUDE.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Rules
6+
7+
- **Always use kubebuilder CLI to scaffold controllers.** Never manually create controller files. Use:
8+
```bash
9+
# For controllers with new CRDs:
10+
kubebuilder create api --group <group> --version <version> --kind <Kind>
11+
12+
# For controllers watching external CRDs:
13+
kubebuilder create api \
14+
--group <group> \
15+
--version <version> \
16+
--kind <Kind> \
17+
--controller=true \
18+
--resource=false \
19+
--external-api-domain <domain> \
20+
--external-api-path <import-path>
21+
```
22+
Then implement your logic in the scaffolded `*_controller.go` file.
23+
24+
## What is OpenKruise Controller?
25+
26+
A Kubernetes controller that integrates OpenKruise rollout capabilities with Kuberik's rollout management system. It manages RolloutTest and RolloutStepGate resources for progressive delivery testing.
27+
28+
## Common Development Commands
29+
30+
```bash
31+
# Generate code after modifying CRD types
32+
make manifests # Generate CRD YAML from Go types
33+
make generate # Generate DeepCopy methods
34+
35+
# Code quality
36+
make fmt # go fmt
37+
make vet # go vet
38+
make lint # gofmt + govet
39+
40+
# Testing
41+
make test # Run unit tests (Ginkgo/Gomega)
42+
make test-e2e # Run e2e tests on Kind cluster
43+
44+
# Building
45+
make build # Build binary
46+
make docker-build # Build container image
47+
make docker-push # Push to registry
48+
49+
# Deployment
50+
make install # Install CRDs to cluster
51+
make deploy # Deploy controller to cluster
52+
make uninstall # Remove CRDs and controller
53+
make run # Run locally (without cluster deployment)
54+
```
55+
56+
## Development Workflow
57+
58+
1. Modify CRD type definitions in `api/v1alpha1/*_types.go`
59+
2. Run `make manifests generate` to update CRDs and DeepCopy methods
60+
3. Implement reconciliation logic in `internal/controller/*_controller.go`
61+
4. Write tests in `internal/controller/*_controller_test.go`
62+
5. Run `make test` to verify
63+
6. Deploy with `make docker-build docker-push deploy IMG=registry/image:tag`
64+
65+
## CRDs Managed
66+
67+
- **RolloutTest**: Defines test configurations for progressive delivery
68+
- **RolloutStepGate**: Controls step-by-step progression in rollouts
69+
70+
## Dependencies
71+
72+
The controller depends on:
73+
- `sigs.k8s.io/controller-runtime` - Kubebuilder framework
74+
- OpenKruise APIs for rollout management
75+
76+
## Debugging
77+
78+
```bash
79+
# Controller logs
80+
kubectl logs -n kuberik-system deployment/openkruise-controller -f
81+
82+
# Events
83+
kubectl get events --sort-by='.lastTimestamp'
84+
85+
# Describe resources
86+
kubectl describe rollouttest <name>
87+
kubectl describe rolloutstepgate <name>
88+
```

0 commit comments

Comments
 (0)