From a6ab81eeaa8841c53dfb29dc916f89908fa9c338 Mon Sep 17 00:00:00 2001 From: Joakim Olsson Date: Fri, 9 Jan 2026 16:38:39 +0100 Subject: [PATCH] docs: add CLAUDE.md for Claude Code guidance Co-Authored-By: Claude Opus 4.5 --- CLAUDE.md | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 CLAUDE.md diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..8befddb --- /dev/null +++ b/CLAUDE.md @@ -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`) -- 2.52.0