Compare commits
12 Commits
1.2.4
..
15697d176f
| Author | SHA1 | Date | |
|---|---|---|---|
| 15697d176f | |||
| 63c16baf46 | |||
|
37063450c1
|
|||
|
a6ab81eeaa
|
|||
| 9b7ced4e92 | |||
| b0ce0d23f3 | |||
| 19f894cc29 | |||
| d04224b42b | |||
| 46b3a6ddce | |||
|
fba731bc03
|
|||
| d26fed8209 | |||
| 6f8b06e140 |
@@ -0,0 +1,30 @@
|
|||||||
|
name: default-request-adder
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
pull_request:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v6
|
||||||
|
- uses: actions/setup-go@v6
|
||||||
|
with:
|
||||||
|
go-version: 'stable'
|
||||||
|
- name: Run tests
|
||||||
|
run: go test -race -coverprofile=coverage.txt ./...
|
||||||
|
|
||||||
|
vulnerabilities:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v6
|
||||||
|
- uses: actions/setup-go@v6
|
||||||
|
with:
|
||||||
|
go-version: 'stable'
|
||||||
|
- name: Check vulnerabilities
|
||||||
|
run: |
|
||||||
|
go install golang.org/x/vuln/cmd/govulncheck@latest
|
||||||
|
govulncheck ./...
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
name: Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
uses: unboundsoftware/shared-workflows/.gitea/workflows/Release.yml@main
|
||||||
@@ -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`)
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
FROM amd64/golang:1.25.5@sha256:0c27bcf0df81eca89f87e1e78be5ad5e36487f0eaf71cd900ba14ee7621d3e70 as deps
|
FROM amd64/golang:1.25.5@sha256:ad03ba93327b8a6143b49373790b5d92c28067bdb814418509466122ee9c9e63 as deps
|
||||||
WORKDIR /build
|
WORKDIR /build
|
||||||
ADD go.* /build
|
ADD go.* /build
|
||||||
RUN go mod download
|
RUN go mod download
|
||||||
|
|||||||
Reference in New Issue
Block a user