docs: add CLAUDE.md for Claude Code guidance
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,42 @@
|
|||||||
|
# CLAUDE.md
|
||||||
|
|
||||||
|
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
||||||
|
|
||||||
|
## Project Overview
|
||||||
|
|
||||||
|
A Kubernetes controller that automatically creates `LimitRange` resources (named `extreme-request-defaults`) in all non-excluded namespaces to set default memory requests for containers. Runs as a loop checking every 10 seconds.
|
||||||
|
|
||||||
|
## Build Commands
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Run tests
|
||||||
|
go test -race -coverprofile=coverage.txt ./...
|
||||||
|
|
||||||
|
# Check for vulnerabilities
|
||||||
|
go install golang.org/x/vuln/cmd/govulncheck@latest
|
||||||
|
govulncheck ./...
|
||||||
|
|
||||||
|
# Build binary
|
||||||
|
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o release/default-request-adder -ldflags '-w -s'
|
||||||
|
|
||||||
|
# Build Docker image (uses build-tools, not buildx)
|
||||||
|
docker build -t default-request-adder .
|
||||||
|
```
|
||||||
|
|
||||||
|
## Architecture
|
||||||
|
|
||||||
|
Single-file Go application (`main.go`) that:
|
||||||
|
- Uses in-cluster Kubernetes client configuration (`rest.InClusterConfig()`)
|
||||||
|
- Loops through all namespaces every 10 seconds
|
||||||
|
- Creates `LimitRange` named `extreme-request-defaults` in non-excluded namespaces
|
||||||
|
- Deletes the `LimitRange` from excluded namespaces if present
|
||||||
|
|
||||||
|
### CLI Flags
|
||||||
|
- `-excluded-ns`: Comma-separated list of namespaces to exclude (default: `kube-system`). Use `*` to exclude all.
|
||||||
|
- `-memory`: Default memory request value (default: `1Ti`)
|
||||||
|
|
||||||
|
## CI/CD
|
||||||
|
|
||||||
|
- **Gitea Actions**: `.gitea/workflows/ci.yaml` - runs tests and vulnerability checks
|
||||||
|
- **GitLab CI**: `.gitlab-ci.yml` - uses `buildtool/build-tools` for builds
|
||||||
|
- **Releases**: Uses git-cliff for changelog generation (see `cliff.toml`)
|
||||||
Reference in New Issue
Block a user