Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .coderabbit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
inheritance: true
language: en-US
reviews:
profile: "chill"
request_changes_workflow: false
high_level_summary: true
high_level_summary_placeholder: "@coderabbitai summary"
high_level_summary_in_walkthrough: true
review_status: true
collapse_walkthrough: true
sequence_diagrams: false
estimate_code_review_effort: false
poem: false
suggested_labels: false
changed_files_summary: true
auto_review:
enabled: true
drafts: true
path_filters:
- "!vendor/**"
tools:
golangci-lint:
enabled: true
knowledge_base:
code_guidelines:
enabled: true
filePatterns:
- AGENTS.md
- .claude/agents/*.md
- .cursor/rules/*.mdc
learnings:
scope: local
28 changes: 28 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Agent Instructions

Rules and gotchas for AI agents working on the `karpenter-operator` repository.

## What This Repo Is

`karpenter-operator` is an OpenShift operator that deploys and manages [Karpenter](https://karpenter.sh/) on OpenShift clusters. It discovers the cluster's cloud provider at runtime and configures Karpenter accordingly.

## Multi-cloud Rules

This operator must support multiple cloud providers. Only AWS is implemented so far, but these rules apply to all code changes:

- **Never import cloud-provider SDKs in generic packages.** Cloud-specific code belongs in `pkg/cloudprovider/<provider>/`. Generic code in `cmd/`, `pkg/operator/`, and `pkg/controllers/` must interact through the `CloudProvider` interface only.
- **Detect the provider at runtime** from the `Infrastructure` CR (`status.platformStatus.type`), not from build tags or hardcoded assumptions.
- When adding provider-specific behavior, ask: "What would the other providers need here?" and leave room for it (interface methods, switch statements, TODOs).

## Operator / Operand Separation

The **operator** (this binary) manages the **operand** (Karpenter). They are separate images in separate Deployments. Do not conflate them — the operator creates and manages the operand's Deployment, ServiceAccount, and RBAC. They share a namespace but have independent credentials and RBAC.

The operand image varies by cloud provider — each provider has its own Karpenter image. The operator must select the correct operand image based on the discovered infrastructure.

## Coding Gotchas

- **Dependencies are vendored.** Always run `make vendor` after changing `go.mod`. Do not use `go get` alone.
- **Import ordering** is enforced by `.golangci.yml`. Run `make lint` after changes — it auto-fixes.
- **Run `make verify`** after any code change. It runs vet, fmt, lint, and tests together.
- **No narrating comments.** Do not add comments that restate what the code does. Comments should only explain non-obvious intent, trade-offs, or constraints.
1 change: 1 addition & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
AGENTS.md
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# karpenter-operator

OpenShift operator that deploys and manages [Karpenter](https://karpenter.sh/) on Red Hat OpenShift clusters. Managed by the Cluster Version Operator (CVO) as part of the OpenShift release payload.

## Building

```bash
make build # Build the operator binary
make test # Run unit tests
make lint # Run golangci-lint
make verify # Run all checks (vet, fmt, lint, test)
make docker-build # Build container image
```

## Deploying (dev)

```bash
make deploy \
IMG=quay.io/you/karpenter-operator:dev \
OPERAND_IMG=quay.io/you/karpenter:dev \
CLUSTER_NAME=my-cluster \
DEV=true
```

## Documentation

- [AGENTS.md](AGENTS.md) — design principles and coding conventions for contributors and AI agents